Choosing a distributed shared memory solution

别说谁变了你拦得住时间么 提交于 2019-12-02 16:57:25

Have a look at Hazelcast. It is pure Java, open source (Apache license) highly scalable in-memory data grid product. It does offer 7X24 support. And it does solve all of your problems I tried to explain each of them below:

  1. It has a native Java Client.
  2. It is 100% dynamic. Add and remove nodes dynamically. No need to change anything.
  3. Again everything is dynamic.
  4. You can configure number of backup nodes.
  5. Hazelcast support persistency.
  6. Everything that Hazelcast offers is free(open source) and it does offer enterprise level support.
  7. Hazelcast is single jar file. super easy to use. Just add jar to your classpath. Have a look at screen cast in main page.
  8. Hazelcast is strictly consistent. You can never read stale data.

I suggest you to use Redisson - Redis based In-memory Data Grid for Java. Implements (BitSet, BloomFilter, Set, SortedSet, Map, ConcurrentMap, List, Queue, Deque, BlockingQueue, BlockingDeque, ReadWriteLock, Semaphore, Lock, AtomicLong, CountDownLatch, Publish / Subscribe, RemoteService, ExecutorService, LiveObjectService, SchedulerService) on top of Redis server! It supports master/slave, sentinel and cluster server modes. Automatic cluster/sentinel servers topology discovery supported also. This lib is free and open-source.

Perfectly works in cloud thanks to AWS Elasticache support

Depending of what you prefer, i would surely follow the others by suggesting Hazelcast if you're towards AP from the CAP Theorem but if you need CP, i would choose Redis

You may want to checkout Java-specific solutions like Coherence: http://www.oracle.com/global/ru/products/middleware/coherence/index.html

However, I consider such solutions to be too complex and prefer to use solutions like memcached. Big disadvantage of memcached for your purpose is lack of record lock it seems and there is no built in way to replicate data for failover. That is why I would look into the key-value data stores. Many of them would satisfy your need completely.

Here is a list of key-value data stores that may help you with your task: http://www.metabrew.com/article/anti-rdbms-a-list-of-distributed-key-value-stores Just pick one that you fill comfortable with.

I am doing a similar project, but instead targeting the .NET platform. Apart from the already mentioned solutions, I think you should take a look at ScaleOut StateServer and Alachisoft NCache. I am afraid neither of these alternatives are cheap, but they are a safer bet than open source for commercial solutions according to my judgement.

  1. Both provide Java client APIs, even though I have only played around with the .NET APIs.
  2. StateServer features self-discovery of new cache nodes, and NCache has a management console where new cache nodes can be added.
  3. Both should be able to handle failovers seamlessly.
  4. StateServer can have 1 or 2 passive copies of the data. NCache features more caching topologies to choose between.
  5. If you mean write-through/write-behind to a database that is available in both.
  6. I have no idea how many cache servers you plan to use, but here are the full price specs: ScaleOut StateServer Alachisoft NCache
  7. Both are installed and configured locally on your server and they both have GUI Management.
  8. I am not sure exactly what strictly consistent involves, so I'll leave that for you to investigate..

Overall, StateServer is the best option if you want to skip configuring every little detail in the cache cluster, while NCache features very many features and caching topologies to choose from.

Depending on the behaviour of data towards the clients (if the data is read many times from the same client) it might be a good idea to mix local caching on the clients with the distributed caching in the cluster (available for both NCache and StateServer), just a thought.

Have a look at Terracotta's JVM clustering, it's OpenSource ;) It has no API while it works efficent at JVM level, when you store the value in a replicated object it is sent to all other nodes. Even locking and all those things work transparent and without adding any new code.

The specified use case seems to fit into Netflix's Hollow. This is a read-only replicated cache with a single producer and multiple consumers.

Have you tought about using a standard messaging solution like rabbitmq ? RabbitMQ is an open source implementation of the AMQP protocol.

Your application seems more or less like a Publish/subscribe system. The Publisher node is the one that does the processing and puts messages (processed data) in a queue in the servers. Subscribers can get messages from the server in various ways. AMQP decouples the producer and the consumer of messages and is very flexible in how you can combine the two sides.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!