3

What I am trying to do is cache all the data that I have written into mongodb. So that all client requests are served from the cache. Should I consider ehcache or memcache. Note the mongodb data is queried a lot, that is why I have thought to cache all of it at server start time, no writes are permitted to this data. I am using java for the application.

4

1 回答 1

1

如果您仅将它用于读取,那么在 MongoDB 前面使用缓存几乎没有意义。额外的缓存只会占用更多内存。MongoDB 使用内存映射文件,操作系统会将请求最多的数据保存在内存中。如果您的所有数据都适合内存,那么 MongoDB 将直接从中返回所有文档 - 就像额外的缓存一样。

于 2013-08-07T08:34:56.757 回答