A bunch of separate real concerns here:

---------------
On the issue of STM Slowdown:

- Clojure is typically slower than Java by an interesting amount when
doing Plain Olde Java Stuff, unless great care is taken (it's possible
to take great care).  Such a slowdown matters less than the ability to
quickly produce functioning code in many cases.
- STM'd C/C++ code is *typically* slower than normal code by 3x to 10x
(depends on the STM) because of the need to track *all* variables.
- Clojure does not need to track all variables, just REFs - so it's
"STM slowdown" factor is probably 10x reduced from the typical C/C++
slowdown.  This coupled with a typically lower base speed means
Clojure XTNs don't slow down Clojure programs just for existing.


---------------
On the issue of 99.9% retry:

Clojure's STM suffers from being "obstruction free" and not "lock
free" (I think; I haven't paid real close attention to the details).
This means that conflicting XTN's can obstruct one another when making
committing.  This problem is typical of STM's, BTW.

Basically, I wrote a tiny microbenchmark with endless conflicting
transactions.  As I add *real CPUs* (not just threads), total
throughput *drops*.  With a locking implementation, total throughput
would drop some, then hit some lower bound and stay there.  Note that
this is *total* throughput, not just throughput-per-CPU or throughput-
per-thread.  It's a performance inversion problem: adding more CPUs
hurts!  Until this is fixed, multi-threaded performance on Clojure
will remain fragile.

The problem is generic to STMs - so really I'm saying that STMs, in
general, have a more fragile performance profile than locks and this
is one of the reasons that STMs have had problems getting traction in
the Real World.

Now, just to be a pessimist I'll point out that the
java.util.concurrent Locks are *also* using obstruction-free
algorithms and when an Azul box cuts loose with a few hundred threads
there's *always* a CPU spare to "obstruct" somebody, so we hit live-
lock real quick.  Given 32-way and 64-way X86 boxes rapidly
approaching I'm hopeful Doug Lea will finally have to do something
about this.

Cliff

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to