• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Tomcat service on different ports

 
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic