一、从Java语言考虑,已经有ConcurrentHashMap等并发集合类了,与Redis相比,区别于差别在哪?java
一直有这么个疑问,今天有搜了好久,很巧,搜到个有一样想法的问答,以下:redis
When profiling a java application currently under development at work, we have detected a few bottle necks that we can get rid of using caching. The application process requests and it should be as fast as possible doing so. We are considering Redis as cache solution because we already use it in the application. Basically we have to cache java objects. With Redis we have to serialize / deserialize those objects + network overhead. Given that basically Redis is a key value store, I was wondering if it may be more efficient to use a ConcurrentHashMap instead of Redis, as that will save us the serialization and network overhead. However, searching in the internet, I could not find anyone using it for this purpose. Am I missing something? Which is the practical limit of the ConcurrentHashMap for this purposes (in terms of concurrent requests and cached data volume)?缓存
asked Dec 4 '13 at 13:39 joanlofe并发
回答的很明显,也好理解:Redis不仅是用做字典缓存的,它还能够用于线程之间共享数据;一想还真是,高并发访问的系统/服务确定要搞集群,多节点之间的数据共享就体现除Redis的价值了。app
还有一个帖子:ide
Generally, the Guava or Caffiene caching utilities are applicable whenever:高并发
· You are willing to spend some memory to improve speed.this
· You expect that keys will sometimes get queried more than once.spa
· Your cache will not need to store more data than what would fit in RAM. (Guava caches are local to a single run of your application. They do not store data in files, or on outside servers. If this does not fit your needs, consider some other tool.)线程
As it says they do not store data in files or outside servers, then a popular and modern outside server option could be redis.