[concurrency-interest] Re : concurrent counter : incrementAndGet

Jed Wesley-Smith jwesleysmith at atlassian.com
Mon Aug 15 23:04:37 EDT 2011


have a look at Cliff Click's ConcurrentAutoTable (github fork link for easy
viewing):

https://github.com/boundary/high-scale-lib/blob/master/src/main/java/org/cliffc/high_scale_lib/ConcurrentAutoTable.java

original source in sourceforge:

Highly Scalable Java | Download Highly Scalable Java software for
...<http://sourceforge.net/projects/high-scale-lib/>

On Sun, Aug 14, 2011 at 9:03 PM, Jeff Hain <jeffhain at rocketmail.com> wrote:

>
>    That could work well for some cases indeed, but I'm working on a sort
> of Disruptor, using the counter with modulo to pick up slots to write to in
> a cyclic array, monotonically, or non-monotonically but for a short time
> (for readers not to be blocked on a not-yet-written slot), and any writer
> can stop to work anytime; in this case I don't see how that could apply
> easily.
>
> -Jeff
>
> ------------------------------
> *De :* Aleksey Shipilev <aleksey.shipilev at gmail.com>
> *À :* Jeff Hain <jeffhain at rocketmail.com>
> *Cc :* concurrency-interest at cs.oswego.edu
> *Envoyé le :* Dim 14 août 2011, 1h 13min 57s
> *Objet :* Re: [concurrency-interest] concurrent counter : incrementAndGet
>
> You might want to get the idea from JPA-s sequencers like this: get
> each caller thread its own local range of numbers it can count, once
> thread depletes the region, atomically allocate another region. You
> can then greatly reduce contention by controlling region range. This
> is still provide unique values in every thread, with some
> non-monotonic perturbations.
>
> -Aleksey.
>
> On Sun, Aug 14, 2011 at 2:57 AM, Jeff Hain <jeffhain at rocketmail.com>
> wrote:
> > Hello.
> >
> >    To continue on the subject of concurrent counters, does anyone
> > know one that could be used instead of AtomicLong.incrementAndGet()
> > (possibly providing non-monotonic results, or monotonic but with gaps),
> > and would scale better?
> >
> >    I tried to do something in that direction, but it's sometimes actually
> > worse
> > (which still surprises me: I'm not totally aware of what I carefully made
> > yet ;).
> >
> > Regards,
> >
> > Jeff
> >
> >
> > _______________________________________________
> > Concurrency-interest mailing list
> > Concurrency-interest at cs.oswego.edu
> > http://cs.oswego.edu/mailman/listinfo/concurrency-interest
> >
> >
>
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20110816/e58499eb/attachment.html>


More information about the Concurrency-interest mailing list