Amazon ELB + EC2 标头不匹配

Amazon ELB + EC2 标头不匹配

序言:
我在单个 Amazon EC2 实例前面有一个 AWS Elastic Load Balancer。
我有另外 3 个 EC2 实例通过 curl 向负载均衡器发送请求。
直接向 EC2 ip 发出请求具有稳定的响应时间和可接受的速度。
向 ELB 发出的请求平均响应时间较长,速度不太理想。

我的观察与此几乎相同:https://forums.aws.amazon.com/thread.jspa?messageID=419138

"ELB's backend requests to the EC2 instance expect to be on HTTP 1.1 keep-alive connections. The instance/server needs to either support keep-alive connections OR explicitly return response headers to ELB that note the connection is closed.

Not returning that header and also not keeping alive the connection on the server results in ELB thinking the connection has been kept alive, waiting for ~30 seconds, and then retrying at that point with a new connection (hence the quick response times on the server, but slow perceived latency outside the ELB)."

我的问题:
从 ELB 转储响应标头时,它仍然具有 keep-alive 标头。
直接从 EC2 实例转储响应标头时,它具有Connection: close

在浏览 ELB 实例时,我仍然遇到上述线程中提到的高度可变的速度/延迟,但据我所知,我已明确将"Connection: close"标头从 EC2 实例发送回 ELB。

任何见解都将不胜感激。

相关内容