users@glassfish.java.net

Re: Help required to configure the HTTP Service Keep-Alive

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Wed, 14 May 2008 14:05:55 -0400

Salut,

glassfish_at_javadesktop.org wrote:
> We had a major issue on a production system after an announcement caused flooding on our server (Glassfish v2ur1-b09d running on JDK1.6). The log files showed:
>
> Caught exception during HTTP processing. java.io.IOException: Too many open files at
> sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method) at
> sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:145) at
> com.sun.enterprise.web.connector.grizzly.SelectorThread.handleAccept(SelectorThread.java:1460)
>
> Another post (http://forums.java.net/jive/thread.jspa?messageID=260636&#260636)
> indicated a potential issue with keep-lives and time outs. Considering the max connections of our server was set to the default of 256 this was most likely the cause.
>
> What are the implications if we set the max connections to 5000?

That means that a single users can do 5000 requests....that's not good
IMO. Reduce that value will help reducing the exception above. The
browser will just reconnect in that case, which is better than running
out of file descriptor.

What impact would this have on memory usage?

No impact, as Grizzly only cache the file descriptor (SelectionKey)


  We are currently allocating 1.5GB on startup but could go higher if
needed. After garbage collection our current heap memory is approx
100MB with approx 700MB available.
>
> The thread count is currently set to 1.

The <request-processing thread-count="1"/> ?

That's not good. You at least needs 20 (based on the above description).


Do we need to increase this if we set the max connections to 5000?

No. You don't need one thread per connection. Play with the thread-count
value (try between 20 and 80).


>
> The timeout is currently set to 30 seconds. Should this also be changed to a lower value (eg 15 seconds?)

15 seconds will means that idle connection will be closed after 15
seconds. For sure that will help reducing the exception you noted.

Thanks

-- Jeanfrancois



>
> Any other suggestions appreciated!
>
> Many thanks in advance for your help.
> [Message sent by forum member 'ggierer' (ggierer)]
>
> http://forums.java.net/jive/thread.jspa?messageID=274179
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>