tomcat 5.5 apache 1.3 talking properly on debian
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
9 Replies
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.
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
There are pretty good docs here:
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.
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?
This tag includes the interesting parameters at their default values:
You might try dropping maxSpareThreads significantly, although if you get hit hard page loading could be slow.
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://jetty.mortbay.org/jetty/
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.
im now using apache2.. i have everything working now, apart from umm.. something.. shit 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