[Performance Test] CPU problem location and analysis + thread blocking case analysis, one article directly on the high speed…

Table of Contents: Introduction

    • Preface
    • 1. Python programming from entry to proficiency
    • 2. Practical implementation of interface automation projects
    • 3. Web automation project actual combat
    • 4. Practical implementation of App automation project
    • 5. Resumes of first-tier manufacturers
    • 6. Test and develop DevOps system
    • 7. Commonly used automated testing tools
    • 8. JMeter performance test
    • 9. Summary (little surprise at the end)

Foreword

CPU problem location and analysis

1. Environment preparation

1) Prepare stress test script

Please add image description

2) Upload to the stress testing server

2. Phenomenon analysis

1) Business indicator analysis

Please add image description

2) System resource analysis

Please add image description

3. Problem location

1) Open jprofiler to view CPU views-Call Tree/Host Spots, and view the functions with the highest CPU usage

2) Download the code and view it with a decompilation tool. Google’s serialized gjson is used, resulting in high CPU usage.

4. Optimization issues

1) Modify the serialization component to Alibaba’s fastjson

2) Optimize effect display

Please add image description

Please add image description

Thread blocking case analysis

1. Jstack print snapshot

1) Jmeter runs the stress test script

Please add image description

2) Use jstack to print the snapshot and download it locally

jstack 112759 > log1.txt
jstack 112759 > log2.txt
jstack 112759 > log3.txt

Please add image description

3) Search locally for blocked keywords

2. Analyze the code

1) Download the source code file

cn.testfan.perf.beihe.pinter.http.CaseController.block(CaseController.java:60)

According to the prompts, find the path of casecontrokker

/usr/src/tomcat-pinter/webapps/pinter/WEB-INF/classes/cn/testfan/perf/beihe/pinter/http

Please add image description

2) Analyze code errors

Open jd-gui to view 60 lines of source code

It is found that there is no locking representation: synchronized, but this line calls the loger method

3) Download the log4j file

Path: /usr/src/tomcat-pinter/webapps/pinter/WEB-INF/lib

Please add image description

Download this file to local

According to the prompt path:

at org.apache.log4j.Category.callAppenders(Category.java:204)

3. Optimize code

Adjust log4j log level

1) Find the log4j log configuration file

Path: /usr/src/tomcat-pinter/webapps/pinter/WEB-INF/classes

Please add image description

2) Adjust log level

vi log4j.properties

Increase log level to ERROR

Please add image description

The following is the most comprehensive software testing engineer learning knowledge architecture system diagram I compiled in 2023

1. Getting started with Python programming to becoming proficient

Please add image description

2. Practical implementation of interface automation project

Please add image description

3. Web automation project practice

Please add image description

4. App automation project practice

Please add image description

5. Resumes of first-tier manufacturers

Please add image description

6. Test and develop DevOps system

Please add image description

7. Commonly used automated testing tools

Please add image description

8. JMeter performance test

Please add image description

9. Summary (little surprise at the end)

Even in the darkest nights, never forget the fire burning inside you. As long as you have firm belief and unyielding determination, nothing can stop you from moving forward. come on!

As long as you have a dream in your heart, everything is possible. Every challenge is an opportunity for growth. Believe in yourself and pursue your dreams bravely. Your future is limitless.

Life is short, don’t waste time worrying about the unknown tomorrow, but make full use of today to realize your dreams. Every small step is an accumulation of success. If you stick to it, you will definitely reach your goal.