Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tomcat service on different ports

 
Thomas Greene
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have Tomcat servers running on 2 different machines. There is a hardware load balancer which decides request should go to which tomcat server. Lets call these tomcat server AppSrv1 and AppSrv2.

At times we need to do some content uploading stuff (using a web app) on one of these production servers (both use the same database). But while we are doing this content uploading stuff the load on these servers increase a lot (since onine users are alos using it) and we start getting OutOfmemory errors.

Tomcat on both these machines is running as a service.

TO solve this problem what we have been suggested now is that in AppSrv2, we should run the same tomcat server on another port (say 8086) as well. Is it possible to run the same tomcat service on 2 ports?
The idea is that when the content team tries to load the content they'll bypass the loadbalancer and directly send a request to port 8086. So the 2 default ports (8080 on both machines will be free to take care of client requests).

What I want to know is that, even when we have tomcat services running on 2 ports (in same machine), since they'll be using the same JVM will the above help. I feel only one heap is created for both the instances of tomcat on AppSrv2 but I told that since it'll be a seperate process two heaps will be created. The content team will use one port which will have one heap, while the online users will use another (8080) port which will use a seperate heap. Please give your comments on the above.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, they will not use the same heap.
You will have two, completely different instances of Java running.

There are two port settings that must be changed.
The first is the connector port which defaults to port 8080.
The second is the shutdown port which defaults to 8005.

These can be changed in tomcat/conf/server.xml
 
Thomas Greene
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I do this, and suppose there is OutOfMemoryException in one app (say the content app) which is running on port 8086, but the one on 8080 is working fine. Now to make the app on 8086 I'll need to restart the tomcat server, will that mean that tomcat on 8080 will also be restarted (since there is only one instance). Is there a way to restart just the instance running on one port?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Thomas Greene:
(since there is only one instance)


There is not only one instance.
There would be two instances.

As I said earlier, you will have two completely separate Java programs running on your machine. You can stop, start, restart either one without affecting the other.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic