aspose file tools*
The moose likes Tomcat and the fly likes JSP, Apache, tomcat problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "JSP, Apache, tomcat problem" Watch "JSP, Apache, tomcat problem" New topic
Author

JSP, Apache, tomcat problem

varun bihani
Ranch Hand

Joined: Aug 11, 2003
Posts: 96
I dont know where to put this post.. but I am in real bad shape..
I have a website www.hala.com ..
I have configured it to run with mod_jk connector to run apache and tomcat on same port...
The problem is, my Linux server gets struck after running few days and all the jsp sites render very slowly.. I checked on server and run command "top" to find CPU usage, it showed CPU 98% in use and all this is used up by a process "Java" must be tomcat..

Then I used to kill that process and restart tomcat again. and it works fine for few days again come across the same problem..

Again I have to repeat the process (kill java process and start tomcat).

Can anybody help??


<a href="http://www.galaxyweblinks.com" target="_blank" rel="nofollow">www.galaxyweblinks.com</a><br /><a href="http://www.freechatcode.com" target="_blank" rel="nofollow">www.freechatcode.com</a><br /><a href="http://www.onlinefamilytreemaker.com" target="_blank" rel="nofollow">www.onlinefamilytreemaker.com</a>
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

It sounds like you have a memory leak in your application.
Have you tried running the app with Tomcat as a standalone to rule out any issues with the connector?

It could also be that your app requires more than the 64 megs that the JVM will use by default. Have you tried increasing the initial and max heap sizes that Tomcat uses?

This sounds like more of a Tomcat issue than a JSP one.
I'll see if I can get this thread moved to the Apache Tomcat Forum.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
varun bihani
Ranch Hand

Joined: Aug 11, 2003
Posts: 96
No I havent tried increasing the heap size. How do you do that?/ have any references??
Should I try running tomcat and apache seperately??
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

I'm moving this to the Tomcat forum as Ben suggested.
Please continue the conversation there.

Thanks!
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by varun bihani:
No I havent tried increasing the heap size. How do you do that?/ have any references??
Should I try running tomcat and apache seperately??



You can increase the heap size by adding switches to the JAVA_OPTS environment variable at the top of catalina.sh (on Unix).

Here is an exerpt from mine:


Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

If your app requires close to 64 megs of heap space, it is understandable that your CPU is maxing out after a period of time since the app will have to run Garbage Collection (GC) almost continuously.

Try increasing it and watch the app for a period of time.
If it goes a couple weeks without an issue, it probably just needed more RAM.
If, on the other hand, you've got a memory leak, increasing the heap size will only postpone the inevitable.

You can monitor the heap size from the manager app that ships with Tomcat
http://localhost:8080/manager/html
Click on the "Server Status" link and look for the "JVM" section.

If the problem still persists, try running Tomcat as a standalone.
Personally, I don't even bother with the connectors and external webservers.
varun bihani
Ranch Hand

Joined: Aug 11, 2003
Posts: 96
Thanks for the wonderful reply..
Well tomcat does not run on port 8080 on the server.. where can I check the tomcat manager on the server where tomcat and apache run on similar port??

Moreover, I tried lookin Server Status on my local machine but could not find the link of that.. Do I need to change any settings for doing that so that I can see the status?..
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Just use whatever port Tomcat is running under.

http://localhost/manager/html

You may need to set up a password.
You do this from tomcat/conf/tomcat-users.xml
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP, Apache, tomcat problem