Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Sat Aug 27, 2005 5:07 pm 
Offline
Senior Member
User avatar

Joined: Tue Aug 17, 2004 11:37 pm
Posts: 262
Website: http://www.our-lan.com
WLM: nf@our-lan.com
Location: Brisbane, Australia
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


Top
   
 Post subject:
PostPosted: Mon Aug 29, 2005 10:14 pm 
Offline
Senior Member

Joined: Sat Dec 13, 2003 12:39 pm
Posts: 98
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.


Top
   
 Post subject:
PostPosted: Mon Aug 29, 2005 11:21 pm 
Offline
Senior Member
User avatar

Joined: Tue Aug 17, 2004 11:37 pm
Posts: 262
Website: http://www.our-lan.com
WLM: nf@our-lan.com
Location: Brisbane, Australia
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


Top
   
 Post subject:
PostPosted: Tue Aug 30, 2005 7:56 am 
Offline
Junior Member

Joined: Tue Mar 22, 2005 1:20 pm
Posts: 43
Website: http://darkcoding.net
Location: Vancouver, Canada
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.


Top
   
 Post subject:
PostPosted: Tue Aug 30, 2005 8:11 am 
Offline
Senior Member
User avatar

Joined: Tue Aug 17, 2004 11:37 pm
Posts: 262
Website: http://www.our-lan.com
WLM: nf@our-lan.com
Location: Brisbane, Australia
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?


Top
   
 Post subject:
PostPosted: Wed Aug 31, 2005 12:41 pm 
Offline
Senior Newbie

Joined: Tue Nov 04, 2003 12:32 am
Posts: 12
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

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.


Top
   
 Post subject:
PostPosted: Thu Sep 01, 2005 11:33 pm 
Offline
Senior Member

Joined: Sat Dec 13, 2003 12:39 pm
Posts: 98
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.


Top
   
 Post subject:
PostPosted: Thu Dec 22, 2005 4:15 pm 
Offline
Senior Newbie

Joined: Thu Dec 22, 2005 4:09 pm
Posts: 5
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...


Top
   
 Post subject:
PostPosted: Fri Dec 23, 2005 7:29 am 
Offline
Junior Member

Joined: Tue Mar 22, 2005 1:20 pm
Posts: 43
Website: http://darkcoding.net
Location: Vancouver, Canada
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.


Top
   
 Post subject:
PostPosted: Fri Dec 23, 2005 10:34 am 
Offline
Senior Member
User avatar

Joined: Tue Aug 17, 2004 11:37 pm
Posts: 262
Website: http://www.our-lan.com
WLM: nf@our-lan.com
Location: Brisbane, Australia
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


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group