[concurrency-interest] LBQ vs CLBQ

Hanson Char hanson.char at gmail.com
Wed Apr 4 14:25:17 EDT 2007


Hi,

I've further enhanced ConcurrentLinkedBlokcingQueue such that it implements
the BlockingQueue interface.  In other words, CLBQ can now be used as a
drop-in replacement for LBQ.  See:


http://svn.sourceforge.net/viewvc/beanlib/trunk/beanlib/src/net/sf/beanlib/util/concurrent/ConcurrentLinkedBlockingQueue.java?view=markup

Other interesting things:

1) I realised the jdk implementation of

    ExecutorService newFixedThreadPool(int nThreads);

internally uses a LBQ for the thread pool.

To be fair (or pure?), I've updated the test suite such that the thread pool
for testing CLBQ is also a CLBQ, whereas the thread pool for testing LBQ is
a LBQ.

2) From http://dior.ics.muni.cz/~makub//java/speed.html, it seems the
-XXCompileThreshold should be set to 1500 for optimal server performance.
Like so:

    java -DnumConsumer=3 -DnumProducer=10 -DwcRatio=5 -server
-XX:CompileThreshold=1500 -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode
-XX:+DisableExplicitGC -jar q-test.jar

Downloads:

    http://beanlib.sourceforge.net/clbq/070404/q-test.jar
    http://beanlib.sourceforge.net/clbq/070404/q-test-sources.jar

Cheers,
Hanson Char

On 4/4/07, Hanson Char <hanson.char at gmail.com> wrote:
>
> Hi,
>
> I've enhanced the test suite such that:
>
>    - the number of concurrent producers can be specified via the system
>    property "numProducer", which defaults to 10
>    - multiple concurrent consumers is now supported via the system
>    property "numConsumer", which defaults to 1
>    - the W/C ratio (ie wait-time to compute-time) can be specified via
>    the system property "wcRatio", which defaults to 0
>
> For example, to run the test with 10 producers, 3 consumers, and a W/C
> ratio of 5:
>
> java -DnumConsumer=3 -DnumProducer=10 -DwcRatio=5 -server
> -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:+DisableExplicitGC -jar
> q-test.jar
>
> Note an interesting observation is that Windows XP Professional is really
> slow on LBQ even when there is only 1 producer and 1 consumer.
>
> Downloads:
>
>     http://beanlib.sourceforge.net/clbq/070403/q-test.jar
>      http://beanlib.sourceforge.net/clbq/070403/q-test-sources.jar
>
> Hanson Char
>
> On 4/3/07, Trustin Lee <trustin at gmail.com> wrote:
> > On 4/4/07, Hanson Char < hanson.char at gmail.com> wrote:
> > > Hi Trustin,
> > >
> > > Actually I think you are right.  According to Jcip, the optimal thread
> > > pool size should be
> > >
> > >     NumberOfCpu * TargetCpuUtilization * (1 + W/C)
> > >
> > > where W/C is the ratio of wait time to compute time.  Currently W/C is
> > > set to zero and TargetCpuUtilization is set to 1 in the q-test.jar.
> > > However, since the compute time is near zero, the number of threads
> > > for the optimal pool size should be much larger.
> > >
> > > I'll add a configurable system property such that the W/C can be
> > > specified for running the test, and see how it goes.
> > >
> > > Thanks for pointing this out.
> > >
> > > Hanson Char
> > >
> > > ps: Hope you don't mind I cc this to the concurrency forum.
> >
> > Of course not.  Please cc me.
> >
> > Trustin
> > --
> > what we call human nature is actually human habit
> > --
> > http://gleamynode.net/
> > --
> > PGP Key ID: 0x0255ECA6
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/attachments/20070404/82e510b5/attachment.html 


More information about the Concurrency-interest mailing list