A spring boot web service response slow investigation

  Use spring boot set up a web service, deployed in the docker container. Arising from the use of a performance problem: multiple interface requests, the occasional case of a very slow response occurs. The interface response time in 10-20ms, occasionally more than once 3s response will appear under normal circumstances. Here is one of their own investigation process

  1. Verify that the local development environment.

  The first consideration is to identify the problems in the local development environment. After testing, the local did not have this problem.

  2, database optimization.

  Taking into account local development environment and database deployment of different versions. By indexing, query optimization program, database queries were optimized. However, the problem remains.

  3, adding a detailed log, location problem

  The first consideration is the business code may be a problem by analyzing the log and found that the business is not the slow response code, but the code spring boot framework. In major consuming filters and interceptors.

  4, add gc log

  Consideration may be due to a period of time there will be a gc, the interface is the occasional case of a slow response, speculation that the two might be related. By logging found that when slow response does not necessarily appear gc, gc and each time is very short, in ms level.

  5, the servlet container replacement

  spring boot built a number of servlet container, is used by default tomcat. From the point of view positioned above the log, servlet containers may be the main reason. After tomcat into the undertow, the problem is resolved, the response time is fixed at 10-20ms range.

  6. Why tomcat having this problem, but also need follow-up analysis

Guess you like

Origin www.cnblogs.com/lilinwei340/p/11751846.html