Forum Moderators: phranque

Message Too Old, No Replies

Apache v Apache Tomcat?

         

bluedalmatian

10:33 pm on Apr 23, 2005 (gmt 0)

10+ Year Member



I'm a bit confused, is Tomcat an add-on to the normal Apache server or does it run completely separately?

sitz

11:01 pm on Apr 23, 2005 (gmt 0)

10+ Year Member



"yes." =)

Tomcat is a Java Servlet container; it can run 'in-process' or 'out of process'. If it's running 'in process', then you can think of it as an add-on (one of the more complex ones); if it's running out-of-process, Tomcat is its own server. One of the primary advantages of in-process is performance; there's less overhead since Apache passes control to Tomcat over JNI instead of using, for instance, some sort of TCP-based protocol. One of the primary advantages to running out-of-process is that it allows you to decouple your Java application(s) from your webserver; indeed, one could set up a farm of Apache webservers in front of a farm of Tomcat servers, and have the former load-balance across the latter; the two farms could even be in two different places, geographically (although that's generally not a good idea, since the farther the two farms are from one another, the slower the overall responsetime is likely to be).

bluedalmatian

8:51 pm on Apr 27, 2005 (gmt 0)

10+ Year Member



Thanks I see.

So if you were running it "out of process" in order to load balance your servlets, and were wanting to use jsp as a link between the browser/user you would run it in process with a normal server on port 80 to allow access to your jsps which would then talk to the other "out of process" servers on port 8080?

sitz

11:56 pm on Apr 27, 2005 (gmt 0)

10+ Year Member



Assuming I understand your question, the answer is 'no'. You'd run Tomcat out-of-process and use the ajp13 worker, which would forward the requests to the external process.

On the other hand, if running Tomcat in-process, you'd use the JNI worker, which knows how to forward requests to an in-process instance. You don't need to run an in-process instance to get to an out-of-process instance.

More info on Tomcat is available at [jakarta.apache.org ]; I pulled some of this information from [jakarta.apache.org ].

Does that answer your question, or did I misunderstand? =)

anshul

10:31 am on Apr 28, 2005 (gmt 0)

10+ Year Member



I've recently installed Tomcat-5 is using port 8080
I'm very new to Java; I wanna ask, if Tomcat is in itself a Web server, can it run PHP Web pages.

Next, can't we run .jsp plus .php on port 80 using Apache HTTP/Tomcat Servers. Suppose a Web site is using both PHP and Java technologies, then?

What's relation b/w Catalina -n- Tomcat?
Why Tomcat runs at command prompt? Can't it run as Windows service like Apache do ( I'm using Windows 2003 )? Why there is no SAPI module for .jsp as we've for .php

I'm very curious! Don't mind, please.

sitz

1:11 pm on Apr 28, 2005 (gmt 0)

10+ Year Member



Next, can't we run .jsp plus .php on port 80 using Apache HTTP/Tomcat Servers. Suppose a Web site is using both PHP and Java technologies, then?

If want to use both technologies, I'd recommend running Apache + PHP with the proper Tomcat worker, and then run Tomcat. As discussed above, you could run Tomcat either in-process or out-of process. Another possibility would be to run one 'light' Apache instance which serves up static content and then uses mod_proxy to send PHP requests to a second PHP-enabled Apache instance and jsp requests to to a *third* Apache instance that is Tomcat-enabled. Possibilities a go-go; the trick is to figure out what you have the money for (hardware-wise) and benchmark (heh. there's that word again.) to determine which configuration gives you maximum performance.

What's relation b/w Catalina -n- Tomcat?

Someone check me on this: Tomcat is the name of the application; Catalina is the name of the Servlet container within Tomcat.

Why Tomcat runs at command prompt? Can't it run as Windows service like Apache do ( I'm using Windows 2003 )?

Can't help you there; I get paid to NOT run windows machines. =)

Why there is no SAPI module for .jsp as we've for .php

I'm not sure I understand what you're asking here. If you're asking "why isn't there an Apache module for running .jsp files since there's a PHP module for running PHP files?", I couldn't give you a solid answer. I do know that while the PHP module can be over 1M in size when compiled, Tomcat is MUCH larger; Tomcat is a webserver / servlet container written *in* java. I'm sure you could write a module to do that if you wanted to (although I imagine the amount of memory Apache would need would be obscene, just for starters), but splitting it off into a seperate process gives you more flexibility. I'm not sure what (if any) gains would be achieved by having mod_java.so, or some such. I leave decisions like this up to the Tomcat developers, who know FAR more about applicatooin architecture than I do. =)