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

9 Replies

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.

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

Why not use Apache 2 ? Then use modjk (modjk2 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.

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?

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 … g/ajp.html">http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/ajp.html

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 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.

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…

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.

So i should update this post a bit..

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

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct