Re: Sneer code, Async I/O and Vanilla-java

Clebert Suconic <[email protected]>
Newsgroups gmane.comp.java.prevayler
Message-ID <CAKF+bsqjjbOxkj155qCZHBp6-j7pwHhkX+nCfm==vcn_oMOnHQ@mail.gmail.com>
This is the operation context:

http://anonsvn.jboss.org/repos/hornetq/branches/Branch_2_2_AS7/src/main/org/hornetq/core/persistence/impl/journal/OperationContextImpl.java


The OperationContext is implementing the callback I use on the Journal

http://anonsvn.jboss.org/repos/hornetq/branches/Branch_2_2_AS7/src/main/org/hornetq/core/journal/IOCompletion.java
http://anonsvn.jboss.org/repos/hornetq/branches/Branch_2_2_AS7/src/main/org/hornetq/core/asyncio/AIOCallback.java


Any time either NIO or the native AIO SequentialFiles complete a sync
they will call the callback there.


Before I submit anything to the Journal, I call storeLineUp.

I then add something similar to Runnables to the Context by calling
executeOnCompletion(final IOAsyncTask completion)

One caveat I have is if the context is already complete at the time I
called executeOnCompletion, I simply call it at the same thread to
avoid context switch when not needed (say when the persistence was
faster).

With this context, I never blocked anything on the server and I could
scale up much better.

These are thing that I discovered over hard time on tests and during
implementation. Somewhat our secret sauce on the performance :-)


Feel free to ask me any help (even directly if you need). I may not
have a lot of time to dedicate but I somewhat have some love for
prevalyer. As I first heard about this project through Einar Saukas
and Bruno Souza when I was working a Summa in Brazil. I guess they are
friends in common from many of you guys who wrote prevalyer initially.

------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
Learn about the latest advances in developing for the 
BlackBerry&reg; mobile platform with sessions, labs & more.
See new tools and technologies. Register for BlackBerry&reg; DevCon today!
http://p.sf.net/sfu/rim-devcon-copy1 
_______________________________________________
To unsubscribe go to the end of this page: http://lists.sourceforge.net/lists/listinfo/prevayler-discussion
_______________________________________________
"Databases in Memoriam" -- http://www.prevayler.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.