On 23/02/12 5:54 AM, Andrus Adamchik wrote:
Here is a potentially disruptive change to Cayenne core:
http://svn.apache.org/viewvc?view=revision&revision=1292437
(also see https://issues.apache.org/jira/browse/CAY-1670 )
This removes the major global lock and has a potential to significantly
increase throughput (which is an issue, see CAY-1124 by Tore for instance). The
implementation is based on a previously untried by us data structure -
ConcurrentLinkedHashMap - http://code.google.com/p/concurrentlinkedhashmap/ .
It is used by Apache Cassandra, so presumably it works and can handle the load.
I internalized this code, placing it under
org.apache.cayenne.util.concurrentlinkedhashmap.
I need help with testing though... Maybe someone has any kind of load tests
that can emulate multiple DataContexts attached to a single ServerRuntime and
performing various select/modify operations? Or maybe you are daring enough to
place this in production? I will do the same on my end.
To give some reassurance, our single-threaded unit tests pass 100% with no
changes after I swapped commons-collections LRUMap to ConcurrentLinkedHashMap.
Appreciate feedback on this feature!
Some questions rather than feedback at this stage:
* ConcurrentLinkedHashMap seems to have a roadmap
http://code.google.com/p/concurrentlinkedhashmap/wiki/Changelog and ongoing
development. Since this is the case, is it wise to fork it into the Cayenne
source rather than link to the built artifacts and make it easier to update in
the future?
* How does this new code interact and relate to third party caches such as
OScache when used in Cayenne? I was never 100% clear about how the old one
interacted, and I guess nothing much had changed in this regard, but it would
be good to understand this better.
* I see that version 2.0 will allow for pluggable eviction policies (They will
switch between LRU and LIRS). And they mention the idea of weighting by
key/value. Any thoughts about whether that would be useful to Cayenne to be
able to implement even more flexible policies, particularly given the demise of
OScache?
Ari
--
-------------------------->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C 5EFA EF6A 7D2E 3E49 102A