views:

585

answers:

3

Tomcat has an option to use APR for handling connections. What are the benefits of using that? Does anyone have firsthand experience with it?

+2  A: 

Does this answer yor question re. benefits?

Tomcat can use the Apache Portable Runtime to provide superior scalability, performance, and better integration with native server technologies. The Apache Portable Runtime is a highly portable library that is at the heart of Apache HTTP Server 2.x. APR has many uses, including access to advanced IO functionality (such as sendfile, epoll and OpenSSL), OS level functionality (random number generation, system status, etc), and native process handling (shared memory, NT pipes and Unix sockets).

These features allows making Tomcat a general purpose webserver, will enable much better integration with other native web technologies, and overall make Java much more viable as a full fledged webserver platform rather than simply a backend focused technology.

(my emphasis)

Brian Agnew
That's what docs/advertisements says, but I couldn't find any first hand usage reports that validate claimed benefits.
Dev er dev
+1  A: 

If you don't plan to use a web server (for serving static content) in front of Tomcat then APR is supposed to improve things.

I've only indirectly used it via JBoss Web but I always prefer to have an Apache httpd fronting Tomcat, so I think APR then is irrelevant.

cherouvim
+1  A: 

I use APR with mod_perl2 and I have noticed a performance improvement. This performance improvement comes from using APR to directly access more than just system status and whatnot because APR is a highly optimized library that deals with cookies, headers, data types, etc., directly from the web server. It also provides direct access to all aspects of the connection that aren't typically otherwise available.

I haven't used it with Java yet, but am trying to figure out how to get TomCat 6 to allow me to use it from JSP code. I expect to see increased efficiency by using APR directly from my Java code, just as I did with Perl.

Randolf Richardson