-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Fred,

(Marking OT because this strays from the OP's topic)

On 8/23/12 4:21 PM, Fred Janon wrote:
> I am interested in more details from your comment:
> 
> "This is a common misconception: Apache httpd is *not* faster than 
> Tomcat for static content *when configured appropriately*. The
> current default configuration is unfortunately much less optimized
> than Apache httpd's default configuration, so httpd beats Tomcat
> out-of-the-box."
> 
> Do you mean the Default Servlet configuration ( 
> http://tomcat.apache.org/tomcat-7.0-doc/default-servlet.html )or
> any servlet?

The DefaultServlet is perfectly capable of delivering content quickly
(it's just copying bytes from the disk, which isn't that difficult).
IF you have another servlet that delivers static content, then you'll
have to look at it to see if it is wasting any time :)

> Where can I learn more about optimizing serving static content with
> Tomcat? I want to stick with Tomcat alone.

Your best bet when using Tomcat standalone is to use either the NIO or
APR connectors with "sendFile" support enabled: this is the key. See
my presentation from ApacheCon NA 2012 on the subject
(http://people.apache.org/~schultz/ApacheCon%20NA%202010/ApacheCon%20NA%202010%20Slides.pdf)
- -- although Mladen pointed out at that presentation that my data was
irrelevant due to the use of Linux's loopback interface for all my
testing. He's got a point, but the data still suggests that
performance of NIO+sendFile/APR+sendFile is always on par with Apache
httpd and the performance of the BIO connector and either NIO or APR
without sendFile is always relatively bad.

When you think about it, Tomcat ought to have almost identical
performance with using APR+sendFile connector because it is the *same
code that Apache httpd uses* under the hood (that's what APR is:
native code shared with Apache httpd, including the "sendFile"
support). The fact that the NIO connector is so competitive with APR I
think speaks to the optimization that has occurred within the NIO
stack, allowing the data to get to the hardware with very little overhead.

One more thing: if you are using TLS, you definitely want to go with
the APR connector to use OpenSSL-based encryption: it's much faster
than the JSSE-based encryption that you'll get when using the NIO
connector.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlA3nDIACgkQ9CaO5/Lv0PAMggCfSZB4qqzksbInBobRddN6ZFgH
iaYAoK8svXqiCxZJxALb9I7eUkIZkcuC
=tsTE
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to