users@grizzly.java.net

Re: performance tuning grizzly http apps

From: Oleksiy Stashok <oleksiy.stashok_at_oracle.com>
Date: Wed, 20 Jul 2011 18:13:16 +0200

On 07/20/2011 05:49 PM, Jon Brisbin wrote:
> How do I tune Grizzly-based HTTP apps (that use HttpHandler et al)? I'm trying to do some performance testing and I don't even know what knobs I have to turn. In a "regular" Grizzly app I can set thread pool sizes and what not. How do I do that with the HTTP stuff?
If you have code like [1], you get Transport using:

TCPNIOTransport transport = networkListener.getTransport();

and then set thread pool config alone with selectorRunnersCount.


WBR,
Alexey.

[1]
         HttpServer httpServer = new HttpServer();

         NetworkListener networkListener = new
NetworkListener("sample-listener", "127.0.0.1", 18888);
         httpServer.addListener(networkListener);

         httpServer.getServerConfiguration().addHttpHandler(new
HttpHandler() {
             final SimpleDateFormat formatter = new
SimpleDateFormat("HH:mm:ss");

             @Override
             public void service(Request request, Response response)
throws Exception {
                 final Date now = new Date();
                 final String formattedTime;
                 synchronized (formatter) {
                     formattedTime = formatter.format(now);
                 }

                 response.setContentType("text/plain");
                 response.getWriter().write(formattedTime);
             }
         }, "/time");


> Thanks!
>
> Jon Brisbin
>
> http://jbrisbin.com
> Twitter: @j_brisbin
>
>