Delay seen between joinRoom and USER_JOIN_ROOM event
Posted: 17 Aug 2016, 20:11
We have a game that uses SF for matchmaking. Users connect and are kept in a lobby... and the server pulls people out of the queue and starts to put them into game rooms.
We create the room and then loop over the users to call joinRoom on the newly created room. When the server event USER_JOIN_ROOM fired for a particular user... we then send them a message telling them they are ready to move forward with other logic.
When we load the server up... I start to see a very large delay between adding a user to a room and seeing this event come back. With 200 simulated users on my laptop... I start to see a delay of 15 seconds for the event to come back. I did notice in another forum post that it was mentioned that you dont need to listen to the event if you are server side... that once you call the api to joinRoom... the user is already joined so dont need to handle. I tried sending the message to the user right after the joinRoom and all of a sudden I get errors like this:
The forum post that seemed to claim you dont need to wait for the event was here: viewtopic.php?t=15378
Assuming that I do need to wait for the event for the user to actually be officially joined to the room... what might be causing so much delay? The server is not pegged on CPU (10-20%?). Bandwidth isn't crazy... 3kbps on average? Sometimes spikes but never for more than a second. We also ran this on a full-blown server... it was showing similar behavior around 2000 users.
We create the room and then loop over the users to call joinRoom on the newly created room. When the server event USER_JOIN_ROOM fired for a particular user... we then send them a message telling them they are ready to move forward with other logic.
When we load the server up... I start to see a very large delay between adding a user to a room and seeing this event come back. With 200 simulated users on my laptop... I start to see a delay of 15 seconds for the event to come back. I did notice in another forum post that it was mentioned that you dont need to listen to the event if you are server side... that once you call the api to joinRoom... the user is already joined so dont need to handle. I tried sending the message to the user right after the joinRoom and all of a sudden I get errors like this:
Code: Select all
17 Aug 2016 | 12:53:31,111 | WARN | SFSWorker:Ext:3 | controllers.v290.ExtensionReqController | | com.smartfoxserver.v2.exceptions.SFSExtensionException: Extension Request refused. Sender is not a User: { Id: 163, Type: DEFAULT, Logged: No, IP: 10.1.1.1:58426 }
com.smartfoxserver.v2.controllers.v290.ExtensionReqController.processRequest(ExtensionReqController.java:93)
com.smartfoxserver.v2.controllers.v290.ExtensionReqController$1.run(ExtensionReqController.java:68)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
The forum post that seemed to claim you dont need to wait for the event was here: viewtopic.php?t=15378
Assuming that I do need to wait for the event for the user to actually be officially joined to the room... what might be causing so much delay? The server is not pegged on CPU (10-20%?). Bandwidth isn't crazy... 3kbps on average? Sometimes spikes but never for more than a second. We also ran this on a full-blown server... it was showing similar behavior around 2000 users.