tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Remy Maucherat" <r...@apache.org>
Subject Re: Performance Test Workload: HelloWorld Servlet
Date Thu, 27 Jun 2002 15:26:57 GMT
>  I'm getting unusual preliminary results on some
> performance tests against a very simple servlet, and
> I'd like to see what results other people get. If
> you're going to run the tests yourself, don't look at
> my results ahead of time if you can resist (they're at
> the bottom of the message)
>
>  I'm http_load'ing against 4.0.3 and 4.1 HEAD using
> 8 threads and 0,1,8,16 and 32k response sizes. I ran
> http_load on one machine and Tomcat on another. I ran
> a couple rounds before the final test at each response
> size to let the jit warm things up.
>
>  The server.xml I used just declares a single HTTP
> connector and a simple Engine/Host/Context. No logging,
> valves, etc.
>
>  The results are preliminary because I haven't done the
> appropriate system tuning and didn't bother with the
> proper controls on what was running on my test box, I
> have a sneaking suspicion I'm a few days out of date
> on HEAD.etc, etc. Note also that hitting a single URL
> over and over is a totally bogus way to test
> "performance", but relative results between different
> versions of the same software can be interesting.
>
>
> ---------------------------------------------------------
>
> public class HelloServlet extends HttpServlet {
>
>   private static byte[] buf;
>   private static int sz = 32*1024;
>
>   public void init() throws ServletException {
>     buf = new byte[sz];
>     for(int i=0; i<sz; i++)
>       buf[i] = 88; // ASCII 'X'
>   }
>
>   public void doGet(HttpServletRequest req, HttpServletResponse rsp)
>     throws IOException, ServletException
>   {
>     OutputStream ostr = rsp.getOutputStream();
>     ostr.write(buf);
>   }
> }
>
> -----------------------------------------------------

Great, but it is so easy to screw up the 4.0.x HTTP connector performance.
Your case provides one of the only cases where the old HTTP connector
actually works decent (the other being when you set content-length).

For example, did you try to:
- Write data byte by byte ? (or at least, small chunk by small chunk)
- Use a writer ? (90% of people will do that)

Of course, the worst being when you use a writer and write char by char.

Coyote HTTP/1.1 also has the advantage of behaving well under JDK 1.4 (an
additional +10-25% in perf because c2b is faster), while the old connector
does not. Fixing that is likely a bit complex, also.

Last, the old connector will perform much worse with "real" requests, which
include stuff like the accept-language header. Coyote will parse the locales
lazily, so you won't have any performance impact for your hello servlet,
while the old connector will happily use a string tokenizer on every request
(ouch).

The <> between MinTC and TC 4.1 is likely to be the mapping and related
operations; things that I plan to optimize eventually.

Remy


--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message