CPU usage gradually increases as time passes.
#1

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!
Reply
#2

What type of server is it ? how much ram does it have to use ?
Reply
#3

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.
Reply
#4

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.
Reply
#5

Quote:
Originally Posted by Dairyll
Посмотреть сообщение
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.
What are these 4 timers doing?
Reply
#6

Show your OnPlayerUpdate.
Reply
#7

They check and set variables, sync time, handle paychecks and other data. I was having problems with them earlier being called at the same time (the timers stopped randomly) so I made them be called on different milliseconds (https://sampforum.blast.hk/showthread.php?tid=334279) and they started working as usual.

Edit:
My OnPlayerUpdate is still the default VX-RP one (http://pastebin.com/gXnMvt27)
Reply
#8

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.
Reply
#9

Is this (https://sampforum.blast.hk/showthread.php?tid=271129) the performance profiler you're talking about? Thank you for helping so much by the way.
Reply
#10

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!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)