pool-1-thread-2 CPU time goes very high

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

Moderators: Lapo, Bax

moonlife
Posts: 45
Joined: 26 Sep 2016, 08:22

pool-1-thread-2 CPU time goes very high

Postby moonlife » 09 Jul 2021, 11:14

Our online multiplayer game works as expected, but after 5-10 days, CPU time of some pool threads starts to grow, Memory Usage graph looks unnatural, and in time it causes our game to freeze. We are restarting our server when it happens, and everything starts to act normal again. But we don't want to restart our servers often, because our game goes down for 5-10 minutes evertime when we do that.

How can we detect why CPU Time of these pool threads increase in time, and how can we reduce them?
Attachments
poolthread.png
(195.17 KiB) Not downloaded yet
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: pool-1-thread-2 CPU time goes very high

Postby Lapo » 09 Jul 2021, 14:41

Hi,
the server works perfectly fine. The CPU usage is very low: you must look at the CPU graph, which tells you that the CPU usage is less than 4% most of the time.

The thread table simply tells you which threads are working the most. In other words the thread at 72% is the one responsible for 72% of the global CPU usage, which is 3.75.

Bottom line: the server is using very little CPU resources and there's nothing to worry about.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
moonlife
Posts: 45
Joined: 26 Sep 2016, 08:22

Re: pool-1-thread-2 CPU time goes very high

Postby moonlife » 20 Jul 2021, 08:45

Sometimes game starts to freeze in some rooms after server runs for several days, we thought the cause is some memory leaks at start, but looks like the reason is somewhere else. I didn't want to create another thread for that, becuase I'm still seeking to find out why my game starts to act unnatural when my server runs longer than a few days.

For example, our game froze in some rooms tonight. Extension didn't respond for a minute. Hundreds of these type of error messages are written to smartfox.log by that period:

Code: Select all

20 Jul 2021 | 01:41:21,572 | ERROR | SFSWorker:Ext:3 | controllers.v290.ExtensionReqController |     | java.lang.NullPointerException:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Exception: java.lang.NullPointerException
Message: *** Null ***
Description: Error while handling client request in extension: { Ext: GameExtension, Type: JAVA, Lev: ZONE, { Zone: game}, {} }
Extension Cmd: hand_strength
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Code: Select all

20 Jul 2021 | 01:41:21,670 | INFO  | pool-1-thread-4 | Extensions |     | {null}: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. Query:INSERT INTO TABLE(col1, col2) VALUES(?, ?)


How can we detect the reason of this behavior?
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: pool-1-thread-2 CPU time goes very high

Postby Lapo » 20 Jul 2021, 09:46

Hi,
the problem above is typically resolved by modifying the MySQL config.
Take a look at this previous post:
viewtopic.php?t=17388

The solution is to comment out the skip_networking rule.

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
moonlife
Posts: 45
Joined: 26 Sep 2016, 08:22

Re: pool-1-thread-2 CPU time goes very high

Postby moonlife » 20 Jul 2021, 10:47

Thank you for your quick response.

There is no skip_networking rule in my my.cnf file, but there is skip_external_locking rule. Shall I comment it out? May it cause this issue?

Here is my full my.cnf:

Code: Select all

[mysqld]
disable-log-bin=1
default-authentication-plugin=mysql_native_password
default-storage-engine = MyISAM
innodb_file_per_table = 1
performance-schema = 0
max_allowed_packet = 268435456
open_files_limit = 10000

skip_external_locking

max_connections = 4096
key_buffer_size = 512M
innodb_buffer_pool_size = 512M
innodb_log_file_size = 256M

table_open_cache=3000
skip-host-cache

sql_mode=""

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

slow_query_log=1
slow_query_log_file="/var/log/mysql/mysql_slowquery.log"
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: pool-1-thread-2 CPU time goes very high

Postby Lapo » 20 Jul 2021, 11:10

Shall I comment it out? May it cause this issue?

No, that's not the same parameter so I wouldn't recommend changing it. It's also unrelated with the issue you have reported.

Since this is most likely a MySQL issue I can suggest to take a look at this topic on StackOverflow:
https://stackoverflow.com/questions/686 ... -and-mysql

In the first answer they suggest a number of settings and things to check to avoid the problem.

Let us know if it helps.
Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 39 guests