• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

preventing multiple instances of Tomcat spawning

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I'm on a RH linux box with tomcat 4 setup. And there's two URL paths to our tomcat server and each one spawns a different instance of Tomcat. How can I make both go to the same tomcat instance, as I don't want both instances hogging up resources like socket connections.

Thanks
 
Saloon Keeper
Posts: 28319
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Peter!

Tomcat isn't a very hungry program, but if there were 2 instances of Tomcat setup on that box, there was probably a good reason (at the time, anyway).

Multiple Tomcats don't automatically mean twice as many connections. TCP/IP architecture means that each Tomcat listens on a distinct port, and when a connection request is made to that port, the actual send/receive sockets are created to handle the request/response cycle. However, these connections are closed and freed once the web request has been processed. Unlike client/server systems, HTTP servers don't hold long-term connections.

Well, that's not entirely true, since there's a keep-alive mechanism that helps reduce the overhead of repeated request/response cycles, but it's not a long-term resource consumer and you can switch it off if it annoys you.

Long-term connections are held by things like database connection pools, but there's not usually enough of them to matter.

The upshot is that there's probably no reason why you HAVE to get rid of one of the Tomcats. However, if you do, there are 2 critical things to address:

1. You must deploy all the webapps you intend to keep onto the remaining Tomcat server

2. You have to ensure that the URLs that targeted to vanishing server are redirected to the remaining server.

The things that determine which Tomcat server gets given a URL are the URL's host address and port. When 2 Tomcats are on the same machine, the host address is usually going to be the same for both of them, but each Tomcat will have a different set of ports. If you're fronting the Tomcats with Apache, you can probably just change the Tomcat connector config in Apache. For more complex operations, mod_rewrite can help.
 
peter sze
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, sorry this is such a late reply, but this issue had been put on the back burner and just now got back to. I meant to clarify, that it was the Tomcat's internal server page had multiple instances with two different set of stats depending on which URL had opened up the page.

Thanks,
Peter
 
Sheriff
Posts: 28328
96
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So there's only one instance after all? And that means you don't have a problem? Glad to hear it. It's always nice to get feedback in cases like that.
 
peter sze
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, but unfortunately, there's two instances of the internal tomcat server that comes up depending on which URL opens it, giving different servers stats. I would like to keep this consistent, but not sure how to.
 
I didn't like the taste of tongue and it didn't like the taste of me. I will now try this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic