GCP load balancer 502 server error and “backend_co

2019-08-19 02:30发布

I have GCP load balancer with 4 IIS 10 web servers. Sporadically it comes with 502-Server error. In the logs it shows it is because of backend_connection_closed_before_data_sent_to_client. I have read thru the article https://cloud.google.com/compute/docs/load-balancing/http/ and it says keepalive timout need to be set to 620 seconds for nginx and apache. How do I do the same in IIS 10.

2条回答
别忘想泡老子
2楼-- · 2019-08-19 03:10

Figured this out after raising a ticket google cloud team. I am putting it here so that others can benefit.

Step 1 : Set the timeouts in Google Cloud Load Balancer

There are two timeout settings in Google cloud load balancer.

  1. Timeout and
  2. Connection draining timeout.

See the screenshot below. Load balancer settings

Both the above settings need to be the same. In our case, there are a number of long running requests and it is set to 1800 seconds.

Step 2: Set the connection timeout in IIS 20 second greater than the load balancer setting

Under IIS Site name - go to Advanced settings and then set the Connection Time-out value to 20 seconds more than the load balancer timeout. In my case 1820.

IIS Settings

The idea is that the IIS connection should not timeout before load balancer. If it times out then it may leads to backend_connection_closed_before_data_sent_to_client error.

查看更多
一纸荒年 Trace。
3楼-- · 2019-08-19 03:14

You can set this in web.config as execution time out attribute in http runtime by default when you set keep alive it sets time out to 120 seconds .If still doesn’t work then may be there is proxy server between your request response process . You have to check that proxy server time out.

I faced the same scenario in gcp and I have setted everything in load balancer level but did not work . Then I found that there was an proxy server between our process . Let me know if you can tell in more detail

查看更多
登录 后发表回答