问题描述
我有带有4个IIS 10 Web服务器的GCP负载平衡器.偶尔会出现 502-服务器错误.在日志中显示它是由于 backend_connection_closed_before_data_sent_to_client 引起的.我已阅读文章 https://cloud.google.com/compute /docs/load-balancing/http/,它表示nginx和apache的keepalive timout需要设置为620秒.如何在IIS 10中执行相同的操作.
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.
推荐答案
在筹集到票务后,谷歌云团队解决了这个问题.我把它放在这里,以便其他人可以从中受益.
Figured this out after raising a ticket google cloud team. I am putting it here so that others can benefit.
步骤1:在Google Cloud Load Balancer中设置超时
Google云负载均衡器中有两个超时设置.
There are two timeout settings in Google cloud load balancer.
- 超时和
- 连接耗尽超时.
- Timeout and
- Connection draining timeout.
请参见下面的屏幕截图.
See the screenshot below.
以上两个设置都必须相同.在我们的例子中,有许多长时间运行的请求,并且将其设置为1800秒.
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.
步骤2:在IIS中将连接超时设置为比负载平衡器设置大20秒
在IIS站点名称下-转到高级设置,然后将连接超时值设置为比负载均衡器超时多20秒.以我的情况为1820.
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连接在负载均衡器之前不应该超时.如果超时,则可能导致 backend_connection_closed_before_data_sent_to_client 错误.
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.
这篇关于GCP负载平衡器502服务器错误和"backend_connection_closed_before_data_sent_to_client"和"IIS 10的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!