• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

How Multiple Tomcat works?

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know how to configure multiple tomcat but what I really want to know is that..
1) How Multiple instances of tomcat work(co ordinate..etc etc)?
2) How does load balancer work in Multiple Tomcats?
3) How Solr works on Tomcat?
4) How will multiple solr on multiple tomcat will work?
Any question's answer will be helpful..
Thanks in Advance..
Posts: 43016
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

Load balancing is generally done by fronting the Tomcats with an Aapche httpd via the mod_jk or mod_proxy modules. See #19 of the Tomcat documentation.

For clustering, see #18 in the documentation.

We like to keep threads to single topics, so please create a new thread for your Solr questions (which is a standalone server, and so has nothing much to do with Tomcat).
Saloon Keeper
Posts: 22289
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can run multiple instances of Tomcat using a single set of core directories to hold the invariant parts of Tomcat (such as the bin directory) and a discrete set of directories to hold the per-instance parts of Tomcat (such as webapps, conf, temp, work and logs). These instances are then run using the enviroment variable CATALINA_HOME to point to the shared invariant parts and CATALINA_BASE to point to the per-instance parts.

Within each instance, one of the most important things to do is that you have to modify the server.xml file so that each instance has its own unique set of ports assigned. This is because only one application (Tomcat instance) can own a given port. So Tomcat #1 might take HTTP requests on port 8080, Tomcat #2 might take them on 8081, and so forth. You would do the same for the SSL port (8440, 8444, etc.), the proxy tunnel port, and so forth.

A load balancer works by serving as a central (proxy) point for receiving URL requests (for example, port 80) and forwarding the requests to one of the backend Tomcats. Apache does this via mod_jk or mod_proxy. There are numerous algorithms used for load balancing, depending on what's important to you in order to ensure optimal processing. One additional consideration is whether or not the balanced requests are stateless or stateful (session-based). Extra care has to be taken to ensure that multiple stateful requests are processed using the same session, which means that either you have to "pin" a user to a specific instance of Tomcat for the duration of the session or you have to be able to share the session between multiple Tomcat instances (which requires some additional internal overhead). That's one of the reasons that ReST has become popular - it's based on a stateless mode of operation and therefore doesn't need to allow for that.

As Ulf has said, for specifics on using Solr, please create a new thread. We'll reserve this thread for questions and comments about multiple Tomcat instances.
I guess I've been abducted by space aliens. So unprofessional. They tried to probe me with this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic