jvm tuning and jmeter performance testing

JVM tuning

Reference:
In-depth explanation of JVM tuning, after reading you will understand
the tuning parameters and instructions
JVM tuning summary

parameter meaning Defaults describe
-Xms initial heap size 1/64 of memory By default (the MinHeapFreeRatio parameter can be adjusted) when the free heap memory is less than 40%, the JVM will increase the heap until the maximum limit of -Xmx
-Xmx maximum heap size 1/4 of memory By default (the MaxHeapFreeRatio parameter can be adjusted) when the free heap memory is greater than 70%, the JVM will reduce the heap until the minimum limit of -Xms
-Xmn young generation size Note: The size here is (eden+ 2 survivor space). It is different from the New gen displayed in jmap -heap. The entire heap size = young generation size + old generation size + permanent generation size. After increasing the young generation, the size of the old generation will be reduced. This value has a great impact on system performance, and Sun officially recommends configuring it as 3 of the entire heap /8

Configuration parameters:

 //设置堆初始值
 指令1:-Xms2g
 指令2:-XX:InitialHeapSize=2048m
 //设置堆区最大值
 指令1:`-Xmx2g` 
 指令2: -XX:MaxHeapSize=2048m
 //新生代内存配置
 指令1:-Xmn512m
 指令2:-XX:MaxNewSize=512m

View GC instructions

jstat -gc PID 

jdktools:
insert image description here

Practical application:
insert image description here

List performance testing FAQs

In the performance test results, the indicators we pay attention to are tps and art (of course, we also pay attention to the various resources of each server), if the tps is low, or the response time is long, or the server resources are tight, then we need to locate the performance problem up

常见的性能问题(有些只是表象,需要深层次定位):
  a.服务器
    cpu:us & sy
    内存:使用率及交换率
    磁盘io:读写慢
    磁盘容量
  b.网络带宽:看当前收、发速度及有没有丢包、端口使用情况
  c.cpu高:看线程信息;是否fgc等
  d.队列问题(负载高):磁盘io队列(物理读高);线程队列(线程阻塞、锁竞争)
  e.各种连接池问题:不足、未释放
  f.死锁问题:线程死锁、数据库死锁
  g.sql问题:索引(未加、使用不当)、慢sql(全表扫描、循环插入 or 更新、查询结果未分页展示、sql逻辑)、长事务
  h.应用log级别:设置不正确
  i.缓存设置问题、没有利用好缓存
    j.缺乏消息中间件
    k.代码:业务逻辑代码冗余、遍历Map

Performance testing: the difference between TPS and QPS

TPS: Transactions Per Second, which means the number of transactions per second. The definition of specific transactions is artificial, and can be one interface, multiple interfaces, one business process, and so on. A transaction refers to the process from sending the first request to receiving the response of the last request in the transaction, so as to calculate the time used and the number of completed transactions.

Taking a single interface definition as a transaction as an example, each transaction includes the following three processes:

  1. send a request to the server
  2. Server's own internal processing (including application server, database server, etc.)
  3. The server returns the result to the client

If these three processes can be completed N times per second, tps is N;
if multiple interfaces are defined as a transaction, then abc will be executed repeatedly, and these requests are completed once, which is counted as one tps.

QPS: Queries Per Second, which means the query rate per second, is the number of queries that a server can respond to per second (the number of times SQL is executed per second in the database). Obviously, this is not comprehensive enough to describe additions, deletions, and modifications. Therefore, It is not recommended to use qps as a system performance indicator.

tps, qps difference

If it is a pressure test for a query interface (single scene), and this interface will not request other interfaces internally, then tps=qps, otherwise, tps≠qps

If it is a capacity scenario, assuming that all n interfaces are query interfaces, and this interface will not request other interfaces internally, qps=n*tps

In the jmeter aggregation report, Throughput is used to measure the throughput of the request, that is, tps, tps=number of samples/running time; what we define is tps, not qps

If no transaction is defined, each request will be treated as a transaction
insert image description here

JMETER

Batch testing with jmeter parameterization (interface testing)

https://blog.csdn.net/weixin_34255055/article/details/91504414

Interface pressure test example:
https://www.cnblogs.com/Owen-ET/p/14229778.html

Guess you like

Origin blog.csdn.net/u014438244/article/details/121162899