users@grizzly.java.net

Re: Performance Settings

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Tue, 27 Nov 2007 11:20:59 -0500

Alan Williamson wrote:
> Okay, so what is the "accepted method" for tuning Grizzly.
>
> There appears to be a lot of setXXX methods on the SelectorThread with
> very little documentation on their cause'n'effect.
>
> For example, these two guys, they seem to associated with the number of
> worker threads that will be spawned at any one time.
>
> st.setMaxThreads( 30 );
> st.setMinSpareThreads( 10 );
>
> Is there any sort of benchmark as to what is "acceptable" values here. I
> notice anything above 50 and i am not getting any more throughput.

Righ. The usual performance benchmark I'm doing is 2000 http clients
serviced by only 5 threads. I would recommend you set maxThreads between
5 and 30, not more.


>
>
> This guy, is he to do with the HTTP KeepAlive or the Socket keepalive
> directive?
>
> st.setMaxKeepAliveRequests( 25 );

It's the number of requests a connection can handle. By default, when
HTTP/1.1 (or 1.0 with the keep-alive header) is added, grizzly will
close the connection after 250 requests (the last request will contains
the connection: close header). I would leave it to 250 to avoid DoS.

>
> The compression methods, are they to do with GZIP at the Http layer?

Yes.

> Calling that will that automatically GZIP my outgoing content if the
> client accepts?

Right. By default the following mime are supported:

"text/html", "text/xml", "text/plain"

You can add yours as well.

Or do i need to manually handle all that?

Nothing to configure by default. Grizzly will do it for you :-)

>
>
> other things:
>
> - Where i do i set the maximum number
> of connections I will accept

SelectorThread.setMaxQueueSizeInBytes() //Default is 4096


>
> - Cache sizes; what caches are these referring to
> setMaxSmallCacheSize() etc

This is the static file cache. I usually set that value to 1028 (smaller
file doesn't need to be cached). Do you want to use the static file
cache? This significantly improve performance for static resources.


>
> Any other tips you can suggest? Which methods should i be ignoring as
> internal, and which are expected to be twiddled by us the dumb user? :)

I think the current defaults are the best. Give me a couple of hours and
I will post a list of method you should look at (doesn't necessarily
need to change them, but at least you know they exists.

A+

-- Jeanfrancois



>
> thanks
>