Can Tomcat tell mod_jk's load balancer to use another worker when overloaded? If so, how?

StackOverflow https://stackoverflow.com//questions/9611169

  •  09-12-2019
  •  | 
  •  

Question

Can Tomcat tell mod_jk's load balancer to use another worker when overloaded? If so, how?

I use Kodo JDO for my persistence layer of a multi-tenant application and a big factor in memory usage is the schema information loaded per database. Every organization who uses my application has their own database. The application does not support clustering or session serialization. Retrofitting it to support those is out of scope for this project.

Each instance of Tomcat is limited to 4GB of heap to keep the garbage collector from choking. No single instance of Tomcat has enough memory to load the schema of all the databases needed for all organizations.

Tomcat's load balancing is typically done by session. Doing balancing by session can lead to one instance loading more schemas than its memory can hold and it will die a slow and painful death ending in a GC Overhead Limit.

My current workaround is to use multiple explicitly separate instances with separate host names. Each organization is given access to one of these host names.

One option would be for a "full" Tomcat to signal that it can't serve the user.

Can Tomcat tell mod_jk's load balancer to use another worker when overloaded? If so, how?

Was it helpful?

Solution

Interesting question (+1). If you find an answer, do pass it on :)

The only way I know of doing this is via a load balancer.

Another cool feature of using a load balancer is that you can setup http health checks, so if anyone of your instances stops responds, it will move on to the next healthy server.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top