This is something of an architecture question. I have this idea of having a server with huge memory, t开发者_如何学运维hat is used as a big objects cache holder. The clients send "Actions" to this server(like Search Person with property age<13). And then, this machine(to complicate things it would be nice to have more instances of this server and distribute the Persons list for each instance to hold half the data, and both instances would work on the query - MapReduce style) will then return the Persons that match the criteria. Other "Actions" would be a specific cache flush, or say "Update Person with id=3 to instance ...", etc.
Guess the best thing that does that it's Oracle Coherence, but I wonder if anybody has other open source solutions, or ideas.
One simple solution would be to use EhCache with Hibernate, but I do not know what protocol I would use to turn this into a server(I see sending the actions as invoking methods on the "server" and the methods return the list of Persons that match the query). Maybe simple RMI could be used. I'm not yet convinced, I would like a more proven solution, a framework, also it would be nice to have failover, autodiscovery and map reduce. I guess I could wrap GridGain on top of my EhCache solution and solve that? Would that be overkill(I may stick to only one instance of this datagrid server).
Other option would be Terracotta. The thing is I do not know very much about Terracotta, only that you can share data among instances. If I add elements from a process to the distributed cache, and in another process is there a local copy of the cache, and only differences are replicated? That would be great for the fact that every process would query the local cache and that would be very fast, but it will also mean much memory used in the client processes.
So anybody got any ideas?
Thank you.
As the simple solution to a simple EhCache, I think I could use Hazelcast to implement cluster awarness and invoking the "Actions" - Hazelcast
Again the MapReduce could prove interesting as the solution. It's very interesting as they say they provide MapReduce and keeping track at the locality of data, that should be very fast. I'm not sure it is ok in case we do not have more than two servers.
Why do you need a cache? What you described in the first paragraph of your question sounds a lot like a relational database whose tables are stored entirely in memory. Do you have any scalability requirements that may require distributing your data across several servers in a cluster?
I believe Terrastore is built to solve this problem, however access to Terrastore is intended to be out of process, not in process (you weren't specific what kind of access you need).
Terrastore is an OSS project based on Terracotta.
You can check it out Redis as well. It has very good query language.
精彩评论