我们有一个从数据库加载用户对象的网络应用程序。它是一个具有数千个并发用户的大容量应用程序,因此我们正在寻找缓存用户对象的方法,以最大限度地减少数据库负载。

目前正在使用 ehcache,但正在考虑使用 memcached 来降低应用程序的内存需求,并使其更具可扩展性。

我们目前在使用 memcached 时遇到的问题是序列化 User 实例带来的 cpu 负载。我们正在寻找加速序列化的方法,但也在考虑是否可以使用由 memcached 服务器支持的较小的 ehcache 缓存。

有没有人有过使用由 memcached 支持的 ehcache 的经验(即首先查看 ehcache,如果用户不在,则查看 memcache,如果没有则查看数据库)?

这种方法有什么缺点吗?

请您参考如下方法:

如果你愿意离开 Ehcache,你可以考虑 Infinispan ,现在包括与 memcache 的集成.它比 Ehcache 更容易工作,但不会太多。

Starting with version 4.1, Infinispan distribution contains a server module that implements the memcached text protocol. This allows memcached clients to talk to one or several Infinispan backed memcached servers. These servers could either be working standalone just like memcached does where each server acts independently and does not communicate with the rest, or they could be clustered where servers replicate or distribute their contents to other Infinispan backed memcached servers, thus providing clients with failover capabilities.


评论关闭
IT虾米网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!