Better transactions
I have improved the retry mechanism for my simple transaction library. There are two improvements: Firstly, memory usage is now constant with relation to the number of retries. Second, the time that a thread will wait until it retries is now calculated in a smarter way: the more a thread has retried getting the lock, the more it will wait until it tries again.
The current version of the library is useable, but there are at least two things that I think should be improved if one wants to use it in real applications:
- Allow more user control on the way the wait time before a retry is calculated — as this is key to the performance one will get. This could be done by supporting "pluggable wait policy" for example.
- Implement an even more optimistic policy that does not lock variables at all, but instead calculated the entire locked section as if it was alone, and only once this is done, just before committing, test whether some other thread was messing around with the data.
Comments
This sounds very interesting, I would be very interested in reading a blog about how to use your library, and how you implemented it. As you wrote in a previous entry, the for comprehension monad is not easy to grasp, so I'd be curious about that too. :-)
Posted by: Iulian | May 20, 2005 04:22 PM