Monday, June 14, 2010

Multi tomcat running in same system


GRIA is designed to allow the various services to be installed on different machines, and for this reason internal communication between services uses SOAP. Sometimes, it is desirable to install multiple war files (typically the basic application services and the service provider management services) on a single machine.

In GRIA 5.0, there is a known problem with this approach. In order to prevent tomcat from running out of memory and crashing when there are a large number of incoming requests to service, the number of threads should be limited using the maxThreads setting in the$TOMCAT_HOME/conf/server.xml file. But, this can cause dead-lock in the following situation:

  1. The service is configured to allow a maximum of n threads.
  2. A client makes n calls to a job or data service operation that requires confirmation from the SLA service.
  3. The job or data service tries to invoke the SLA service (over SOAP), but no threads are available.
  4. The service waits until a thread becomes free for the SLA service, but none of them ever will because they are all processing requests to an application service that are waiting for a free SLA thread.

The recommended solution to this problem is to run two instances of tomcat on the single machine, one running the management services and one running the application services. Because the threads are then not shared between the two, an SLA operation will never block because a thread is taken by an application service and the system will not deadlock.

Set Up

To install two instances of tomcat in this way:

  1. Download tomcat, and unpack it twice, into two separate directories.
  2. Edit the conf/server.xml file in one of the copies in the following way:
    1. Change the port on the root Server element to a different number (e.g. 8006)
    2. Change the port attributes on the Connector elements to a different number (e.g. 8010 instead of 8009, 8081 instead of8080 and 8444 instead of 8443)

You should now be able to run the bin/ scripts in both installations to get two running tomcats. Connect using port 8080 and install the basic application services, and then connect using port 8081 to install the service provider management services.

No comments:

Post a Comment