Questions regarding server serformance (CPU)
A few questions regarding server performance / CPU:
-------------------- - How do i know how cpu demanding my plugins are? - What are the symptoms when the plugins are using too much CPU? *Does it create server lag or increases players ping? *Does it make players have lower FPS? - The better the CPU = can run more demanding plugins? To wich extent? This game is so old, and CPU's are so much faster nowadays, lets say i have an i3/i5/i7 CPU, should i even worry about having demanding plugins? - I know having too much stuff inside client_PreThink(id) is very CPU demanding, but to wich extent? How do i know when it is too much? -------------------- (i might update this if i have more questions) Thank you. |
Re: Questions regarding server serformance (CPU)
Quote:
And no, players' FPS will remain the same, although it doesn't matter if they're lagging like hell. Source: Me, server owner for like, 10 years. |
Re: Questions regarding server serformance (CPU)
Source : Me.
Argument : When i hear or see client_prethink, i try to avoid it . For example you want make a function (not small) which calculates something upon the player. If you set this function in client_prethink then it will be called from 100 times per second to 1000 (depends on player fps_max cvar's value). So it is better to avoid it , but sometimes you can't . I have a hns server and because of plugin that uses prethink its buggy sometimes and when i fall down, sometimes I don't die, because there is some overload on server and forward haven't returned a value yet (i think so..). |
Re: Questions regarding server serformance (CPU)
Poorly coded plugins which result in high CPU usage will not harm a player's FPS - they are unrelated. It can however cause some lag, choke, loss etc.
The CPU's you listed are powerful and even though HL1 Engine is single-threaded it still does its job very well. Should you worry about having demanding plugins? Realistically, no plugin should be so demanding to the point that you have to worry about how much CPU it is consuming if it is coded logically and efficiently. This is why it's important that you have the source code for all of the plugins you are running, and that you understand what each of them are actually doing. For the average server admin, that can be difficult which is why the mods and approvers here do their best to scrap bad code and give good advice. Stay clear of using by-frame forwards, especially from Engine module since they can't be enabled/disabled. PreThink, PostThink, CmdStart, AddToFullPack, (FM) Touch - only use them when absolutely necessary, or in a module. Of course they each have their place for specific instances ( eg. Using PostThink() to detect a player landing on the ground, or PreThink() to set a specific mapzone on a player at a certain time ), but more often than not these forwards can be activated when necessary and disabled when not in use. Over my time I've made many many mods from Zombie Mods, JailBreak, Call of Duty, Trouble in Terrorist Town, etc. etc. and I've never had leave any of those said functions/forwards activated for any longer than a few seconds. There is always a better way. All you need to do is ask. |
Re: Questions regarding server serformance (CPU)
Thank you everyone for all your answers.
|
Re: Questions regarding server serformance (CPU)
Spoiler
This is what i have in my PreThink. Is it too much? I cant really find a way to do this things whiout PreThink. |
Re: Questions regarding server serformance (CPU)
Well, you can do some variable caching.
First of all PHP Code:
You are also calling PHP Code:
And what about these screenfade messages? Could it happen that they get executed multiple frames in a row? That's a no-no if that's the case, because you are spamming the network channel. Even worse, you are spamming the reliable channel, use MSG_ONE_UNRELIABLE instead of MSG_ONE, as screenfade isn't something that's really important for the gameplay, whereas for example entity data is. PHP Code:
And also it's good to avoid checking for "== true", as Pawn isn't type safe. In pawn anything that's non-zero is true. PHP Code:
|
Re: Questions regarding server serformance (CPU)
I dont think variable caching is so important, in case natives come from module, example :is_user_alive, is_user_connected...
I saw a plugin , i think basebuilder 5.4 where there is an array is_alive[33] and it stores information if player is alive or not , the same think with is_user_connected.. It wont be faster .. I think. I want to know exactly if it's faster to save these type of information and read from plugins global array... Does anybody know? I say someone in this forum who can do 100000 tests , something like this and see the difference in seconds. |
Re: Questions regarding server serformance (CPU)
Quote:
Code:
Code:
Time 1: 1s 374ms |
Re: Questions regarding server serformance (CPU)
@sirius
Check this out |
| All times are GMT -4. The time now is 18:34. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.