|
|
#1 |
|
Big Clucker
![]() ![]() Join Date: Dec 2010
Posts: 192
Reputation: 12
|
Run this clear script as gamemode and test CPU usage of server
Code:
#include <a_samp>
main(){}
public OnGameModeInit()
{
for(new i=0;i<2000;i++) CreateVehicle(411,random(6000)-3000,random(6000)-3000,random(6000)-3000,0,0,0,1);
}
If you run it on linux system CPU will be 5%-9%. If you set respawn delay to 0 on linux CPU will be 0%-1%. If I set in server.cfg sleep = 100 (mean 10 proccess tick's in second) CPU = 0%-1% If I set in server.cfg sleep = 1 (up to 1000 proccess tick's) CPU = ~20% It's check for vehicle's respawn delay every proccess tick => ~170 ticks for every vehicles in second with standart sleep 5 => 170 * 2000 = 340000 checks only for vehicles in 1 second? Why there is vehicle's check every proccess tick? May be need check every 100 ms or 200 ms or 400ms? And why on win there is no CPU usage from vehicles? Last edited by SPAWN_METAL; 12/05/2012 at 09:44 AM. |
|
|
|
|
|
#2 |
|
Big Clucker
![]() ![]() Join Date: Dec 2010
Posts: 192
Reputation: 12
|
didn't fixed in 0.3e =(
|
|
|
|
|
|
#3 |
|
Godfather
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jan 2011
Location: England
Posts: 5,428
Reputation: 766
|
So what you're saying is the server is checking EVERY vehicle's respawn time, every single 'tick'? Surely it should only be checked once a second..? If that is the case it should be changed.
|
|
|
|
|
|
#4 | |
|
Huge Clucker
![]() ![]() ![]() Join Date: Feb 2012
Posts: 366
Reputation: 21
|
Quote:
|
|
|
|
|
|
|
#5 |
|
Little Clucker
![]() Join Date: Jan 2012
Posts: 41
Reputation: 5
|
We were having a bit of a CPU load issue with our server. This helped A LOT. Thank you so much for sharing this info! rep ++
|
|
|
|
|
|
#6 |
|
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Jun 2008
Location: Hong Kong, China
Posts: 1,706
Reputation: 132
|
Actually I'm not sure how can you deduce the data of 170 checks per tick. The sleep setting in server.cfg can't prove that it is affected by CreateVehicle(respawn settings). The smaller sleep time means the CPU will spend more time on the server, instead of other (background) programs, so that it will consume more of the CPU time and it shows higher CPU usage. Correct me if I'm wrong.
|
|
|
|
|
|
#7 |
|
Big Clucker
![]() ![]() Join Date: Dec 2010
Posts: 192
Reputation: 12
|
170 ticks in 1 seconds with sleep 5.
|
|
|
|
|
|
#8 |
|
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Jun 2008
Location: Hong Kong, China
Posts: 1,706
Reputation: 132
|
My main question is that how can you know that the check is done on every tick?
|
|
|
|
|
|
#9 |
|
SA-MP Developer
![]() ![]() ![]() ![]() ![]() Join Date: Apr 2005
Posts: 574
Reputation: 1511
|
You definitely don't want to use sleep 100. That would mean everyone would have a minimum of 100 ping.
The SA-MP server might use slightly more CPU on linux. There are several reasons for this, but the biggest factor is that most current linux kernels have high-res timer kernel module loaded, which means thread sleep cycles are very accurate. A server host that ran SA-MP on linux and was concerned about CPU could unload the high-res timers module in the kernel. More CPU and lower pings mean higher performance and less lag. |
|
|
|
|
|
#10 |
|
Little Clucker
![]() Join Date: Oct 2011
Posts: 29
Reputation: 0
|
Very useful information! I changed our vehicles respawn delay from 600000 to 0, and the cpu usage reduced by 40-50% (8% to 3-5%)
+rep |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [FilterScript] [Help] CreateVehicle. | Mister. M | Filterscripts | 3 | 13/04/2011 02:31 PM |
| CreateVehicle ? | park4bmx | Help Archive | 2 | 23/02/2011 11:16 AM |
| CreateVehicle could lag? | Osviux | Help Archive | 3 | 27/12/2010 06:38 PM |
| CreateVehicle | barneystinson | Help Archive | 8 | 20/11/2010 06:09 PM |
| Need help on CreateVehicle | DragonBlaster50 | Help Archive | 7 | 27/07/2010 09:39 AM |