VarHandles & LMAX Disruptor

John Rose john.r.rose at
Tue Aug 18 17:32:36 UTC 2015

On Aug 18, 2015, at 6:51 AM, Doug Lea <dl at> wrote:
> It is a big problem only in that uncontrollable circumstances
> cause unlikely/infrequent but huge slowdowns on big NUMA servers.
> And it's a hard problem in part because on average, these effects
> don't happen.

OK, got that.  Normal optimistic tactics don't help when you are walking
near a precipice in the fog.

> On average padding is a bad idea.

On Aug 18, 2015, at 5:01 AM, Aleksey Shipilev <aleksey.shipilev at> wrote:
> For the example of arrays, whatever "enable threshold" is, it would
> waste anything within [0; 2*cacheLine-2] bytes per array, for *all*
> arrays over the threshold.

The "pad my arrays" idea can be formulated with a badness of epsilon,
by choosing a large-enough threshold.  But:

> You will never guess the threshold right for
> all the usages, and most usages would pay footprint premium for nothing.


OK, I'm catching up.  To apply the @Contended hack to a range-checked
structure, I guess we want a @Contended 'length' field, that is stored
deep past the header of the object.

This is not pure future.  Paul Sandoz showed at JVMLS a way
to use a var handle to embed a small array inside an object layout.

— John

More information about the valhalla-dev mailing list