Linode.com Forum Forum Index Linode.com Forum
Linode Community Forums
 


tomcat 5.5 apache 1.3 talking properly on debian

Click here to go to the original topic

 
       Linode.com Forum Forum Index -> Linux, Apache, Mysql and PHP (LAMP) Forum
Author Message
Internat



Joined: 17 Aug 2004
Posts: 173
Location: Brisbane, Australia

Posted: Sat Aug 27, 2005 4:07 pm    Post subject: tomcat 5.5 apache 1.3 talking properly on debian  

So has anyhone successfully managed to get all 3 of the above working together nicely?

i have apache working
i have java working
i have the standard tomcat 5.5 working on port 8080

but any attempts for me to get apache and tomcat communicating so that only dynamic requests goto tomcat, fails misserably

anyone happen to have a decent tutorial or something like that?

something that deals with virtual hosting as well would be nice

ive tried making sense of jakarta.apache.org's setup instructions but they just dont seem to make sense to me :s

cheers
Nathan
Back to top  
kiomava



Joined: 13 Dec 2003
Posts: 87

Posted: Mon Aug 29, 2005 9:14 pm    Post subject:  

I can verify that configuration works, but I'm afraid I don't have a tutorial. Google would probably yield many.

There is nothing really special about running apache/tomcat on linode, except that the memory is generally a little more tight than elsewhere, so you may need to tune java -Xmx, -Xms etc options after you get it working. The exact numbers you choose will depend immensely on the particular web apps you're running with tomcat, the size of your linode, and what other stuff you are running.

Other tips:

You'll need mod_jk2 (libapache2-mod-jk2 in debian). You'll need to set up apache to route certain requests to tomcat via jk2. The apache/tomcat docs explain how to do this. Typically it is done for for each context and/or virtual host. You need to map each context to a specific tomcat instance. For example you could map a context like "/JavaMailApp" to a locally running tomcat instance on a certain port. Changing the file /etc/apache2/conf/workers2.properties is one way to achieve this and the default install includes some samples there.

Experiment with different java versions, vendors, and linux kernel versions. Months ago I found that all Sun JVM versions worked on the 2.4.x kernels, but 1.5 didn't work on the 2.6 kernel. I think it works now, but you might try experimenting. The IBM JVM used a little less memory for my stuff, which may also help with a linode.

What kinds of problems are you having, exactly? There is really nothing special about configuration for linode, there are really only performance tuning differences.
Back to top  
Internat



Joined: 17 Aug 2004
Posts: 173
Location: Brisbane, Australia

Posted: Mon Aug 29, 2005 10:21 pm    Post subject:  

umm doesnt that module only work with apache 2? libapache2-modjk2

the main problem im having atm is that tomcat is taking up like 60% of my memory which is a big thing as u can imagine..

i couldnt really find many decent tutorials for specificily tomcat 5.5 on debian.. or specificly tomcat 5.5 ajp13 (the old connector cause the new one seemed borked) and apache 1.3. Didnt really want to change over to apache 2..

im not really running any webapps as such.. just some friends want to be able to use jsp and jstl for some custom type stuff..


cheers
NF
Back to top  
graham



Joined: 22 Mar 2005
Posts: 38
Location: London, England

Posted: Tue Aug 30, 2005 6:56 am    Post subject:  

Why not use Apache 2 ? Then use mod_jk (mod_jk2 has been deprecated and retrofitted into mod_jk).

There are pretty good docs here:

http://jakarta.apache.org/tomcat/connectors-doc/

We run Apache 2 with mod_jk as a front-end to a cluster of Tomcat 5.5's at work and it works great.
I don't run it on my Linode because Tomcat takes up a lot of memory.

Graham.
Back to top  
Internat



Joined: 17 Aug 2004
Posts: 173
Location: Brisbane, Australia

Posted: Tue Aug 30, 2005 7:11 am    Post subject:  

ok i managed to get it connected with apache 1.3 and modjk and a few other things.. hwoever its still kicking the ass out of my linode.. like java is using 50% of the memory usage..

thats i guess my main concern.. do people have good ideas for limiting it?

i dont mind loosing memory, im expecting it, but 50% to 1 program is a bit harsh.. ikf i dont say so myself..

also limiting the ammount of threads it spawns would be nice...

i have disabled it listening on port 8080 so all that it should be listening for is the standard ajp connections

but there is still a crap load of threads and memory usage..

suggestions?
Back to top  
mike



Joined: 03 Nov 2003
Posts: 12

Posted: Wed Aug 31, 2005 11:41 am    Post subject:  

It's my understanding that you can reduce your thread counts by tweaking the server.xml file. The default definition for the AJP connector doesn't have the MaxThread etc defined but you can set them. Reference http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/ajp.html

This tag includes the interesting parameters at their default values:
Code:
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector
   port="8009"
   enableLookups="false"
   redirectPort="8443"
   protocol="AJP/1.3"
   maxThreads="200"
   maxSpareThreads="50"
   minSpareThreads="4"
/>

You might try dropping maxSpareThreads significantly, although if you get hit hard page loading could be slow.
Back to top  
kiomava



Joined: 13 Dec 2003
Posts: 87

Posted: Thu Sep 01, 2005 10:33 pm    Post subject:  

You can also try different JVMs. Which one are you using? The Sun one? The IBM JDK might use somewhat less memory.

You know, if you just want to host some JSPs for some friends and it's not high-volume, you might consider something much lighter like Acme Serve. I've tried the one at "http://tjws.sourceforge.net/', it performs very well on a Linode 64 for low hit rates, but on a larger host performs worse than tomcat.
Back to top  
delmoi



Joined: 22 Dec 2005
Posts: 5

Posted: Thu Dec 22, 2005 3:15 pm    Post subject:  

I've done it once (on windows, weirdly enough) But it was a huge pain in the ass, and I don't remember what I did. I think it was back with tomcat three, and they change the interface every release anyway...
Back to top  
graham



Joined: 22 Mar 2005
Posts: 38
Location: London, England

Posted: Fri Dec 23, 2005 6:29 am    Post subject:  

There is also jetty http://jetty.mortbay.org/jetty/ which is smaller than Tomcat.

But really, the smaller Linodes are not appropriate for running a Java web site. You'd want to give it at least 64Mb, which even on a Linode 120 doesn't leave much for Apache, your mail server, spam killer, database, etc.

Even though my day job is Java on Tomcat, my first choice for a small dynamic site on a Linode would be PHP. Right now I'm working on something a bit bigger in Python using Django.
Back to top  
Internat



Joined: 17 Aug 2004
Posts: 173
Location: Brisbane, Australia

Posted: Fri Dec 23, 2005 9:34 am    Post subject:  

So i should update this post a bit..
im now using apache2.. i have everything working now, apart from umm.. something.. s*** its one of those days.. oh the database stuff inside of web.xml.. we were trying to make it so that the user could have there own web.xml file that does everything..

for the people that suggested other languages like php etc.. the site already runs php, however one of the people that i provide hosting for has a site they have developed in java, and we figured at the time that it isnt really that much of a deal to host tomcat.. apart from the 50% memory usage overhead that i shall have to deal with at some point..

cheers
NF
Back to top  
 
       Linode.com Forum Forum Index -> Linux, Apache, Mysql and PHP (LAMP) Forum
Page 1 of 1