Skip to main content

A pitfall in upgrading to GF v3 with JK listeners

3 replies [Last post]
pboro
Offline
Joined: 2008-04-21

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=1 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.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Amy Roh

glassfish@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@borodulin.fi)]

Sorry for the trouble.

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.

V3's default domain.xml also defines "thread-pool-1" with
max-thread-pool-size=200 as it was in v2.

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...

>
> http://forums.java.net/jive/thread.jspa?messageID=391178
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

Amy Roh

Amy Roh wrote:
> glassfish@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@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
element in for GlassFish v2:

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.

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.
>
>
>
>
>
>
> 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...
>
>
>
>>
>> http://forums.java.net/jive/thread.jspa?messageID=391178
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
>> For additional commands, e-mail: users-help@glassfish.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

pboro
Offline
Joined: 2008-04-21

> 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?

At least in my test setup it seemed to fix the problem. I used ab for the tests and was unable to reproduce the problem after increasing max-thread-pool-size as describe above. I have not yet taken this to production, so a real in-production result is yet to be seen... :)