[英]Apache keeps an active worker for each WebSocket connection
Having Apache (2.4.29) configured as reverse proxy for WebSocket requests with mod-proxy-wstunnel
: 使用mod-proxy-wstunnel
Apache(2.4.29)配置为WebSocket请求的反向代理:
ProxyPass "/myapp/ws" "ws://localhost:8080/myapp/ws"
For each active WebSocket client, I see an Apache worker that remains active (in "Sending Reply" status) as long as this client is kept alive even if there is no data being sent. 对于每个活动的WebSocket客户端,即使没有发送任何数据,只要该客户端保持活动状态,我都会看到一个Apache工作进程保持活动状态(“发送回复”状态)。 In practice it means I cannot scale WebSocket clients because all available connections are consumed. 实际上,这意味着我无法扩展WebSocket客户端,因为消耗了所有可用的连接。
In /server-status there is one line like this for each client: 在/ server-status中,每个客户端都有一行这样的内容:
Srv PID Acc M CPU SS Req Conn Child Slot Client Protocol VHost Request
0-0 10219 0/43/43 _ 1.04 1828 984237 0.0 0.09 0.09 ::1 http/1.1 butler.openbravo.com:443 GET /myapp/ws/helloWs HTTP/1.1
Using different mpm
configurations (tested with event, worker and prefork) has no effect on this. 使用不同的mpm
配置(经过事件,工作程序和prefork测试)对此没有影响。
I would need Apache to be able to reuse these workers when they are sitting idle (no transferring any data) in order to be able to scale it. 我需要Apache能够在这些工人闲置(不传输任何数据)时重用它们,以便对其进行扩展。 Is it possible? 可能吗?
No, it's not currently possible to multiplex websockets connections this way. 不,目前无法以这种方式多路复用websockets连接。
In httpd trunk (2.5.x) there are experimental options to allow these connections to go asynchronous after idle for some time. 在httpd主干(2.5.x)中,有实验性的选项可让这些连接在空闲一段时间后变为异步状态。 But it is unlikely to be something that would be backported to 2.4.x and there is not really a stable 2.6.x on the horizon at the moment. 但是不太可能会被移植到2.4.x,并且目前还没有稳定的2.6.x。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.