简体   繁体   English

Amazon EC2中的Memcached延迟

[英]Memcached Latency in Amazon EC2

I am planning to use Amazon EC2 host only for MemCache.My web application ll be residing on shared hosted server and will be communicating to Ec2 for querying Memcache. 我打算仅将Amazon EC2主机用于MemCache。我的Web应用程序将驻留在共享托管服务器上,并将与Ec2通信以查询Memcache。 How would be the performance of this setup. 此设置的性能如何。

Regards, Mugil. 问候,穆吉尔。

Don't want to criticize your choice of architecture, but it sounds like you're misplacing your priorities. 不想批评您对体系结构的选择,但这听起来像是您摆在优先位置。 Memcache doesn't need a huge box to run on; Memcache不需要巨大的盒子就可以运行; it just needs as much memory as you're willing to feed it. 它只需要您愿意提供的内存就可以了。 The benefits of it are from the speed it offers while pushing and pulling information to/from it. 它的好处是它在向/从其推入/拉出信息时所提供的速度。 Putting your MC box outside of your internal network--EC2 or not--basically kills the effectiveness of having a MC box to begin with. 将MC盒放置在内部网络(无论是否为EC2)之外,基本上会破坏使用MC盒的效率。 Let's say you save 100ms on a DB request, but the latency to EC2 is 50ms. 假设您在一个数据库请求上节省了100毫秒,但到EC2的延迟为50毫秒。 You're still wasting 49 milliseconds that you would have otherwise been able to take advantage of. 您仍然浪费了本来可以利用的49毫秒。

Shared hosting is (for a great many large-scale applications) absolute crap. 共享主机(对于很多大型应用程序)绝对是垃圾。 If you have a project big enough to require an EC2 box's horsepower for your CACHING service, then you're definitely doing something wrong. 如果您有一个足够大的项目来需要您的CACHING服务使用EC2盒子的功率,那么您肯定做错了。 Here's my suggestion: move your application out to EC2 and host the Memcached instance on the same box. 这是我的建议:将您的应用程序移至EC2,并将Memcached实例托管在同一框中。 The overhead isn't terrible, and if you're planning on scaling your cache, just boot up another box and point your application to that MC instance. 开销并不可怕,如果您打算扩展缓存,只需启动另一个框并将您的应用程序指向 MC实例即可。

Another option would be to go with a less expensive VPS host, like Linode or Slicehost . 另一种选择是使用价格较低的VPS主机,例如LinodeSlicehost Both have great reputations in the community. 两者在社区中都享有很高的声誉。 If I'm not mistaken, parts of Foursquare are even hosted with Slicehost. 如果我没记错的话,Foursquare的某些部分甚至都由Slicehost托管。 These are both very inexpensive VPS solutions (compared to quite a few shared solutions; look at them point-for-point with something like MediaTemple) and can be scaled very easily. 这些都是非常便宜的VPS解决方案(与许多共享解决方案相比;使用MediaTemple之类的工具逐点查看它们),并且可以轻松扩展。 Let's say you start out with a $20 Linode box for your MC instance. 假设您以20美元的MC实例Linode盒子开始。 You're saving something like $50/month out of the gate because you're not on EC2. 因为您不在EC2上,所以每月可以节省大约50美元。 If you move your hosting over to another $20/month Linode, you're probably paying about the same amount (maybe a little more if you're on shared hosting). 如果您将托管转移到另一个每月$ 20的Linode,则您可能要支付相同的费用(如果您使用共享托管,则可能要多一些)。 Plus, if you put your Linodes in the same data center, the latency between your web app and your cache is virtually nothing. 另外,如果将Linodes放在同一数据中心,则Web应用程序和缓存之间的延迟几乎没有。

Down the road, let's say that you want to boost up your MC box. 假设您要增强MC盒的性能。 Just boot up another box running MC and delete your old one. 只需启动另一个运行MC的框并删除旧的框即可。 You could shut one down and resize it, but then you've got downtime (but it's still an option). 您可以关闭一个并重新设置它的大小,但是这样会导致宕机(但这仍然是一种选择)。

Hope this helps! 希望这可以帮助!

Matt 马特

That doesn't sound like a good idea, your memcached calls are going to go over the internet (as opposed to when you use ec2 for your web app, then your memcached calls are just within the amazon datacenter and very fast (or even on the same machine)). 听起来这不是一个好主意,您的Memcached调用将通过Internet传输(与当您将ec2用于Web应用程序相反,那时您的Memcached调用仅在亚马逊数据中心内,而且速度非常快(甚至在同一台机器))。

If you're going to get an EC2 instance, you should run your web app on EC2, and add in a little memcached there if you need more performance. 如果要获得EC2实例,则应在EC2上运行Web应用程序,并在其中添加一些内存缓存(如果需要更高的性能)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM