The author, with a strong interest in hardware, conducted performance testing using JMeter and documented the deployment process of JMeter, InfluxDB, and Grafana on CentOS 7. They shared details on JMeter installation and command usage, InfluxDB features and Docker installation, as well as simple Grafana deployment and configuration. The document summarizes experiences and references for high-performance programming patterns.
Background
What use is a web panel in addition to data display?
You won’t understand until you try it yourself Don’t use GUI mode for load testing! only for Test creation and Test debuggin.
The official recommendation is to obtain the load test report via command line and display it with a GUI, which may introduce data errors? I don’t have a deep understanding of JMeter, but at least this gives me a reason to experiment with the console panel in version INLINE_CODE_0
The deployment method of Open Source China’s posts is not user-friendly, and the required files for installation also need to be downloaded via a public account. As a new generation, I naturally chose an alternative. Ultimately, it’s still slow accessing cross-border sources due to servers being located domestically; at least mirror services offer acceleration, like the free one from Alibaba Cloud.
Installation deployment of INLINE_CODE_0 is not detailed here; please refer to previous articles for guidance
The following content is divided into two parts: building basic testing environment components and a brief introduction to each component
Jmeter
Apache JMeter is a load testing tool developed by the Apache organization, based on Java. It was initially designed for web application testing but has since been extended to other testing areas. It can be used to test static and dynamic resources such as static files, Java microservices, CGI scripts, Java objects, databases, FTP servers, etc. JMeter can simulate a large load on servers, networks, or objects to test their strength and analyze overall performance under different stress categories. Additionally, JMeter can perform functional/regression testing by creating scripts with assertions to verify that your program returns the expected results. For maximum flexibility, JMeter allows the use of regular expressions for creating assertions.
Apache JMeter can be used to test the performance of static and dynamic resources (files, Servlets, Perl scripts, Java objects, databases and queries, FTP servers, etc.). It can simulate heavy loads on servers, networks, or objects to test their resilience or analyze overall performance under different types of stress. You can use it for graphical analysis of performance or to load test your servers/scripts/objects with high concurrency.
JMeter deployment on CentOS 7
Installation package
yum install java-1.8.0-openjdk -y && \
wget https://mirrors.bfsu.edu.cn/apache//jmeter/binaries/apache-jmeter-5.4.tgz && tar -xf apache-jmeter-5.4.tgz
Configure environment variables
export JMETER_HOME=$HOME/jmeter/apache-jmeter-5.4
export PATH=$JMETER_HOME/bin:$PATH
JMeter commands
Finally, observe data on the control panel
jmeter -n -t /tmp/order-500-10s.jmx -l /tmp/jmeter-order-report-20200109/order-500-10s.jtl
# 一般不用测试结果和测试报告,简化命令
jmeter -n -t /tmp/order-500-10s.jmx
InfluxDB
InfluxDB is an open-source distributed time series, event, and metrics database written in Go, requiring no external dependencies. It’s now primarily used to store large volumes of timestamped data, such as DevOps monitoring data, app metrics, IoT sensor data, and real-time analytics data.
InfluxDB Features
The features of InfluxDB can be summarized into 9 aspects:
- Unstructured (no pattern): Can have an arbitrary number of columns;
- The retention period for metrics can be configured
- Supports time-related functions (e.g., min, max, sum, count, mean, median) for statistical analysis
- Supports storage policies: Can be used for data deletion and modification (InfluxDB does not provide methods for deleting or modifying data)
- Continuous queries are a set of statements that automatically start on a schedule in the database, and when paired with storage policies, can reduce InfluxDB system resource usage
- Native HTTP support, built-in HTTP API
- Supports SQL-like syntax
- Allows configuring the number of data replicas within the cluster
- Supports periodic sampling data, writing it to another measurement for granular storage
Installing InfluxDB Docker
mkdir influxdb && cd influxdb && \
docker run -p 8086:8086 -d --name influxdb -v $PWD:/var/lib/influxdb influxdb:1.7
Enter container, execute command, manually create database
root@bce0a55bbc72:/# influx
Connected to http://localhost:8086 version 1.7.10
InfluxDB shell version: 1.7.10
> 交互面板执行命令
Creating databases and users in InfluxDB
Create database jmeter_t2 View databases Switch database: use jmeter_t2 Create user “admin” with password ‘admin’ and all privileges View Users
> show users
user admin
---- -----
admin true
If user permissions are displayed, database preparation is complete
Grafana
The need for chart display is not essential; the INLINE_CODE_0 data from the interface can already be observed when executed in the command line, and it’s more about understanding the program’s internal execution time
Simple deployment
The console supports filtering test results by tag, and typically only requires configuring one database
- Application Name
- Test Case Name
docker run -d --name=grafana -p 3000:3000 grafana/grafana:7.3.1
Web version calculations are affected by sampler interval
The document also describes how to customize __INLINE_CODE_0
Afterword
- High-performance programming inherently relies on a single loop thread; any locks, queuing (for entry and exit), will cause unnecessary performance loss
- The time spent on core business logic exceeds the time spent on introducing other code; concurrency is effective only when this core processing time is sufficiently small, and otherwise, introducing additional code should be approached cautiously
References
- Please provide the Chinese text you want me to translate. I am ready when you are! Just paste the text here.
- Please provide the Chinese text you want me to translate. I am ready when you are! Just paste the text here.
- Please provide the Chinese text you want me to translate. I am ready when you are! Just paste the text here.
- Please provide the Chinese text you want me to translate. I am ready when you are! Just paste the text here.
- To install Apache JMeter in CentOS7