Redis:Amazon EC2与Elasticache [英] Redis: Amazon EC2 vs Elasticache

查看:232
本文介绍了Redis:Amazon EC2与Elasticache的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想自己托管Redis服务器。我将EC2与Elasticache进行了比较。
而且我想知道EC2的缺点是什么。



EC2小型实例的成本与ELasticache小型实例一样多,但只有400 mb的ram更多。为什么要使用Elasticache而不在ec2微小距离上设置自己的Redis服务器?

解决方案

tl; dr:Elasticache迫使您



长版本:



我意识到了这一点是一篇旧文章(撰写本文时为2年),但我认为重要的是要指出我在这里看不到的观点。



在弹性疼痛方面,您的redis部署由亚马逊管理。



Redis使用单个执行线程进行读取/写入。这样可确保不带锁定的一致性。就性能而言,不管理锁和闩锁是一项重要资产。不过,不幸的结果是



实际上,具有多个vCPU的实例大小很多。





亚马逊似乎已经意识到了这个问题,但是他们对此似乎有点不屑一顾。





使这个问题特别相关的部分是在EC2上(因为您正在管理自己的部署),您可以实现 多租户 。这意味着您有许多Redis进程在不同端口上侦听的实例。通过基于记录键的哈希值选择要在应用程序中进行读写的端口,您可以利用所有vCPU。



与实例大小上的内存缓存的Elasticache部署相比,多核计算机上的Redis Elasticache部署应始终性能不佳。



更新:



Amazon现在为您提供单独的指标Redis实例CPU,EngineCPUUtilization。您不再需要使用伪劣乘法来计算CPU,但是仍然无法实现多租户。


I want to host a Redis Server by myself. I compared EC2 to Elasticache. And I would like to know what the disadvantage of EC2 are.

An EC2 tiny instance costs as much as the ELasticache tiny instance but hast 400 mb of ram more. Why should use Elasticache and not setup an own Redis Server on the ec2 tiny isntance?

解决方案

tl;dr: Elasticache forces you to use a single instance of redis, which is sub-optimal.

The long version:

I realize this is an old post (2 years at the time of this writing) but I think it's important to note a point I don't see here.

On elasticache your redis deployment is managed by Amazon. This means you're stuck with however they choose to run your redis.

Redis uses a single thread of execution for reads/writes. This ensures consistency w/o locking. It's a major asset in terms of performance not to manage locks and latches. The unfortunate consequence, though, is that if your EC2 has more than 1 vCPU they will go unused. This is the case for all elasticache instances with more than one vCPU.

The default elasticache instance size is cache.r3.large, which has two cores.

In fact, there are a number of instance sizes with multiple vCPUs. Lots of opportunity for this issue to manifest.

It seems Amazon is already aware of this issue, but they seem a bit dismissive of it.

The part that makes this especially relevant to this question is that on your EC2 (since you're managing your own deployment) you're able to implement multi-tenancy. This means you have many instances of the redis process listening on different ports. By choosing which port to read/write to/from in the application based on a hash of the record's key you can leverage all your vCPUs.

As a side note; an redis elasticache deployment on a multi-core machine should always under perform compared to memcached elasticache deployment on the instance size. With multi-tenancy redis tends to be the winner.

Update:

Amazon now provides separate metrics for your redis instance CPU, EngineCPUUtilization. You no longer need to compute your CPU with the shoddy multiplication, but multi-tenancy is still not implemented.

这篇关于Redis:Amazon EC2与Elasticache的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆