-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Closed
Description
I am running a multi-node server (16 workers running Socket.io 1.0.6; accessed via Nginx, configured as a reverse proxy supporting sticky sessions) for ~ 5k users. While the load of the server is low (23 on a 20 core server / 2k users), everyone is able to connect instantly. When the load of the server gets higher (56 / 5k users), new users are not able to connect and receive data instantly. In this case, it takes 2~4 handshakes for the users to connect succesfully.
This is what happens (high load):
- User opens the website; receives HTML and JS
- User's browser attempts to initialize a socket.io connection to the server (
io.connect(...)
) - A handshake request is sent to the server, the server responds with a SID and other information (
{"sid":"f-re6ABU3Si4pmyWADCx","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":60000}
) - The client initiates a polling-request, including this SID:
GET .../socket.io/?EIO=2&transport=polling&t=1408648886249-1&sid=f-re6ABU3Si4pmyWADCx
- Instead of sending data, the server responds with 400 Bad Request:
{"code":1,"message":"Session ID unknown"}
- The client performs a new handshake (
GET .../socket.io/?EIO=2&transport=polling&t=1408648888050-3
, notice the previously received SID is omitted) - The server responds with new connection data, including a new SID: (
{"sid":"DdRxn2gv6vrtZOBiAEAS","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":60000}
) - The client performs a new polling request, including the new SID:
GET .../socket.io/?EIO=2&transport=polling&t=1408648888097-4&sid=DdRxn2gv6vrtZOBiAEAS
- The server responds with the data that is
emit
ted in the worker source code.
Depending on the load of the server, it may happen 1~3 times that the server responds with "Session ID unknown"
and the client needs to perform a new handshake before data is actually received.
SWBennett06, vineetsingh5, pito-svk, valgussev, mismith and 5 more
Metadata
Metadata
Assignees
Labels
No labels