Performance problems of httpclient calling third-party api

there is a project in which most businesses are implemented through the third-party api called by httpclient. However, it is found that some business pages are displayed quickly and sometimes slowly. After reproduction, it is found that there are two main scenarios:
1. After opening a page quickly, staying on the page for a period of time and refreshing the current page, it will load very slowly.
2. Open a page very quickly, push to the previous page, and then load slowly.
3. It is slow to open directly.

after log analysis, it is found that
1, whether the third-party api or your own project code, executes quickly;
2, there is no complex page, there is no rendering time-consuming problem;

The problem with the final positioning of

is that
calls a third-party api using httpclient, sometimes in milliseconds and sometimes in 5-8 seconds, resulting in a delay in the return of data on the page.

the details are as follows:

at present, I think there may be a problem with httpclient establishing a tcp connection to nginx, but it is not possible to determine what the problem is

Mar.12,2021
Menu