You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by Andrus Adamchik <an...@objectstyle.org> on 2012/02/22 19:54:41 UTC

Non-blocking DataRowStore - need help to test

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!

Thanks,
Andrus

Re: Non-blocking DataRowStore - need help to test

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Feb 23, 2012, at 4:10 AM, Aristedes Maniatis wrote:

> * 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?

There are a few considerations. First, my general aversion to expanding the list of dependencies. Aside from that ConcurrentLinkedHashMap is written for Java 1.6. We are supporting 1.5, so I had to transform the original source to conform. So the plan is to merge changes made on the ConcurrentLinkedHashMap side if we need them. 

> * 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.

This is snapshot cache. It does not interact with query caches at all at this point. But see below.

> * 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?

A unified (objects, snapshots, query results) caching solution is a #1 feature for Cayenne 3.2 on my list. Once we start looking at that, it may turn out that ConcurrentLinkedHashMap is only a stopgap measure until we can load snapshots into a unified cache. 

In any event it is useful to start playing with it now, as there's another synchronization aspect of the DataRowStore that is provider-agnostic - per-commit snapshots processing used to be done atomically with DataRowStore locked. Now each snapshot is processed independently, so in a multithread environment the order of snapshot processing can get mixed up. My assertion is that it doesn't matter, but I'd like to prove that somehow.

Andrus



Re: Non-blocking DataRowStore - need help to test

Posted by Aristedes Maniatis <ar...@maniatis.org>.
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

Fwd: Non-blocking DataRowStore - need help to test

Posted by Andrus Adamchik <an...@objectstyle.org>.
FYI. 

Figured I'd expand the scope of this pre-announcement to find some volunteers to test the new code. If anyone wants to do it, but can't build Cayenne trunk for some reason ( http://cayenne.apache.org/building-cayenne.html ), let me know. I'll assemble the binaries.

Thanks,
Andrus

Begin forwarded message:
> From: Andrus Adamchik <an...@objectstyle.org>
> Date: February 22, 2012 9:54:41 PM GMT+03:00
> To: dev@cayenne.apache.org
> Subject: Non-blocking DataRowStore - need help to test
> Reply-To: dev@cayenne.apache.org
> 
> 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!
> 
> Thanks,
> Andrus


Re: Non-blocking DataRowStore - need help to test

Posted by Tore Halset <ha...@pvv.ntnu.no>.
Wow, thanks a lot! Looking forward to test and use this!

 - Tore.

On Feb 22, 2012, at 19:54, Andrus Adamchik <an...@objectstyle.org> 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!
> 
> Thanks,
> Andrus

Re: Non-blocking DataRowStore - need help to test

Posted by Andrus Adamchik <an...@objectstyle.org>.
So, anyone had a chance to try it?

My colleagues are working on a test right now. Hopefully will have something next week. Also I did some more staring at the code involved, and I guess all we are doing here is making more obvious the lack of guaranteed order of context refresh events. Since cross-context synchronization was asynchronous already (or as I like to call it - "probabilistically consistent" :)), we are not changing the behavior that much, just changing the probability.

Still would like to hear the feedback from the field.

Cheers,
Andrus


On Feb 22, 2012, at 1:54 PM, 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!
> 
> Thanks,
> Andrus