Server Task Scheduler thread pool size

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

Moderators: Lapo, Bax

User avatar
rewb0rn
Posts: 174
Joined: 26 Jan 2009, 12:54
Location: Berlin, Germany

Server Task Scheduler thread pool size

Postby rewb0rn » 02 Dec 2019, 14:43

Hello,

I noticed in the admin tool under Server Configurater -> General the setting "Server Task Scheduler thread pool size". Is this used by the smarfox internally for any tasks or is it just an API that the developer can use?

I am asking since we have configured the pool sizes for System thread pools and Extension thread pools under "Thread Pools", but not this one and I am wondering if it could become a bottleneck for us.

Thanks in advance
User avatar
Lapo
Site Admin
Posts: 21124
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Server Task Scheduler thread pool size

Postby Lapo » 03 Dec 2019, 09:25

rewb0rn wrote:Hello,

I noticed in the admin tool under Server Configurater -> General the setting "Server Task Scheduler thread pool size". Is this used by the smarfox internally for any tasks or is it just an API that the developer can use?

Yes absolutely, you can use it to add your own tasks.
See here --> https://smartfoxserver.com/blog/how-to- ... extension/
You can get a reference to the global Scheduler via

Code: Select all

SmartFoxServer.getInstance().getTaskScheduler()

or, even simpler:

Code: Select all

getApi().getSystemkScheduler()

when you are inside your Extension or one of its event/request handlers.

I am asking since we have configured the pool sizes for System thread pools and Extension thread pools under "Thread Pools", but not this one and I am wondering if it could become a bottleneck for us.

Normally, 3-4 threads are enough to run dozens, even hundreds of small tasks. If, on the other hand, your Tasks are computationally heavy or rely on slow I/O you should probably create a dedicated Scheduler.

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
rewb0rn
Posts: 174
Joined: 26 Jan 2009, 12:54
Location: Berlin, Germany

Re: Server Task Scheduler thread pool size

Postby rewb0rn » 05 Dec 2019, 16:00

Hey Lapo,

thanks for the response. By default, is the task scheduler used for any internal tasks by the smartfox itself? Or will it stay empty until we start to add tasks to it?

Thanks
User avatar
Lapo
Site Admin
Posts: 21124
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Server Task Scheduler thread pool size

Postby Lapo » 05 Dec 2019, 17:16

Yes it is used by a couple of internal tasks, such as the process that disconnects idle users.
Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 23 guests