I measured the maximum number of WEB/AP servers (Apache, Tomcat) can handle simultaneously using a VPS rental server.


Publication Date:January 1, 2021



INFOMARTION > I measured the maximum number of WEB/AP servers (Apache, Tomcat) can handle simultaneously using a VPS rental server.

summary

I have measured the maximum number of cases that the WEB/AP servers (Apache and Tomcat) can process at the same time, and would like to write the results. I was curious about the maximum number of requests that could be handled, so I did some research. Please use this as a reference for selecting VPS server specifications.

This time we measured with WEB/AP servers (Apache and Tomcat), but please refer to the article below for the case where we measured only with WEB (Apache).

I measured the maximum number of cases that the web server (Apache) can handle simultaneously using a VPS rental server.

Table of Contents

  1. measurement
  2. Measurement result details
  3. summary

1. measurement

1-1. Measurement environment

The following is the environment in which the measurements will be made.

■Rental Server Information

CPU2core
memory1GB
SSD50GB

■Server Information

OSCentOS 7.4 64bit
WEB ServerApache HTTP Server 2.4.41
AP ServerApache Tomcat 9.0.27
DB ServerPostgreSQL 10.2
JavaOpenJDK 11

1-2. measurement method

I would like to measure using JMeter. JMeter is a load measurement tool that runs in Java. This tool allows a large number of requests to be thrown at the same time. We would like to gradually increase the number of simultaneous requests using JMeter and increase the load until the processing cannot be handled any longer.

Specific conditions include

  • Request Interval・・・5 sec.
  • Number of simultaneous requests・・・10 cases(Gradually increase the number of measurements by 10 cases each.)
  • Measurement Time・・・60 sec.

The measurement time is "60 seconds" and the request interval is "5 seconds", so we would like to access the site 12 times (60÷5) repeatedly.

1-3. measurement results

In the end, many people may be wondering about the conclusion of what specs the server can handle and how much it can handle.

CPU:2core
memory:1GB
SSD:50GB
Up to 80 simultaneous requests can be processed

Based on the results of this measurement, the above was obtained. From the above results, we may infer the following. Please try to use this as a criterion for selecting server specifications.

CPU:1core
memory:512MB
SSD:25GB
Up to 20 simultaneous requests can be processed
CPU:2core
memory:1GB
SSD:50GB
Up to 80 simultaneous requests can be processed
CPU:3core
memory:2GB
SSD:100GB
Up to 200 simultaneous requests can be handled

We found that a system with about 20 users would work fine with "CPU: 1 core," "memory: 512MB," and "SSD: 25GB.

2. Measurement result details

If you are interested in the results of the measurement, please also check the details of the measurement results to be described in the future.

2-1. WEB/AP server (Apache, Tomcat) measurements

I threw a request with a scenario to log in from the login screen and display the list screen after logging in. Incidentally, the screen, including the authentication function, was created using the Spring framework.

The measurements yielded the following results.

  • For 10 simultaneous requests⇒OK
  • For 20 simultaneous requests⇒OK
  • For 30 simultaneous requests⇒OK
  • For 40 simultaneous requests⇒OK
  • For 50 simultaneous requests⇒OK
  • For 60 simultaneous requests⇒OK
  • For 70 simultaneous requests⇒OK
  • For 80 simultaneous requests⇒OK
  • For 90 simultaneous requests⇒NG

Error occurred on the 90th case. The cause was a connection error to Apache. The status of the server at this time was as follows.

  • CPU utilization・・・26%
  • memory utilization・・・100%

The complete lack of memory was the bottleneck.

This is a bit geeky, but here is how Apache's Multi-Processing Module (MPM) is configured. MPM is simply a setting for how much Apache is allowed to process in parallel.

<IfModule mpm_prefork_module>
    StartServers             5
    MinSpareServers          5
    MaxSpareServers         10
    MaxRequestWorkers      250
    MaxConnectionsPerChild   0
</IfModule>

The setting of interest is "250" for "MaxRequestWorkers". This is a setting for the maximum number of cases Apache can process at the same time. The maximum number of parallel processing is "250," so it seems that 250 cases can be processed in parallel, but looking at the memory usage, about 8 MB of memory was used per case.

It seems that Java uses 320MB of memory (248M for heap and 72M for metaspace) and Apache uses 640MB of memory (8M x 80 processes), and although Apache's MPM setting value is "250", it seems that it cannot create more than "80" processes.
※Since the server has 1G of memory, the total memory for Apache and Java is 960MB, which is almost at the maximum limit.

The AP server (Java side) was working fine, so the bottleneck was the WEB server (Apache).

When Apache and Tomcat are installed and running, we found that with the specifications "CPU: 2core, memory: 1GB, SSD: 50GB", the number of simultaneous accesses is limited to "80".(The assumption is that the memory settings for Java are 248M for heap and 72M for metaspace.)

2-2. consideration

As a consideration, I think that the number of concurrent processes may increase if the memory is changed since memory is the bottleneck.

【present(memory1GB)】

  • memory:1GB
  • Number of Apache threads:80 cases
  • Memory consumption per thread in Apache:8MB
  • Apache memory consumption:640MB(80 cases×8MB)
  • Tomcat memory consumption:320MB(heap is 248M、72M for metaspace)
  • Memory consumption of Apache+Tomcat:960MB

【After change(memory2GB)】

  • memory:2GB
  • Number of Apache threads:200 cases
  • Memory consumption per thread in Apache:8MB
  • Apache memory consumption:1600MB(200 cases×8MB)
  • Tomcat memory consumption:320MB(heap is 248M、72M for metaspace)
  • Memory consumption of Apache+Tomcat:1920MB

With 2GB of memory, we can probably process about 200 cases concurrently. If the memory is increased to 3GB, more concurrent processing may be possible, but since the "MaxRequestWorkers (maximum number of concurrent processes)" of Apache's MPM is 250, further tuning may be necessary if the memory is increased further. Java memory tuning may also be required. On the other hand, if memory is cut in half, it would be as follows.

【After change(memory512GB)】

  • memory:512GB
  • Number of Apache threads:20 cases
  • Memory consumption per thread in Apache:8MB
  • Apache memory consumption:160MB(20 cases×8MB)
  • Tomcat memory consumption:320MB(heap is 248M、72M for metaspace)
  • Memory consumption of Apache+Tomcat:480MB

3. summary

We have described the results of measuring the maximum number of cases that the WEB/AP servers (Apache and Tomcat) can process at the same time. We found that a system with about 20 users would work fine with "CPU: 1 core," "memory: 512MB," and "SSD: 25GB.

This survey is based on the assumption that no other software is running at marginal performance. We recommend that you choose a specification with a bit of leeway as it is a marginal value.

Thank you for taking the time to read this to the end.




■INFORMATION

Please click here to go to the top page of INFORMATION.


■PROFILE

Please click here to view the profile.


■For inquiries, please contact

For inquiries about the article, please contact us here.