Using asynchronous API of JGroups for asynchronous replication
--------------------------------------------------------------
Key: JBCACHE-1564
URL:
https://jira.jboss.org/jira/browse/JBCACHE-1564
Project: JBoss Cache
Issue Type: Patch
Security Level: Public (Everyone can see)
Components: Replication
Affects Versions: 3.2.1.GA
Reporter: Krzysztof Sobolewski
Assignee: Manik Surtani
As I mentioned on Infinispan list, I run into some problems with NBST and asynchronous
replication. Quoting my message:
***
The thing is that the "asynchronous" replication uses the usual method of
submitting a task to an Executor. This is no problem without NBST, because the
tasks are not interested in responses and finish immediately, but with NBSP
they need responses to facilitate replay. And since they need to wait for
responses, they clog the Executor's threads and under sufficiently heavy load,
it all degrades to effectively synchronous replication. And it happens quite
fast, really.
***
The fix in the attached patch creates a new class, AsynchronousRpcDispatcher, and makes
CommandAwareRpcDispatcher extend it. The new class adds a new variant of castMessage()
method - castMessageAsync(). I takes a ScheduledExecutorService where it schedules a
timeout task, and a "closure" callback object, an implementation of
AsyncCallback interface, which is invoked when the replication task is complete.
"Completion" also means a timeout, in which case the callback is invoked with
whatever responses were received.
One thing I had to do was to "hack" the GroupRequest class from JGroups to
expose responsesComplete() method. I just copied it and did the necessary modification,
diff of which is also attached. The method I needed is used to check whether the received
responses are enough to complete the request.
There are also some minor stylistic tweaks in the patch unrelated to the real thing.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira