search

Home  >  Q&A  >  body text

nginx - Regarding calling rest api, one third of the http requests failed and timed out.

The tomcat 8.0 server is used, nio mode. Others are default configurations.
Write an interface using rest of spring mvc, and then call it with resttemplate, through the connection pool implemented by httpclient. When 1,000 requests were made concurrently, some requests were found to have timed out. causing access failure. <But the application never hung up, because some requests timed out>.

The entire system architecture is like this
There are three applications A, B, and C
C is responsible for operating the database, providing interfaces, and returning JSON
B is responsible for processing business, providing interfaces, returning JSON, and calling C's interface, save/read data
A is responsible for the front desk, calling B's interface
When A calls B, complex balancing is done through nginx, and there are two B servers.

Excuse me, what are the situations that may cause timeout?

过去多啦不再A梦过去多啦不再A梦2782 days ago693

reply all(2)I'll reply

  • 習慣沉默

    習慣沉默2017-05-16 17:22:58

    B calls C to see if it is the database side.

    reply
    0
  • 仅有的幸福

    仅有的幸福2017-05-16 17:22:58

    First determine which step the problem is, and then analyze it in detail. You can print out the time consumption of each interface call

    reply
    0
  • Cancelreply