Writing in the front

There are a lot of pressure testing tools, developers how to do a good job of unit code pressure test, here I introduce a pressure testing tool provided by Taobao, developers are very convenient for pressure testing

code

The pom.xml file imports packages

< the dependency > < groupId > com. Taobao. Stresstester < / groupId > < artifactId > stresstester < / artifactId > < version > 1.0 < / version >

Write test code

/** * @Title: PressTest * @Description: Stress tests, @return void return type @throws */ @test public void PressTest(){int concurrencyLevel =100; Int totalRequest = 1000; / / the total number of requests StressResult result = StressTestUtils. Test (concurrencyLevel totalRequest, new StressTask() { @Override public Object doTask() throws Exception { getUserDetail(); Return “”; }}); System.out.println(StressTestUtils.format(result)); }

The test results

The test results in the figure above are obviously problematic, the long request is more than 3 seconds, which is unacceptable. Through analysis, it is found that the connection pool setting is too small, the database connection is too small, and the concurrency is too large, which leads to the request blocking waiting resources. Optimization method: increase the number of connection pool threads, increase the number of database connections

Actual combat Project Introduction

Project Introduction:

In order to meet the requirements of Java novice friends course, I special this tutorial, due to the time of the problem, the code is not good place also please forgive.

The target is as follows

  1. Optimization of low efficiency of wordpress (the current number of blog posts is about 100,000 +)
  2. Let the group of primary Java friends faster start springBoot application

GIT address: gitee.com/jxuasea/JWo…