stepanian
stepanian

Reputation: 11433

Tomcat - scaling on a single server

I have an embedded Tomcat application running on an Amazon EC2 instance. The site was getting an increased amount of traffic, so I upgraded to a much larger instance. However, with the same amount of traffic and with a much larger server, the slow down was still there. I increased the maxThreads and the xmx/xms, but that didn't help much.

The server resources used are small on both the web server and the database server (RDS) (less than 10% memory and less than 20% CPU).

Is there anything that can be done to speed up Tomcat? Or should I bite the bullet and use multiple Tomcat instances and a load balancer?

EDIT: Just to clarify, nothing has changed in the application, just the traffic increased (almost doubled). My assumption was that (more than) doubling the resources (web server and db) should be adequate. I guess it's not that simple.

Upvotes: 2

Views: 1868

Answers (2)

gsaslis
gsaslis

Reputation: 3166

stepanian, even though I'm not sure exactly what you mean by 'slow down', I had a similar case a few months back, when a huge spike of traffic (some viral campaign) caused our tomcat to behave really weird, even though the bottleneck was NOT on the disk, cpu or memory.

In our case, changing the Connector configuration basically solved the problem, especially understanding the:

  • acceptCount
  • acceptorThreadCount
  • maxConnections
  • maxThreads

Hope this helps! : )

Upvotes: 2

Kayaman
Kayaman

Reputation: 73538

It's better you don't do anything right now. You obviously don't know what's actually slowing down the application, that's why you were surprised when you upgraded the server and it had no effect.

Instead of randomly doing things like a monkey with a typewriter, hoping that something will help, profile your application (and run load testing against it) and see what are the "heaviest" actions. Then decide how to fix it, whether it's with code optimization, architectural changes, load balancing or any other solutions.

Don't guess, know.

Upvotes: 5

Related Questions