Home > Back-end >  Low springboot redis concurrent 2000 QPS
Low springboot redis concurrent 2000 QPS

Time:12-06

1. Do a project, involved in the performance of pressure measurement, the architecture for springboot + redis, in order to improve query performance, by the previous check instead of library cache,

Use redis lettuce, to operate redis, lettuce configuration as shown in figure:

Spring:

# redis

Redis:

Isopen: true

The database: 0

Host: 127.0.0.1

Port: 6379

Lettuce:

The pool:

Max - active: - 1

Max - wait: 100

Max - idle: 8

Min - idle: 0

Timeout: 5000

Redis in place ahead of a data, access to the cache, the controller code is as follows:

@ CrossOrigin

@ GetMapping (value="https://bbs.csdn.net/handle", produces="application/json; Charset=utf-8 ")

@ ResponseBody

Public StringqueryHandle (@ RequestParam (value="https://bbs.csdn.net/topics/identity") String handleIdentity) throws JSONException {

If (isCache & amp; & RedisUtil. The exists (handleIdentity)) {

Return redisUtil. Get (handleIdentity). The toString ();

}

RedisUtil. The get method is as follows:

Public Object get (String key) {

The return key==null? Null: redisTemplate opsForValue (). The get (key);

}

Use jmeter performance testing, in 2000, concurrent circulation under the condition of 10 times, the result is shown in figure, poor performance unexpectedly, have a great god can teach, what causes such a poor performance, the single machine is not in tens of thousands of so-called QPS redis?




CodePudding user response:

This is on your computer you open your computer run jmeter test project

CodePudding user response:

Yes, but put jemter server after the test, the result is similar, the difference is not big,

CodePudding user response:

How much is left hardware resources, CPU run with no
Tomcat on running? Tomcat tuning?
Handle the number? Additional pressure measuring machine running bandwidth with no CPU

CodePudding user response:

great god

CodePudding user response:

Sorry I was to mix

CodePudding user response:

You on the server to run jmeter error rate is 100%, you first look at what is wrong,

And performance under the pressure test method the best attention, if you want to pressure test, first of all, need to how much test scripts run TPS, then the script directly manipulate Redis TPS, finally, is the call of your Spring run the Boot interface, so that you will find, may be your CPU or memory resources shortage, lead to TPS,

And testing Java programs, especially the Spring program, to preheat , because the JVM hierarchical optimization, C1 and C2 optimizer requires code is running will be optimized for many times, you are through the interpreter code will only be performed by a machine, is not directly executable machine code, differential speed a lot, and Spring loaded when starting a lot of things can lead to codecache need to clean up, clean up when STW, and Spring the Boot of the Controller is the first run the Dispatcher lazy loading, need dynamic loading, so be sure to preheat, you on the server to run Jmeter, a total of 2000 times, C1 to optimize the default code to be executed more than 5000 times,

CodePudding user response:

Single machine can do 2000 concurrent yao... You did this tomcat thread pool size adjustment
  • Related