On Mon, Mar 23, 2009 at 2:36 PM, Mark Volkmann <r.mark.volkm...@gmail.com>wrote:
> > > In the case where two transactions need to modify the same Ref they > > definitely to be serialized, either by explicitly using locks in Java, or > by > > letting Clojure automatically retry one of them. In either case it about > the > > same thing happens. Transaction A starts and finishes, then Transaction B > > starts and finishes. > > I don't think the same thing happens. In the case of Clojure, both > transaction A and B start. Suppose A finishes first and commits. Then > transaction B retries, finishes and commits. That's what I was > referring to as non-useful work. I'm not saying it's the wrong > approach, but it is different. > The fact that B is tried once concurrently with A, and is then aborted and retried is in my opinion the same as transaction B being stuck waiting on a lock while A is being processed, but I can see how trying B concurrently with A the first time might waste more resources, and that perhaps for certain applications it locks might have better performance. > I agree that Clojure makes the programming much easier, but is there a > downside? Maybe the downside is performance. If I found out that a > particular transaction was commonly being retried many times, is that > a sign that I need to write the code differently? How would I find out > that was happening? I know I could insert my own code to track that, > but it seems like this may be a commonly needed tool for Clojure to > detect excessive conflicts/retries in transactions. Maybe we could set > a special variable like *track-retries* that would cause Clojure to > produce a text file that describes all the transaction retries that > occurred in a particular run of an application. If such a tool isn't > needed or wouldn't be useful, I'd like to understand why. > I can imagine how in certain situations a profile mode where Clojure keeps track of transaction retries, and maybe even the reason why they happened might be useful. -- Cosmin Stejerean http://offbytwo.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---