AWS ELB Servlet客户端断开连接检测 [英] AWS ELB servlet client disconnection detection

查看:135
本文介绍了AWS ELB Servlet客户端断开连接检测的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

免责声明:关于类似主题,有很多信息.在我们的情况下,它在没有AWS ELB(弹性负载平衡器)的情况下可以正常工作,即,当客户端断开时,ServletOutputStream.flush()会引发IOException.

Disclaimer: there is a lot of information on similar topics. In our case it works as expected without AWS ELB (Elastic Load Balancer), i.e. when the client drops, ServletOutputStream.flush() throws IOException.

设置:我们有一个实例,该实例在ELB(HTTPS:443-> HTTP:8080)后面运行Tomcat 7(Java 1.7). Servlet通过HTTP长期连接将数据流传输到客户端.

Setup: we have an instance running Tomcat 7 (Java 1.7) behind ELB (HTTPS:443 -> HTTP:8080). The servlet streams data to the client through HTTP long lived connection.

问题:当客户端断开连接时,服务器将保留流数据,即ServletOutputStream.flush()或.write()不会引发IOException. ELB可以缓冲"连接(我们可以通过IpTraf监视器看到它),因此从Tomcat方面看,它仍然是客户端存在的地方.如果没有ELB,则会正确引发IOException,因此servlet可以停止流传输.我们已禁用连接排空并将连接超时减少到1秒,并且还将Tomcat的HTTP连接器上的所有超时(包括KeepAlive)减少到了几秒钟.没有任何帮助.

Problem: when the client disconnects, the server keeps streaming data, i.e. ServletOutputStream.flush() or .write() does not throw IOException. The ELB kind of "buffers" the connection (we can see it with IpTraf monitor), so from the Tomcat side it appears as the client is still there. Without the ELB, IOException is thrown properly, so the servlet can stop streaming. We have disabled connection draining and reduced connection timeout to 1 sec, we also reduced all timeouts on Tomcat's HTTP Connector including KeepAlive to just few seconds. Nothing helps.

问题:我们可以通过ELB配置/Tomcat/Java端进行任何操作以允许在此设置中进行断开连接检测吗?

Question: is there anything we can do with the ELB configuration / Tomcat / Java side to allow disconnection detection in this setup?

推荐答案

我们遇到了同样的问题(但在带有IIS的.NET中). 通过从经典ELB切换到应用ELB,我们似乎已经解决了该问题.现在,写入封闭连接的输出流会产生一个异常,首先(在经典ELB上)没有.

We had the same kind of problem (but in .NET with IIS). We seem to have solved it by switching from the classic ELB to the Application ELB. Now writing to the output stream of a closed connection gives an exception, where first (on classic ELB) it didn't.

希望这可以帮助遇到相同问题的任何人

Hope this helps anyone running into the same problem

这篇关于AWS ELB Servlet客户端断开连接检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆