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. 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; 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. Let's say you save 100ms on a DB request, but the latency to EC2 is 50ms. You're still wasting 49 milliseconds that you would have otherwise been able to take advantage of.
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. Here's my suggestion: move your application out to EC2 and host the Memcached instance on the same box. 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.
Another option would be to go with a less expensive VPS host, like Linode or Slicehost. Both have great reputations in the community. If I'm not mistaken, parts of Foursquare are even hosted with 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. Let's say you start out with a $20 Linode box for your MC instance. You're saving something like $50/month out of the gate because you're not on EC2. 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). Plus, if you put your Linodes in the same data center, the latency between your web app and your cache is virtually nothing.
Down the road, let's say that you want to boost up your MC box. Just boot up another box running MC and delete your old one. 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)).
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.
精彩评论