users@glassfish.java.net

Re: A pitfall in upgrading to GF v3 with JK listeners

From: Amy Roh <Amelia.Roh_at_Sun.COM>
Date: Thu, 18 Mar 2010 11:08:12 -0700

Amy Roh wrote:
> glassfish_at_javadesktop.org wrote:
>> I had difficulties getting JK listeners working with GFv3 (build 74.2)
>> on RHEL 5.4 64-bit and Sun JDK build 1.6.0_18-b07. I had created a new
>> listener using the following values:
>>
>> JK Listener: [x] Enabled
>> Port: 8009
>> Address: 127.0.0.1
>>
>> I had left all other options as defaults. After restarting Glassfish I
>> could see it was correctly listening on 127.0.0.1:8009. I then
>> configured Apache's mod_proxy_ajp like this:
>>
>> ProxyPass / ajp://127.0.0.1:8009/ min=0 smax=0 max=50 retry=10
>> timeout=120 ttl=60 acquire=5000
>>
>> The above was a configuration which I was successfully using with
>> Glassfish v2.1. With v3 the AJP connectivity started failing after a
>> few requests through Apache. The problem looked like v3 was not
>> releasing the AJP connections correctly or something alike so that
>> mod_proxy_ajp / mod_jk could reuse the connections. But this was
>> simply a symptom.
>>
>> The default size for the http thread pool in v2.1 was 200 and as far
>> as I know, this pool was also used for JK listeners. In v3 when you
>> create a new JK listener, the thread pool is set to http-thread-pool
>> by default. The default size of this pool, if I recall correctly, is
>> 5! When using Apache in prefork mode, the size of the thread pool
>> should be at least the value of MaxClients when using mod_proxy_ajp or
>> mod_jk.
>>
>> There was no mention about this change in the release notes, so at
>> least I missed it completely. I hope this posting will help others to
>> avoid this pitfall.
>> [Message sent by forum member 'pboro' (pauli_at_borodulin.fi)]
>
> The default max-thread-pool-size was reduced to 5 since it was decided
> to be enough due to the NIO nature of the grizzly.

Actually I stand corrected.

The thread pool that has default max-thread-pool-size to 200 is only
used by the IIOP path. The threads on the HTTP path are governed by the
<request-processing> element in <http-service> for GlassFish v2:

         <request-processing header-buffer-length-in-bytes="8192"
initial-thread-count="2" request-timeout-in-seconds="30"
thread-count="5" thread-increment="1"/>

The request-processing#thread-count maps to
thread-pool#max-thread-pool-size as mentioned in the Grizzly One Pager
[1]. This number has always been 5 by default in v2 and v3 so no change
here.

<request-processing> mapping

GFv2 GFv3
thread-count thread-pool#max-thread-pool-size
initial-thread-count thread-pool#min-thread-pool-size
thread-increment thread-pool#thread-increment

Were you able to resolve your issue by increasing the
max-thread-pool-size to be at least the value of Apache's Hard Maximum
number of connections?

Thanks,
Amy

[1] http://wiki.glassfish.java.net/Wiki.jsp?page=GrizzlyConfigOnePager

> V3's default domain.xml also defines "thread-pool-1" with
> max-thread-pool-size=200 as it was in v2.
>
> <thread-pools>
> <thread-pool name="http-thread-pool" />
> <thread-pool name="thread-pool-1" max-thread-pool-size="200" />
> </thread-pools>
>
> You can create a jk-connector with "thread-pool-1" rather than using the
> default http-thread-pool if you need to increase the max-thread-pool size.
>
> create-network-listener .... --listenerport 8009 --threadpool
> thread-pool-1 --jkenabled=true jk-connector
>
> Sun GlassFish Enterprise Server v3 Reference Manual [1] mentions that
> the default thread pool is http-thread-pool.
>
> Amy
>
> [1]
> http://docs.sun.com/app/docs/doc/820-7701/create-network-listener-1?l=En&a=view
>
>
>
>>
>> http://forums.java.net/jive/thread.jspa?messageID=391178
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>