Load Balancing ---> nginx -----> Application The app is one ...">

Is the request "lost" if nginx sends error 499?

Here architecture

Client ----> Load Balancing ---> nginx -----> Application

The app is one way and synchronous (no asynchronous things)

Load balancer and nginx both have 60 seconds timeout

The app only has one endpoint which takes 10 seconds to process (when called directly to the app), when there is no traffic, curl through Loadbalancer also takes 10 seconds (which is fine)

Now under high load, we see a lot of 499 in nginx logs related to 60 ~ x response times.

My current hypothesis

  • 10 requests come ahead of loadbalancer
  • LB redirects 10 requests to nginx and starts its own timer for 10
  • Nginx confirms that 10 requests start a timer for 10 and proxy 1 for the application and 9 others are waiting
  • completion of the first request, nginx forward response 200, time taken 10 seconds for nginx and LB
  • nginx now sends 2nd request to app, it takes 10 seconds.
  • nginx receives 200 response, time: 20 seconds for nginx and LB
  • Third request => 30 seconds, 4th request => 40 seconds
  • 6th request is accepted by BUT TOO LATE app, LB closes the connection, timeout
  • nginx see closed connection and 499 answer
  • the same for the 7th, 8th and 9th requests, which all appear with a response time of 60 seconds

Now my questions are:

  • As far as I understand, what's going on right?
  • Is the 6th request fully processed by the application?
  • Are the 7th requests above that will be processed by the application, or will the application never know that there is a 7th or more request?
+3


source to share





All Articles