Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scalability of a single server for running a Java Web application

I want to gain more insight regarding the scale of workload a single-server Java Web application deployed to a single Tomcat instance can handle. In particular, let's pretend that I am developing a Wiki application that has a similar usage pattern like Wikipedia. How many simultaneous requests can my server handle reliably before going out of memory or show signs of excess stress if I deploy it on a machine with the following configuration:

  • 4-Core high-end Intel Xeon CPU
  • 8GB RAM
  • 2 HDDs in RAID-1 (No SSDs, no PCIe based Solid State storages)
  • RedHat or Centos Linux (64-bit)
  • Java 6 (64-bit)
  • MySQL 5.1 / InnoDB

Also let's assume that the MySQL DB is installed on the same machine as Tomcat and that all the Wiki data are stored inside the DB. Furthermore, let's pretend that the Java application is built on top of the following stack:

  • SpringMVC for the front-end
  • Hibernate/JPA for persistence
  • Spring for DI and Security, etc.

If you haven't used the exact configuration but have experience in evaluating the scalability of a similar architecture, I would be very interested in hearing about that as well.

Thanks in advance.

EDIT: I think I have not articulated my question properly. I mark the answer with the most up votes as the best answer and I'll rewrite my question in the community wiki area. In short, I just wanted to learn about your experiences on the scale of workload your Java application has been able to handle on one physical server as well as some description regarding the type and architecture of the application itself.

like image 266
Behrang Avatar asked Aug 07 '10 08:08

Behrang


2 Answers

You will need to use group of tools :

  1. Loadtesting Tool - JMeter can be used.
  2. Monitoring Tool - This tool will be used to monitor various numbers of resources load. There are Lot paid as well as free ones. Jprofiler,visualvm,etc
  3. Collection and reporting tool. (Not used any tool)

With above tools you can find optimal value. I would approach it in following way.

  1. will get to know what should be ratio of pages being accessed. What are background processes and their frequency.
  2. Configure my JMeter accordingly (for ratios) , and monitor performance for load applied ( time to serve page ...can be done in JMeter), monitor other resources using Monitor tool. Also check count of error ratio. (NOTE: you need to decide upon what error ratio is not acceptable.)
  3. Keep increasing Load step by step and keep writting various numbers of interest till server fails completely.

You can decide upon optimal value based on many criterias, Low error rate, Max serving time etc. JMeter supports lot of ways to apply load.

like image 149
YoK Avatar answered Sep 28 '22 17:09

YoK


To be honest, it's almost impossible to say. There's probably about 3 ways (of the top of my head to build such a system) and each would have fairly different performance characteristics. You best bet is to build and test.

Firstly try to get some idea of what the estimated volumes you'll have and the latency constraints that you'll need to meet.

Come up with a basic architecture and implement a thin slice end to end through the system (ideally the most common use case). Use a load testing tool like (Grinder or Apache JMeter) to inject load and start measuring the performance. If the performance is acceptable - be conservative your simple implementation will likely include less functionality and be faster than the full system - continue building the system and testing to make sure you don't introduce a major performance bottleneck. If not come up with a different design.

If your code is reasonable the bottleneck will likely be the database and somewhere in the region 100s of db ops per second. If that is insufficient then you may need to think about caching.

like image 27
Michael Barker Avatar answered Sep 28 '22 17:09

Michael Barker