2. Performance pressure test
By determining the bottleneck or unacceptable performance points of a system, the test of the maximum service level that the system can provide is obtained.
1. Prepare the environment
- Install CentOS 7.4
- Install jdk 1.8
- Install mysql
yum install mysql*
- Install mariadb (on centos, mysql is replaced by mariadb?
- Start mariadb
systemctl start mariadb.service
can start mysql.
Check whether mysql is started: ps -ef | grep mysql
check port: netstat -anp | grep 3306
- Modify the root password of mysql
mysqladmin -u root password root
- Try to connect to the database
mysql -uroot -proot
show databases
use miaosha
show tables
- Import the sql file into the database
mysql -uroot -proot < //tmp/miaosha.sql
deploy:
- maven packaging
- Upload server, run
** Plug-in configuration file: ** The priority of the plug-in configuration file is higher.
- vim application.properties
Modify the plug-in configuration file
server.port=80
- java -jar miaosha.jar --spring.config.addiction-location=/var/www/miaosha/application.properties
Write startup script:
- vim deploy.sh
nohup java -Xms400m -Xmx400m -XX:NewSize=200m -XX:MaxNewSize=200m -jar miaosha.jar --spring.config.addition-location=/var/www/miaosha/application.properties
nohup: means even if the command is closed Do not stop the program running.
-
chmod -R 777 *
-
./deploy.sh &
-
tail nohup.out View log
2. Performance pressure test
After the project is completed, proceed before going online. Many performance bottlenecks can be found.
- New thread group
- Add-sampler-http request
Use a long connection to directly pressure test the corresponding interface. Prevent performance bottlenecks from appearing on http establishment.
- View the result tree
- Aggregate report
The average response time, 90% of the requests are responded within 10ms.
Three, find concurrent capacity problems
- ps -ef | grep java find the java process number
- pstree -p 9890 View the threads of the 9890 process
pstree -p 9890 | wc -l
- top -H View machine performance
The primary key is a clustered index by default, so the query speed is the fastest.