CPU Usage jumps and Game Update stops pool-1-thread-4

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

Moderators: Lapo, Bax

Zenith
Posts: 29
Joined: 09 Oct 2017, 09:57

CPU Usage jumps and Game Update stops pool-1-thread-4

Postby Zenith » 25 Oct 2017, 20:26

Hi,

I have been developing a tower defense type game where server is sending updates about game state every 1 second as of now to the clients.

There are only two clients as of now.

What's happening is when I am testing it on my pc running SFS on localhost, after some time the CPU usage suddenly jumps from 1.5% to 25% and it basically stops sending updates.

The main process shown in sfs admin panel is pool-1-thread-4 or pool-1-thread-3 which I guess is the main scheduler thread?

I wonder if this is something wrong in my server code or just that my PC trying to kill sfs ?

Attaching image of admin panel . Hope this helps to identify the issue .
Image
User avatar
Lapo
Site Admin
Posts: 20040
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: CPU Usage jumps and Game Update stops pool-1-thread-4

Postby Lapo » 26 Oct 2017, 07:01

Hi,
it looks weird indeed. There's also a lot of system activity from other processes (the cyan graph in the CPU monitor), maybe you're running the clients on the same PC?

In any case it sounds like an issue with your server side code. Can you describe what your server code does in broad terms?
You mentioned using the Scheduler(s). Can you tell me more about your use case?

I would recommend to try and reproduce the problem again and when the server becomes unresponsive again take also a screenshot of the "Message queues status" tab in the AdminTool.

If that's not enough we can grab a thread dump from the server too, to see the state of all threads:
viewtopic.php?f=18&t=14458

Let us know
Lapo
--
gotoAndPlay()
...addicted to flash games
Zenith
Posts: 29
Joined: 09 Oct 2017, 09:57

Re: CPU Usage jumps and Game Update stops pool-1-thread-4

Postby Zenith » 26 Oct 2017, 07:18

Lapo wrote:Hi,
it looks weird indeed. There's also a lot of system activity from other processes (the cyan graph in the CPU monitor), maybe you're running the clients on the same PC?

In any case it sounds like an issue with your server side code. Can you describe what your server code does in broad terms?
You mentioned using the Scheduler(s). Can you tell me more about your use case?

I would recommend to try and reproduce the problem again and when the server becomes unresponsive again take also a screenshot of the "Message queues status" tab in the AdminTool.

If that's not enough we can grab a thread dump from the server too, to see the state of all threads:
viewtopic.php?f=18&t=14458

Let us know


Yes I am running the client on same PC to test out .

My Serverside code:
The client sends request to create a unit at some location. Then server does astar pathfinding for the newly created client to make it move towards nearest enemy unit.
This proceeds as client keeps requesting for more units. So it goes down at around 30 units.

The scheduler is running every 50 seconds to get path for all units and then send it to the client. Currently the scheduler process is completing within like 100 ms. But in that last time it gets stuck and never completes. I wonder if it can be somehow the pathfinding is getting stuck?

Update: Okay I did extensive debugging and got to know the error, My pathfinding code was giving error when unit was blocked from all sides. It is working fine now.
Thanks! Can I know how any executor threads should i keep in zoneserver settings to keep up with game.
What are the cases when I should or should not increase executor threads.
User avatar
Lapo
Site Admin
Posts: 20040
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: CPU Usage jumps and Game Update stops pool-1-thread-4

Postby Lapo » 26 Oct 2017, 09:46

The Extension threads rarely need to be tweaked because they use auto-load balancing, so they are added and removed when necessary.
In some cases you may simply need to allow for more threads to be auto-created, but this is usually only needed when you have 100s of slow operations running at the same time (such as slow I/O)

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 6 guests