Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Load Balancer retrying the request on web server after timeout expires

We are using Google Load Balancer with Tomcat Server. We have kept a specific timeout on load balancer from cloud console setting portal. Whenever any request takes more than the timeout time, GLB returns 502 i.e expected.

Here the problem is -

  1. Whenever the request takes more than the given time, on tomcat side we are getting the same request again exactly after the timeout e.g when we have the timeout as 30 sec we got the same request on tomcat exactly after 30 sec.
  2. On browser the response time for 502 is exactly twice of the timeout time. (It might be because of network turn around time but why always exact twice)
like image 551
ZINDA ROBOT Avatar asked Apr 11 '18 12:04

ZINDA ROBOT


People also ask

How long to wait for the backend service to respond before considering it a failed request?

The default timeout for Google HTTPS Load Balancers is 30 seconds for the backend to respond before considering it a failed request. For normal HTTP GET requests, 30 seconds should be plenty of time.

Does Google use load balancer?

Google Cloud offers the following load balancing features: Single anycast IP address. With Cloud Load Balancing, a single anycast IP address is the frontend for all of your backend instances in regions around the world.

Is a load balancer a server?

A load balancer is a device that acts as a reverse proxy and distributes network or application traffic across a number of servers. Load balancers are used to increase capacity (concurrent users) and reliability of applications.


1 Answers

I assume you are referring to HTTP(S) load balancing. In this scenario, a reverse proxy is sitting in front of your application, handling requests and forwarding them to your backends. This proxy (a GFE) will retry as documented:

HTTP(S) load balancing retries failed GET requests in certain circumstances, such as when the response timeout is exhausted. It does not retry failed POST requests. Retries are limited to two attempts. Retried requests only generate one log entry for the final response. Refer to Logging for more information.

like image 65
mensi Avatar answered Oct 10 '22 08:10

mensi