运行 4 个 .5GB 内存缓存服务器或一个 2GB 实例之间有什么区别吗?
运行多个实例有什么好处吗?
如果一个实例失败,您仍然可以获得使用缓存的优势。如果您使用的 Consistenthashing 将相同的数据带到同一个实例,而不是在仍在运行的机器之间传播新的读/写,则尤其如此。
您还可以选择在 32 位操作系统上运行服务器,该操作系统不能处理超过 3GB 左右的内存。
查看常见问题解答:http: //www.socialtext.net/memcached/和http://www.danga.com/memcached/
高可用性很好,memcached 会自动将您的缓存分布在 4 台服务器上。如果其中一个服务器由于某种原因而死机,您可以通过继续处理该错误,就好像缓存是空白的一样,重定向到不同的服务器,或者您想要的任何类型的自定义错误处理。如果您的 1x 2gb 服务器死机,那么您的选择非常有限。
要记住的重要一点是,您没有 4 个缓存副本,它是 1 个缓存,分配给 4 个服务器。
唯一的缺点是用完 4x .5 比用完 1x 2gb 内存更容易。
I would also add that theoretically, in case of several machines, it might save you some performance, as if you have a lot of frontends doing a lot of heavy reads, it's much better to split them into different machines: you know, network capabilities and processing power of one machine can become an upper bound for you.
This advantage is highly dependent on memcache utilization, however (sometimes it might be ways faster to fetch everything from one machine).