Delay on startup

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

Post Reply
tropyw
Posts: 26
Joined: 23 Jul 2020, 16:52
Contact:

Delay on startup

Post 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.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Delay on startup

Post 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
Lapo
--
gotoAndPlay()
...addicted to flash games
Moonshine-ashish
Posts: 7
Joined: 21 Feb 2023, 13:07

Re: Delay on startup

Post by Moonshine-ashish »

Hi Lapo,
Can we enable prestart core threads flag from the server.xml?
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Delay on startup

Post 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
Lapo
--
gotoAndPlay()
...addicted to flash games
Post Reply