users@glassfish.java.net

Re: acceptor threads

From: Scott Oaks <Scott.Oaks_at_Sun.COM>
Date: Fri, 12 Feb 2010 11:49:03 -0500

glassfish_at_javadesktop.org wrote:
> Running Glassfish v2.1.1
>
> I just want to clarify something. From what I read the number of acceptor threads for a listener should be set to less than or equal to the number of CPU's of the server. This, I believe is somewhat different from previous versions of the appserver (SJSAS 8) where the number should be set higher... closer to the number of users. Is this correct?
>
> So if our server has 2 CPU's, 4 cores per CPU with HT, totaling 16 logical cores.. then should all of our listeners each have acceptor threads set to 2 (for the number of CPU's) or 16 (for logical cores)??
>
First, it's rare that acceptor thread tuning will make a significant
difference to your environment -- it's always good to get it right, and
you can eek out some slightly better throughput, but if it's a little
off, don't sweat it.

The acceptor threads manage the low-level select calls on the socket --
they are responsible for notifying the request-processing threads that
data is pending (that is, a client is making a request). That's a pretty
lightweight operation, especially compared to actually processing the
request. That's why you don't generally need too many.

In your case, I'd say 2-4 is what you need. The initial one-per-CPU
recommendation came before CMT and HT and multi-core machines; my rule
of thumb now is up to half the number of cores on larger machines. But
depending on your traffic pattern, the 1 default acceptor thread will
likely not show any big difference.

-Scott
> Thanks
> [Message sent by forum member 'black_lotus' (justin_at_insurfact.com)]
>
> http://forums.java.net/jive/thread.jspa?messageID=386410
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>