Server Performance
A[L]C
Join Date: 2010-07-25 Member: 72801Members
How are people finding the server performance? We are hosting a server on p180 and finding it really quite laggy. Is this to do with cysts? The server is a quad xeon and ns is only using around 30% cpu and 350mb ram.
Is there anything we can do to improve it server side?
Thanks
A[L]C
btw I understand the code isnt optimised yet :D
Is there anything we can do to improve it server side?
Thanks
A[L]C
btw I understand the code isnt optimised yet :D
Comments
The last game I was in became unplayable after about 1/2 an hour of playing, until the end of the round that is. We ended up having to recycle just to start a new 'playable' game
The last game I was in became unplayable after about 1/2 an hour of playing, until the end of the round that is. We ended up having to recycle just to start a new 'playable' game<!--QuoteEnd--></div><!--QuoteEEnd-->
Actually, from looking at the profiler, the biggest performance problem right now seems to be the minimap blip updates. Spends about 30% cpu on the server to update the minimap blips ( at the 500 ents count level)
cysts is hardly visible in the profiler.
Start the server as a listen server and type "profile" in console. "cheats 1" and then spread cysts all over the map. Use 'ents' to see how many entities the server has.
Interesting. I don't see that occur, which OS specifically are you referring to? I have affinity across all cores (default), but it strictly never leaves core 0.
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>
function NS2Gamerules:UpdateMinimapBlips()
PROFILE("NS2Gamerules:UpdateMinimapBlips")
if GetGamerules():GetGameStarted() then
// create table of map blips from last frame
local mapBlips = EntityListToTable(Shared.GetEntitiesWithClassname("MapBlip"))
// @maesse: new code start
// Cache ownerid -> mapblip lookups for CreateUpdateMapBlip
local blipDict = {}
for index, mapBlip in ipairs(mapBlips) do
local ownerid = mapBlip:GetOwnerEntityId()
blipDict[ownerid] = mapBlip
end
// @maesse: new code end
// grab all scriptactor entities
local allScriptActors = Shared.GetEntitiesWithClassname("ScriptActor")
for entIndex, entity in ientitylist(allScriptActors) do
// Decide if entity should create a blip and what type
local success, blipType, blipTeam = self:GetMinimapBlipTypeAndTeam(entity)
if success then
// update the blip
CreateUpdateMapBlip(mapBlips, entity, blipType, blipTeam, blipDict) // @maesse: send blipDict
end
end
self:DeleteOldMapBlips(mapBlips)
end
end</div>
My modifications are a bit more spread out here:
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>function CreateUpdateMapBlip(mapBlips, entity, blipType, blipTeam, blipCache) // @maesse: added blipCache
// Update MapBlip entity if exists, else create new one
local updated = false
local found = false
local blipResult = nil
// @maesse: make use of blipCache
if (blipCache ~= nil) then
local index = entity:GetId()
blipResult = blipCache[index]
if(blipResult ~= nil) then
// got it
found = true
end
end
// @maesse: this is the codepath we want to avoid
if not found then
//Shared.Message("Blip not cached!")
for index, mapBlip in ipairs(mapBlips) do
if mapBlip:GetOwnerEntityId() == entity:GetId() then
found = true
blipResult = mapBlip
break
end
end
end
// update
if found then
blipResult:Update(entity, blipType, blipTeam)
updated = true
end
if not updated then
// Create new MapBlip
local mapBlip = CreateEntity(MapBlip.kMapName)
mapBlip:Update(entity, blipType, blipTeam)
end
end</div>
Minimap usage went from 4ms to 2ms on my test-setup. It might be possible to further optimize it by not recreating the dictionary every server-tick. If anyone tries this out or want the lua files to test it on your servers, just let me know.
tl:dr; changed a for(for()); to create-dictionary(); for();
I am seeing the server.exe processes use about 550-575mb and will only ever use one core (so 25% CPU usage per process) when under load.
I also cannot actually type <u>anything</u> into the server console..
Are you using server.exe and launching with switches, or running via a full-game client to do your profile testing?
I'd consider that awful as a player FYI, needs to hang around 30 ticks/sec
I've only changed NS2Gamerules:UpdateMinimapBlips() and CreateUpdateMapBlip in MapBlip.lua as seen in my last reply.
My test setup is only an empty listen-server (with a ton of cysts and drifters), so It's possible the minimap blips aren't actually causing any slowdown in a real game. If one of you guys manage to get the profiler running on the dedicated server, I'd love some screenshots or text output so I can compare the hotspots against my own setup.
Devs, I'd appreciate it if we could actually have maesse's work in game.
What server are you playing on that stays at 30, while full and under load? (full map of structures)
I think that that is currently just a dream and not reality.
Very nice! Been trying to figure that out for awhile. I will check the profiler when the server is full (hopefully tonight)
The changes to summit are quite nice, definite improvements, although I haven't run any empirical tests yet.
If your ping is over 180, find a different server (it's your connection), best to be under 80.
performance hasn't improved at all for me since last patch.
Devs, I'd appreciate it if we could actually have maesse's work in game.<!--QuoteEnd--></div><!--QuoteEEnd-->
I have put it on my server
GamingDeluxe.co.uk NS2
109.70.148.28:27025
Could do with some testers!
The changes to summit are quite nice, definite improvements, although I haven't run any empirical tests yet.
If your ping is over 180, find a different server (it's your connection), best to be under 80.<!--QuoteEnd--></div><!--QuoteEEnd-->
Details on this..?
How many players? What is the servers tickrate late game?
What is the hardware specs? Do anything special with affinity or priority?
Players ping to server is important yes, but if the server is running at 5 tickrate even if you have 10ms - the game is absolutely unplayable.
Playa_2b
Playing around today though, it seems that pathfinding for MACs and Drifters are possible causes for the slowdowns. Spamming waypoints for MACs is a great way to bring the server to it's knees. Check out this screenshot:
<img src="http://i.imgur.com/AChoF.jpg" border="0" class="linked-image" />
Look at that insane call count. I wonder if builders sometimes gets stuck in these pathfinding loops where they just start eating up CPU resources... Either way, that code is off-limits for me so it's not something I can play around with.. Could be interesting to see some profiler output from a struggling realworld server, to see if that's the reason.
The changes to summit are quite nice, definite improvements, although I haven't run any empirical tests yet.
If your ping is over 180, find a different server (it's your connection), best to be under 80.<!--QuoteEnd--></div><!--QuoteEEnd-->
<!--quoteo(post=1859771:date=Jul 11 2011, 03:06 PM:name=Gunter)--><div class='quotetop'>QUOTE (Gunter @ Jul 11 2011, 03:06 PM) <a href="index.php?act=findpost&pid=1859771"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Details on this..?
How many players? What is the servers tickrate late game?
What is the hardware specs? Do anything special with affinity or priority?
Players ping to server is important yes, but if the server is running at 5 tickrate even if you have 10ms - the game is absolutely unplayable.<!--QuoteEnd--></div><!--QuoteEEnd-->
Sure, here are the answers to your questions:
<ol type='1'><li>14 Players</li><li>Server Tick rate is ~30, I'll check again when we have a full server and edit this</li><li>Haven't messed with affinity or thread priority, I haven't even disabled Windows Aero Theme</li><li>Overmind mod</li><li> Hardware:</li></ol>
First let me start by saying that I purchased this to act as a server through beta only, eventually it will become a media/extra pc:
<ul><li>Dell XPS 8300 (<a href="http://www.dell.com/us/p/xps-8300/pd" target="_blank">clickity click</a>)</li><li>Intel Quad Core i5-2300 processor (6MB Cache, 2.8GHz)</li><li>6 GB DDR3 SDRAM at 1333MHz, (2X2G/2X1G)</li><li>1 TB SATA II Hard Drive (7200RPM)</li><li>460 Watt Power Supply</li><li>Intel HD Graphics 2000</li><li>Integrated 7.1 with THX® TruStudio PC™sound</li><li>16X DVD +/- RW Drive</li><li>Windows 7 Home Premium 64-Bit Operating System</li></ul>
Scratch and Dent for $445.19 shipped.
Let me know if you have more :D
Interesting, me too. Have you tried not binding(for lack of a better word) to a single core? I know that the server does have some multithreading capability, so you would be missing out on that by binding. Here is what I have currently with 18 players.
<a href="http://imageshack.us/photo/my-images/809/cpuje.png/" target="_blank"><img src="http://img809.imageshack.us/img809/4186/cpuje.png" border="0" class="linked-image" /></a>
What about windows Processor scheduling? I believe default for server editions is "Background Processes" which is what I currently use. You?
Nah. Better to optimize MoveToTargets so it doesn't do 6000 calls to TraceRay. TraceRay is probably really hard to optimize further because its part of the basic toolkit used by the code all over the place.
It looks like he's just testing MACs\Drifters there though. I recall there are also issues with the turrets-targetting, the hydra-targetting and the DI, and I bet if you solve all of those issues another one will crop up.
I want you to bear my children, Maesse.
I want you to bear my children, Maesse.<!--QuoteEnd--></div><!--QuoteEEnd-->
did his change make much difference?