Sockjs / socketio disables apache proxy latency

I need to handle users by disconnecting from my sockjs app running in XP polling mode . When I connect to localhost, everything works as expected. When I install apache between nodejs and the browser, I get ~ 20 seconds delay between the closed browser and the event being disabled inside nodejs. My apache proxy configuration is as follows:

<Location />
  ProxyPass http://127.0.0.1:8080/
  ProxyPassReverse http://127.0.0.1:8080/
</Location>

The rest of the file is by default, you can see here . I tried playing with the parameters ttl = 2 and timeout = 2, but nothing changes, or I get reconnection every 2 seconds without closing the browser. How can I reduce the extra shutdown timeout introduced, but apache, somewhere by default?

+4
source share
2 answers

Perhaps your Apache server is configured to use HTTP Keep Alive , which will maintain a constant connection. In this case, I will try to disable KeepAliveor omit the parameter KeepAliveTimeoutin your Apache configuration to make sure that this solves the problem.

If this does not work, I will also look netstatand see what the status of each socket is and start analyzing the root causes. This diagram provides a TCP state machine and can tell you where each connection is located. Wireshark can also provide you with some information about what is happening.

+1

,

<client> ---> apache ---> <node.js>

<client> -X-> apache ---> <node.js>

Apache .

ProxyTimeout

apache

ProxyTimeout 10

10 , 10 ,

Ping

- ping-

pingTimeout (Number): pong (60000)

pingInterval (Number): ping (25000).

var io = require('socket.io')(server, { 'transports': ['polling'], pingTimeout: 5000, pingInterval: 2500});

, 5 , ,

, , , , , socket.io, socket.io

0

Source: https://habr.com/ru/post/1677606/


All Articles