Page 1 of 1

Delay on startup

Posted: 31 Oct 2020, 23:20
by tropyw
Hey,
I have a multiplayer game using your platform (sfs 2x java extensions). When we restart the sfs server there is a delay with every action on the server. It happens because 300 users are trying to log back into the server in the same time.
My question is, why do all the server is starting to delay even if a user send a request to move in the room?
And what can I do to fix it (without having to move the db into the same local network)?
P.S: After everyone are logged in, there is no delay and everything is fine.
Thanks.

Re: Delay on startup

Posted: 01 Nov 2020, 14:38
by Lapo
Hi,
if the DB is not in the same local network that is indeed a problem. Because of the extra latency that is added to the communication.
When hundreds of clients are connecting at once and hit the database there will be necessarily delays, because it creates a bottleneck and requests will wait in line (partially at least).

A temporary solution is to add more threads to the Extension Thread pool (the one running your custom Extension code) so that it executes as many concurrent requests as possible.

Why is it temporary? Because this is not a scalable solution. You can't just keep adding threads to solve the bottleneck issue: at some point when the traffic scales up this solution will not help performance, but rather hinder it. (depending on the hardware specs of your machine)
A better approach is to bring the two servers in the same local network, thus removing the extra latency.

Anyways, you can configure the Extension Controller pool from the AdminTool > Server Configurator > Thread Pools
Under "core threads" you can set a value between 100-150 and then make sure the "Prestart core threads" is active. Save and restart.

Hope it helps

Re: Delay on startup

Posted: 10 Dec 2024, 11:47
by Moonshine-ashish
Hi Lapo,
Can we enable prestart core threads flag from the server.xml?

Re: Delay on startup

Posted: 10 Dec 2024, 16:50
by Lapo
Yes,
you can set the <prestartCoreThreads> value to true.

We always recommend to do this via the AdminTool rather than editing the XML directly to avoid issues, especially if you apply some changes and restart the server later. If there's any syntax error the server will crash on the next startup.

Cheers