The problem of service suspended animation caused by redis in the case of one record concurrency

Problem Description

Recently, the project is doing performance pressure testing. The framework uses spring boot 2.1.2 + jedis 2.9.1. 80 concurrent continuous pressure testing takes 4-5 minutes and the service freezes. All requests are pending. Check the service log without any exceptions. Check that other interfaces that do not use redis can request normally.

Find problem ideas

  • Checked the connection configuration of redis, it is normal enough

  • Then use jstack to look at the stack information

insert image description here

I found a lot of WAITING threads, and looking down, they are all waiting caused by the getResource method of redis.

  • View the source code of redisJedis.java

    @Override
    public void close() {
         
          
          
        if (dataSource != null) {
         
          
          //1
            if (client.isBroken()) {
         
          
          
                this.dataSource.returnBrokenResource(this);
            } else {
         
          
          
                this.dataSource.
                        returnResource(this)

Guess you like

Origin blog.csdn.net/wagnteng/article/details/126585769