当前位置:网站首页>JMeter uses JDBC to perform database pressure test
JMeter uses JDBC to perform database pressure test
2022-06-24 03:00:00 【Tanyin】
The background that
In addition to the full link voltage measurement, the voltage measurement , Sometimes you need to test the performance of a specified service , Here we use jmeter The tool describes the pressure test of the database .
Different database drivers need to be installed for different databases of pressure test , Here we use mysql As an example for pressure measurement .
Step one : Database driver installation
1. Get into mysql Official website , According to the different mysql Download the corresponding database driver mysql-connector-java, download mysql-connector-java, Refer to the following figure for the corresponding version :
2. Download the compressed package according to your own operating system
3. Unzip after download , find mysql-connector-java-xxx.jar Of jar package , hold jar Put the bag in jmeter Under the installation path lib Under the directory , Then open the jmeter application
Step two :JDBC Connection Configuration To configure
Add one JDBC Connection Configuration, test plan -> add to -> The configuration element ->JDBC Connection Configuration, Used to connect to the database .
Variable Name Bound to pool
Database connection pool configuration
Configuration item | explain |
|---|---|
Variable Name for created pool | The name of the database connection pool , Fill in the variable name , and JDBC request Medium Variable Name Binding |
Connection pool Configuration
Connection pool parameter configuration , Basically keep the default , It can be modified as needed
Configuration item | explain |
|---|---|
Max Number of Connection | Maximum number of database links , It can be set to 0, This means that each thread uses a separate database connection , Database connections between threads are not shared |
Max Wait (ms) | The maximum waiting time to retrieve a connection in the connection pool |
Time Between Eviction Runs(ms) | Thread idle time if a connection in the current connection pool is idle time Between Eviction Runs Millis Time is still unused , Is physically closed |
Auto Commit | Automatic submission sql sentence |
Read timeout(ms) | Timeout waiting for server response |
Transaction isolation | Transaction isolation level , There are mainly the following options :( Yes JMX encryption ) TRANSACTION_NODE Transaction node 、TRANSACTION_READ_UNCOMMITTED Transaction uncommitted read 、TRANSACTION_READ_COMMITTED Transaction committed read 、TRANSACTION_SERIALIZABLE Transaction serialization 、DEFAULT Default 、TRANSACTION_REPEATABLE_READ Transaction repeat read |
Preinit Pool | Initialize the connection pool immediately if it is False, Is the first JDBC The response time of the request will be longer , Because it includes the time when the connection pool is established |
Connection Validation by Pool
Verify that the connection pool can respond
Configuration item | explain |
|---|---|
Test While Idle | Test for disconnection when the connection is idle |
Soft Min Evictable Idle Time(ms) | The minimum time a connection is idle in the pool , The default value is 5000(5 second ) |
Validation Query | A simple query , Used to determine whether the database is still responding |
Database Connection Configuration
Database connection configuration
Configuration item | explain |
|---|---|
Database URL | Database connection URL, See note for details 1 |
JDBC Driver class | database JDBC Driver class name , Select the data driver of the corresponding database |
Username | Database login user name |
Password | Database login password |
Connection Properties | Connection properties to be set when establishing a connection |
notes 1:Database URL: jdbc:mysql:// Server address :3306/ Database name ( such as :jdbc:mysql://ip:3306/ Database name ?useUnicode=true&characterEncoding=utf8&allowMultiQueries=true. among &allowMultiQueries=true Indicates that multiple... Are allowed sql)
Step three :JDBC Request To configure
Add after the database connection configuration is completed JDBC Request, Thread group -> add to -> Sampler ->JDBC Request, Used to deal with JDBC request
Variable Name Bound to pool
Database connection pool configuration
Configuration item | explain |
|---|---|
Variable Name for pool declared in JDBC Connection Configuration | The name of the database connection pool , and JDBC Connection Configuration Of Variable Name for created pool Keep the name the same |
SQL Query
sql sentence , Take query as an example
Configuration item | explain |
|---|---|
Query Type | sql Statement type , The statement here selects select statement, According to the actual test sql Choose |
Query | Completed sql sentence , Use... Between multiple statements ; Division , Do not add... At the end of the statement ; |
JDBC Request | Value to transfer |
Parameter types | Type of transmitted value |
Variable names | sql Execution result variable name |
Result variable names | All results are stored as an object |
Query timeouts(s) | Query timeout |
Limit Result Set | Limit sql Statement returns the number of rows in the result set |
Handle Result Set | How to define callable statements The result set returned ; The default is stored as a string |
Step four : Script execution
Add view result tree , Thread group -> add to -> Monitor -> View the result tree , Follow the steps above to JDBC Connection Configuration and JDBC Request After editing , Click the start button at the top of the page , Run script .
Check the result tree to see if the script is working properly . In the left navigation tree , Select view result tree , Check whether the request results meet the expectations . If the request fails or the result is not as expected , Need to readjust the script or SQL sentence .
边栏推荐
- Why do cloud desktops use rack servers? Why choose cloud desktop?
- Grpc: adjust data transfer size limit
- Cloud function pressure measurement based on wechat applet
- 2022-2028 global medical coating materials industry research and trend analysis report
- Tke single node risk avoidance
- How to build a private cloud desktop with a server? How to use cloud desktop?
- How to access the cloud game management server? Which cloud game management server can I choose?
- How much does it cost to rent a cloud game server? Which cloud game server is more reliable?
- The reason why SAS fortress cannot connect to the server
- Visual AI, first!
猜你喜欢

2022-2028 global aircraft audio control panel system industry research and trend analysis report

2022-2028 global medical modified polypropylene industry research and trend analysis report

2022-2028 global anti counterfeiting label industry research and trend analysis report

IOS development - multithreading - thread safety (3)

The cost of on-site development of software talent outsourcing is higher than that of software project outsourcing. Why

2022-2028 Global Industry Survey and trend analysis report on portable pressure monitors for wards

What is etcd and its application scenarios

2022-2028 global third-party data platform industry research and trend analysis report

2022-2028 global cancer biopsy instrument and kit industry research and trend analysis report
![[51nod] 2653 section XOR](/img/2d/cb4bf4e14939ce432cac6d35b6a41b.jpg)
[51nod] 2653 section XOR
随机推荐
US Treasury secretary says extortion software poses a threat to the economy, Google warns 2billion chrome users | global network security hotspot
Kibana report generation failed due to custom template
Permission maintenance topic: domain controller permission maintenance
How to log in the remote server of Fortress machine working principle of Fortress machine
System design: File Hosting Service
What are the performance characteristics of cloud desktop? How to choose the most cost-effective cloud desktop server?
11111dasfada and I grew the problem hot hot I hot vasser shares
Afnetworking server client
[51nod] 2653 section XOR
How to handle the occasional address request failure in easygbs live video playback?
What does the cloud desktop server do? What are the cloud desktop functions
How does easynvr call the interface to modify a user-defined page?
Vscode common shortcut keys, updating
The reason why SAS fortress cannot connect to the server
Wkwebview audio and video media playback processing
More than 10 million Android users installed a fraud app and doubled the number of blackmail attacks in the UK | global network security hotspot
Easynvr shows that the channel is online but cannot be played. Troubleshooting (non video streaming)
Uipickerview show and hide animation
What is the use of cloud desktop security server configuration? What should I do?
2022-2028 global cancer biopsy instrument and kit industry research and trend analysis report