Posts: 418
Threads: 25
Joined: Feb 2009
Reputation:
0
Just as the thread title says, the CPU usage gradually increases over time and even faster when people are on. Within 24 hours, I sometimes hit 100% and movements desync so vehicles and people look like they're just sliding from one position to another. I got 6 timers running, 4 of those are in 1000ms and I use MySQL. Any idea how to fix this guys? Thanks in advance!
Posts: 104
Threads: 12
Joined: Sep 2011
Reputation:
0
What type of server is it ? how much ram does it have to use ?
Posts: 617
Threads: 6
Joined: Oct 2011
Reputation:
0
sometimes it's your host as well so you gotta watch out. I remember serverFFS reading my server of taking up almost 2 duel cores yet once I moved to my very own dedicated server even updating the CPU usage every second I never used more than 5% on a 3.2GHz Duel Core with the same player amount of 250 around. But anyways timers depend like you got 6 timers but are they used a lot? Another thing is one of your plugins could also raise up the CPU usage even mySQL can if not coded right.
Posts: 418
Threads: 25
Joined: Feb 2009
Reputation:
0
I'm hosting a roleplay server on a linux VPS which has nothing in it but SA-MP, MySQL, Apache and the usual stuff. The 4 timers are called every one second, the other 2 are called every 15 minutes+. There's no RAM issue, just CPU usage issue.
I've tried lowering some stuff in the code and the streamers in the server.cfg as well. I've followed some code optimization guides so I'm not really sure what's going on. I have mysql.so, sscanf.so and streamer.so as my plugins.
Posts: 6,236
Threads: 310
Joined: Jan 2011
Reputation:
0
Show your OnPlayerUpdate.
Posts: 418
Threads: 25
Joined: Feb 2009
Reputation:
0
What kind of MySQL problem? One of my admins told me something about placing mysql_free_result.
Regarding the timers, they do the same thing at the span of 1000ms. Nothing gets added to their list of tasks unless a new player connects -- that means more variables to process, etc.
Posts: 933
Threads: 62
Joined: May 2011
Reputation:
0
You have 4 timers and every is 1000ms? Why don't you 'connect' 4 timers in one?
Also, yeah, MySQL takes CPU alot, use threaded queryes and after using mysql_store_result always use mysql_free_result!