[ACCEPTED]-Running Tomcat in production environments-cluster-computing

Accepted answer
Score: 16

I am currently using Tomcat6 as a Web-Container 53 on development and production.

I have heard 52 that Tomcat is not the best performing Web-Container 51 for production environments. Is this true?

Well, again 50 it depends on how do you see it. Tomcat 49 can perform very well, and it is used everywhere 48 in the production, with largest user base. Some 47 commercial application servers use Tomcat 46 under the hood without even telling you.

Of 45 course you should not compare Tomcat out-of-the-box 44 performance to a well tuned web containers. Tomcat 43 can be tuned for much better performance 42 than it's out-of-the-box state. You can 41 google: "tomcat production" for 40 example and see how people managed it in 39 real production and get a lot of advices, tips, etc.

Is 38 Tomcat sufficient in terms of performance 37 and memory management to use on production 36 environments?

Yes, it is. When you need more, there 35 are a lot of vendors that offers commercial 34 version of Tomcat, including monitoring 33 and instrumentation to help maintain your 32 application in production.

Our system/s have 31 around 100 to 400 users.

Tomcat can handle 30 more than this for sure. Depends on the 29 nature of your application/system, you may 28 require more than one instance of Tomcat. In 27 real production environment it will be wise 26 to cluster your Tomcat.

For me its more about 25 how the Web-App was written and the type 24 of operations inside the Web-App.

Half truth.

I 23 believe good architecture and framework 22 will also save you a lot of time when you 21 are about to cluster the Tomcat. So you 20 need to have a general knowledge about how 19 web container application works, how your 18 framework handles things in clustered environment 17 and how they are clustered, before deciding 16 how you lay down your framework stack.

For 15 example issues may arise from:

  • in memory caching in more than one JVM instances
  • session store (memory, database, file store) and its replication

Clustering 14 Tomcat is not a trivial task, and laying 13 down your framework improperly will make 12 it difficult to incorporate clustered Tomcat 11 later.

Even if performance is a problem on 10 one Tomcat instance, is it possible to cluster 9 Tomcat?

Yes, it is possible to cluster Tomcat. The 8 way you design your application determines 7 whether your application will be ready easily 6 for clustering, or will be more complicated 5 to cluster. This issue may not be specific 4 to Tomcat, but to application servers in 3 general.

Some issues you may need to consider:

  • what data you store in (HTTP) session
  • where to store the session
  • keep alive session
  • use web server application load balancing reverse proxy e.g. Apache Web Server + mod_proxy/mod_jk, nginx, Varnish
  • which Tomcat connectors to use (Blocking IO, NIO, APR)

There 2 are some other issues, but I think those 1 are you can start with.

Score: 7

100-400 user is a relative small deployment. I 26 helped clients in deploying Tomcat solution 25 with much much bigger registered user base 24 (in the range of millions) or concurrent 23 users. I do not even believe a cluster is 22 needed for your deployment.

To cluster Tomcat 21 server is pretty simple. Putting a load 20 balancer in front of the Tomcat servers. Configure 19 the Load balancer with session stickyness. And 18 you will have a very nice Tomcat cluster. Some 17 clients want session failover in case one 16 Tomcat instance fails and user can be automatic 15 route to a second instance without losing 14 session data. I consider this to be over 13 kill for your deployment. In reality, the 12 downtime caused by regular maintenance will 11 be much higher than system failure. I have 10 Tomcat servers running for months and only 9 need to bring in down for major code releases. But 8 in case it is needed, there are open source 7 package supporting session clustering.

Speaking 6 of that, most J2EE application performance 5 problem originated from the application 4 itself rather the Tomcat server. Here are 3 Top J2EE Application Performance Problems that I encountered the most when I trouble 2 shoot my client system performance. Hope 1 this help.

Score: 3

You are right, first think about the functionality 3 and then about the performance. Even one 2 instance of Tomcat will serve good enough 1 that number of users. And, yes, clustering Tomcat is possible.

Score: 0

Tomcat is just a web-server. If you're looking 10 to cluster your web-app you should look 9 at your system setup and send HTTP calls 8 to other servers where the same code is 7 located, to off-load your main server.

This 6 is achievable by having a clustered dynamic 5 environment that doesn't depend on your 4 web-server or your application.

As for Tomcat's 3 performance, I wouldn't worry about it, worry 2 about your code as that's where 90% of bottlenecks 1 are located.

More Related questions