TechTorch

Location:HOME > Technology > content

Technology

Distributed Performance Testing with JMeter: Achieving 1204 TPS Using 100000 Threads

April 04, 2025Technology3722
Distributed Performance Testing with JMeter: Achieving 1204 TPS Using

Distributed Performance Testing with JMeter: Achieving 1204 TPS Using 100000 Threads

Running a performance test in JMeter with the need to simulate 100000 users hitting a service endpoint presents a significant challenge. Achieving 1204 transactions per second (TPS) under such conditions requires a strategic approach. This article will guide you through the process of setting up a distributed JMeter test to achieve your desired performance metrics.

Breaking Down the Challenge

When trying to emulate 100000 users hitting a service endpoint, one of the first challenges is running JMeter in a single JVM. JMeter is not designed to handle such a high number of threads in a single instance. Therefore, a distributed setup is essential to achieve the desired load.

Setting Up Distributed JMeter

To set up a distributed JMeter performance test, you need at least two JMeter instances: the Master and the Slave nodes.

1. Setting Up the Master Node

The Master node initiates the test and distributes the load to the Slave nodes. Here are the steps to configure the Master node:

Download and install JMeter on the Master node. Locate the JMeter properties files () Modify the following properties to enable remote testing:
# Set port for Master to listen
remote_hosts127.0.0.1:1099
# Define  and log files
server_log_file/tmp/jmeter-server.log
server_log_levelINFO
# Set JMeter Server Properties
server.rmi.localport12001

2. Setting Up the Slave Nodes

The Slave nodes will perform the load. Here’s how to configure them:

On each Slave node, download and install JMeter. Edit the JMeter properties file on each Slave node () to include the Master node's details:
# Add the hostname and port of the Master node
remote_hosts127.0.0.1:1099
# Define  and log files
server_log_file/tmp/jmeter-server.log
server_log_levelINFO
# Set JMeter Server Properties
server.rmi.localport12002

3. Starting the JMeter Performance Test

After setting up both the Master and Slave nodes, start the JMeter performance test:

On the Master node, start JMeter in server mode with the command: jmeter -n -t your_test_ -R 127.0.0.1,127.0.0.2:1099. Replace your_test_ with the path to your test plan. On the Slave nodes, start JMeter in client mode with the command: jmeter -n -t your_test_ -R 127.0.0.1:1099. Again, replace your_test_ with the path to your test plan.

This will initiate the test with load distributed across the Slave nodes.

Configuring the JMeter Test Plan

To configure the JMeter Test Plan, follow these steps:

1. Setting the Thread Group and Ramp-Up Period

The Thread Group determines the number of users and the ramp-up period for your test. To achieve 1204 TPS, you will need a large ramp-up period and a significant number of threads.

ThreadGroup
  elementProp name_threads classNameString
    !---- Set the number of threads (100000) ----
    stringProp name
  /elementProp
  elementProp nameThreadGroup.ramp_time classNameString
    !---- Set the ramp-up period to allow gradual load increase ----
    stringProp name
  /elementProp
  stringProp name_TIME0/stringProp
  stringProp name_1204/stringProp
  stringProp nameThreadGroup.on_sample_errorcontinue/stringProp
/ThreadGroup

2. Specifying the Duration of the Test

The test duration should be long enough to achieve the desired TPS rate. A good starting point is 3600 seconds (1 hour), but it may need to be adjusted based on the test results. Monitor the TPS and throttle back the ramp-up period as necessary.

Tuning JMeter for High-Load Testing

To prevent JMeter from becoming a bottleneck, ensure adequate resources are available on all test nodes:

Ensure that each node has sufficient CPU, memory, and network bandwidth. Optimize JVM settings for high concurrency, such as using larger heap sizes. Monitor GC activity to prevent frequent garbage collection pauses. Use JMeter's settings to minimize resource usage, such as setting userPropertiesFile and resultsFile to non-default locations to reduce I/O.

Additionally, consider using multiple thread groups to distribute different loading patterns more effectively:

Alternative Thread Groups

For a more granular control over load, you may want to use multiple thread groups. For instance:

Thread Group 1: 50000 threads for high-frequency requests. Thread Group 2: 50000 threads for bursts of high-traffic requests.

This approach allows you to simulate different behaviors and test the application under various conditions.

Conclusion

Running a JMeter performance test to achieve 1204 TPS with 100000 threads is a complex task that requires a distributed setup and careful resource management. By following the steps outlined above, you can ensure that your test runs smoothly without the risk of JMeter becoming a bottleneck. Experiment with different configurations to optimize your test, and always monitor your system's performance metrics during the test.

Additional Resources

For a more detailed guide on distributed JMeter testing, refer to the following tutorial:

Apache JMeter Distributed Testing Step-by-step