logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: mod_proxy_ajp + tomcat
Author
limittester



Joined: 23 Oct 2007
Posts: 2

PostPosted: Tue 23 Oct '07 10:26    Post subject: mod_proxy_ajp + tomcat Reply with quote

Hello everyone!

I have already configured apache + tomcat ( using mod_jk ). The tomcat is deployed at / context and apache forwards all request ( except for static files which i have disable using JkUnMount ) to tomcat.

Specifically, I have the following lines in apache to let apache know to serve static files
JkUnMount /*.gif worker1

Now, after some bit of reading, I see that mod_proxy_ajp is another option over mod_jk. I have couple of questions on whether I need to migrate

1) Is mod_proxy_ajp faster that mod_jk ( any other assumptions / issues ) ?

2) Is it possible to achieve the above configuration ( that is, tomcat serving all request at www.mysite.com and apache serving only static files ) using mod_proxy_ajp ?

3) Not sure if this applies to this forum, but neways I am asking it: I also happen to see that tomcat supports NIO HTTP connectors. But since apache is the frontend server and all request goes to AJP connector ( port 8009), can I ever use NIO connectors in this mode ?

Thanks!
Back to top
tdonovan
Moderator


Joined: 17 Dec 2005
Posts: 611
Location: Milford, MA, USA

PostPosted: Tue 23 Oct '07 17:14    Post subject: Reply with quote

re: "1) Is mod_proxy_ajp faster"
Seems about the same to me. If there are performance differences they are very small.

re: "2) Is it possible ... apache serving only static files"
Yes. You will need to use ProxyPassMatch directives with the ! option to exclude your static files.
Be sure to put these before your regular ProxyPass directives in httpd.conf.

re: "3) can I ever use NIO connectors"
Since there is no NIO AJP connector, you could proxy from Apache to http://localhost:8080 instead of ajp://localhost to use the Tomcat NIO HTTP connector.
I'm not sure if this will really be better because the ajp: protocol is inherently more efficient than the http: protocol.

-tom-
Back to top
limittester



Joined: 23 Oct 2007
Posts: 2

PostPosted: Tue 23 Oct '07 20:51    Post subject: Reply with quote

thanks tom for reply!

So if ajp is better than NIO , what are the scenarios when anyone would use NIO connectors ( I see there must be some reason for apache to have built this in the new release ).

Does running tomcat standalone using NIO ( either port 80 / 8080 ) make this better ( i.e w/o apache ) ?
Back to top
tdonovan
Moderator


Joined: 17 Dec 2005
Posts: 611
Location: Milford, MA, USA

PostPosted: Tue 23 Oct '07 22:31    Post subject: Reply with quote

re: "ajp is better than NIO"
No, ajp is better than http. http+NIO is better than just http. I don't know if ajp is better than http+NIO.

re:"Does running tomcat standalone...make this better?"
The answer depends on too many things:
    * Tomcat will be serving all the static content. NIO will help Tomcat to do this - but it still won't do it as well as Apache would.

    * If you are limited by the speed of your physical network connection, a NIO connector won't make it go any faster than it goes with a regular connector.

    * NIO is better if you have many (i.e. hundreds, thousands) of simultaneous connections, but still not better than Apache for the static content.

    * NIO will make less difference if your Tomcat application(s) do a lot of work (database access, math calculations, etc.) to produce their responses.
In short - there is no "it is always better" answer about http+NIO vs. ajp. You really need to measure it with your own J2EE application(s) and users.

This test is worth doing if you have a very busy server. The choice could make a real difference if your application and user load just happens to take advantage of NIO.

re: "there must be some reason for apache to have built this"
It is always a big improvement for Tomcat sites that don't have/use Apache.
They will probably make an ajp+NIO connector eventually, but it is not as crucial a feature as the http+NIO connector.

-tom-
Back to top


Reply to topic   Topic: mod_proxy_ajp + tomcat View previous topic :: View next topic
Post new topic   Forum Index -> Apache