GCP load balancer 502 server error and “backend_connection_closed_before_data_sent_to_client” IIS 10

时光总嘲笑我的痴心妄想 提交于 2019-12-11 15:53:29

问题


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.


回答1:


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.

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.

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.




回答2:


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



来源:https://stackoverflow.com/questions/50020779/gcp-load-balancer-502-server-error-and-backend-connection-closed-before-data-se

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!