AWS 上的分布式计数器
我有一个服务的多个实例在多个 EC2 实例上运行,并且我需要一个该服务的所有实例都可以访问的全局计数器。计数器需要支持设置/重置和递增操作。我第一次尝试构建它是使用 SimpleDB,其中 SimpleDB 中的属性存储计数器值。但事实证明 SimpleDB 对此来说太昂贵了,因为我预计访问计数器的请求数量非常多。大多数对计数器的请求都是 get 请求,很少有请求实际修改计数器值。
我正在考虑的另一个选择是使用 memcache 来缓存计数器值并使用 SimpleDB 作为计数器的持久存储。这应该会显着减少对 SimpleDB 的调用次数。但由于我在服务中确实没有使用 memcache 或 SimpleDB,因此似乎我需要不必要地为一个小功能管理两个额外的组件。
这个问题有标准的解决方案吗?
I have multiple instances of a service running on multiple EC2 instances and I need a global counter which all instances of the service can access. The counter needs to support set/reset and increment operations. My first attempt to build this was using SimpleDB where an attribute in SimpleDB stores the counter value. But SimpleDB is proving to be too expensive for this since I expect a very high number of requests accessing the counter. Most of the requests to the counter are get requests with very few requests actually modifying the counter value.
Another option that I am thinking of is to use memcache to cache the counter value and use SimpleDB as the persistent store for the counter. This should significantly reduce the number of calls to SimpleDB. But since I really do not have any other use of memcache or SimpleDB in my service it seems like I need to unnecessarily manage two extra components for a small functionality.
Is there any standard solution to this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我们最终决定使用SimpleDB。它非常简单并且很好地满足了我们的需求。
We finally decided to use SimpleDB. It was pretty simple and served our needs well.
Redis 具有持久性存储,除非您达到 100% 的内存使用率,否则不会遇到问题。您还可以在 Redis 中备份、主/从和转储数据库。
Redis has a persistent store, unless you get to 100% of the memory usage you won't run into a problem. You can also backup, master/slave, and dump the database in Redis.