This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
advantages/disadvantages of Tomcat in contrast to what alternatives? I think it's hard to give a good answer to this question without knowing more details. Tomcat probably doesn't give you the same performance like Apache for example when you have static HTML contents. But that depends on your application of course. Also there are a lot more aspects you have to consider like clustering, load-balancing, session handling in a cluster and many more. For this reason it's not as easy as it may seem to gain more performance by simply substituting one server product with another. If you're talking about really heavy traffic there's often no other way to go than clustering multiple servers and then the overall performance depends on a lot of other factors besides the web server product. If you have an application which doesn't scale well in a clustered environment that could be your bottleneck and it wouldn't matter which server you're using. If your application relies a lot on database access the database server(s) could be a bottleneck as well.
Besides these points there are even more aspects to consider when running web applications under heavy load. Unfortunately it's not possible to give really good advices without knowing the exact requirements of the software, what "heavy" load means for you etc.
I've seen web applications in production use which worked really fine on a single server with 20-25 requests per second (which is surely not really heavy load). In this situation it was enough to have slightly more users and everything broke down with about 30 req./s.
So the best way could be to simply test your application before launching it for production use! Make an estimation how many users/request you could probably expect and then stress test your application! This will show you where the bottlenecks are and you can still think about optimization where it's really needed!
[ November 15, 2008: Message edited by: Marco Ehrentreich ] [ November 15, 2008: Message edited by: Marco Ehrentreich ]
Joined: Jun 29, 2008
Thanks lot for the detailed explanation i totally agree to the fact that clustering, load-balancing will improve the performance of the application but my question is for a particular sofware and harware requirement in a non clustered environment without a load balancer which app server would be the best choice , if we consider server like tomcat,jboss,weblogic, is there any limitation container wise for the maximum number of requests it can handle at any time.
This is exactly my opinion, too. There are too many specific problems to give a general answer to such comparison questions even though many benchmarks may suggest that it's possible.
Besides your code there are other problems like the ratio between static and dynamic content. The underlying operating system and hardware may not behave exactly equal for all servers out of the box. Each server product has lots of tweaking options but you/your admin needs a deeper knowledge of all this little configuration parameters to use it wise etc.
Still the best idea will be to do some performance tests as Ulf suggests, too. I don't have practical experience with commercial application servers, so I can't tell you if these are better than opensource alternatives regarding performance but often it's only the support which makes commercial products "better".
If you plan to use an opensource server in contrast, I think it comes down to the most popular alternatives like Tomcat, Jetty and Resin which are also used as servlet container within full application servers like Glassfish, Jboss, Geronimo etc. Take two or three of these web containers and do some testing. Then you'll know if it really makes a difference for your application.
Joined: Jun 29, 2008
thanks a lot Ulf and Marco for the detailed advice