nwnx profiler results
Moderators: Wynna, NWN2 - 03 DM
Re: nwnx profiler results
We could mass copy areas and items until it's 2 gigs plus? The ACR does have a pretty mahoooooosive standard palette and TSM does have a lot of areas.
Re: nwnx profiler results
I have seen the exact same problem on the BG module as well though, even when i hosted it a couple years ago (was likely smaller then).
Also, others have suggested that it might not be a problem with anything Alfa has done, but either nwnx or indeed the nwserver daemon it self. Though my personal hunch is that it's Alfa-related somehow, it would be nice to know for sure.
By testing with non-alfa code, at least we'll know where to go from here.
If it was an issue just with mere filesize, wouldn't it be sluggish both with and without users on ?
Also, others have suggested that it might not be a problem with anything Alfa has done, but either nwnx or indeed the nwserver daemon it self. Though my personal hunch is that it's Alfa-related somehow, it would be nice to know for sure.
By testing with non-alfa code, at least we'll know where to go from here.
If it was an issue just with mere filesize, wouldn't it be sluggish both with and without users on ?
"The God of the Old Testament is arguably the most unpleasant character in all fiction: jealous and proud of it; a petty, unjust, unforgiving control-freak; a vindictive, bloodthirsty ethnic cleanser; a misogynistic, homophobic, racist, infanticidal, genocidal, filicidal, pestilential, megalomaniacal, sadomasochistic, capriciously malevolent bully." -- Richard Dawkins
Re: nwnx profiler results
It might also be nwn2server failing to handle a sufficiently-large file size.
-
- Rust Monster
- Posts: 1228
- Joined: Sun Jul 18, 2004 3:01 pm
- Location: Richmond, North Yorkshire
Re: nwnx profiler results
creatures have an option "Disable AI when no PC in area". Check this across the palette before trying anything more time consuming.
check the ACR flocking scripts for the pathing problems? iirc once begun they run as a script executed on the creaure independant of associated AI scripts, and so wont be disabled if AI is disabled.
check nothing is using the ActionRandomWalk() function, this is hugely inefficient and if its called from outside the associated AI scripts will run irrespective of a PC being in the area or not.
check the ACR flocking scripts for the pathing problems? iirc once begun they run as a script executed on the creaure independant of associated AI scripts, and so wont be disabled if AI is disabled.
check nothing is using the ActionRandomWalk() function, this is hugely inefficient and if its called from outside the associated AI scripts will run irrespective of a PC being in the area or not.
PC: Liasola Dark Arrow
Ex PC: Arzit'el Tlabbar
Blindhamsterman : "I think Sand may have just won the internet"
Ex PC: Arzit'el Tlabbar
Blindhamsterman : "I think Sand may have just won the internet"
-
- Fionn In Disguise
- Posts: 3784
- Joined: Sat Jan 03, 2004 11:54 am
- Location: Toulouse, France
- Contact:
Re: nwnx profiler results
Then again, if the solution is to restart the server when the last player logs out it could be easier than anything else.
We could just put a long timer (e.g. 5 minutes), start it when the last player logs out and if no-one logged before it's expiration, restart the server.
We could just put a long timer (e.g. 5 minutes), start it when the last player logs out and if no-one logged before it's expiration, restart the server.
Re: nwnx profiler results
It seems like that ought to be an option considered after checking into the other ones? Reloading a two-gig module isn't a trivial thing to do, and it would certainly be less-than-ideal to have one to three of those a day (even if we isolated the analysis to performance; I'm not sure how well the module would handle it, but conversations with Curm on how he has things set up suggests that the mod would lose some features in the process, too-- namely, spawns would be more plentiful than designed, and the module's repeatable static content becomes much more vulnerable to bugs around resets).
-
- Fionn In Disguise
- Posts: 3784
- Joined: Sat Jan 03, 2004 11:54 am
- Location: Toulouse, France
- Contact:
Re: nwnx profiler results
*nods* I hadn't thought/didn't know about the spawns and static problems.
Re: nwnx profiler results
I see that AL added hooks for the when the AI is disable (which I actually thought was automatic). Otherwise it just calls the default NWN AI script.
Looking here:
http://www.alandfaraway.org/forums/view ... AI#p460341
One option might be to use SetCustomHeartbeat to remove OnHB scripts when no one is in the mod. This should probably be an ACR-level change. It would be pretty easy, though there exists the possibility that doing so would have some side effects with other systems specific to the server.
The ACR uses Placeable OnHBs to initialize each placeable in the module (the stuff it does during init AL may have disable anyway). However once that is done it doesn't seem to be doing anything. When a player did log on you'd have to loop through all the placeables in the mod if you wanted to re-enable them.
As a side note, I believe I profiled the OnHB scripts on placeables (and other seemly-insignificant objects) and found them to be so minor that having scripts in them (for future hooking) was worth a few lost cycles.
Ai is expensive, O(n^2), and generally dominates script CPU time when it matters (combat).
Or maybe Zic could just get a quieter CPU fan
Looking here:
http://www.alandfaraway.org/forums/view ... AI#p460341
One option might be to use SetCustomHeartbeat to remove OnHB scripts when no one is in the mod. This should probably be an ACR-level change. It would be pretty easy, though there exists the possibility that doing so would have some side effects with other systems specific to the server.
The ACR uses Placeable OnHBs to initialize each placeable in the module (the stuff it does during init AL may have disable anyway). However once that is done it doesn't seem to be doing anything. When a player did log on you'd have to loop through all the placeables in the mod if you wanted to re-enable them.
As a side note, I believe I profiled the OnHB scripts on placeables (and other seemly-insignificant objects) and found them to be so minor that having scripts in them (for future hooking) was worth a few lost cycles.
Ai is expensive, O(n^2), and generally dominates script CPU time when it matters (combat).
Or maybe Zic could just get a quieter CPU fan

Re: nwnx profiler results
Surely AI should require cpu power when people are actually on though. No reason why AI code should require a lot more power when there is no players on the server.Ai is expensive, O(n^2), and generally dominates script CPU time when it matters (combat).
"The God of the Old Testament is arguably the most unpleasant character in all fiction: jealous and proud of it; a petty, unjust, unforgiving control-freak; a vindictive, bloodthirsty ethnic cleanser; a misogynistic, homophobic, racist, infanticidal, genocidal, filicidal, pestilential, megalomaniacal, sadomasochistic, capriciously malevolent bully." -- Richard Dawkins
Re: nwnx profiler results
No, I was just trying to put things in perspective. See above suggestion on getting a quieter CPU fanzicada wrote:Surely AI should require cpu power when people are actually on though. No reason why AI code should require a lot more power when there is no players on the server.Ai is expensive, O(n^2), and generally dominates script CPU time when it matters (combat).

I would make a test version of the mod with a SetCustomOnHeartbeat() which disables the OnHB script on all creature and placeable heartbeats. Let us know how that works.
- AcadiusLost
- Chosen of Forumamus, God of Forums
- Posts: 5061
- Joined: Tue Oct 19, 2004 8:38 am
- Location: Montara, CA [GMT -8]
- Contact:
Re: nwnx profiler results
I'd somehow missed this thread before...
Yes, AI uses significant CPU, as does pathfinding. Neither of these are the cause of the high CPU use when nwn2server.exe is running with 0 clients logged in.
NWNx profiler does not actually seem to catch whatever server quirk is causing this- you can load an empty module exhibiting this problem and log 10 minutes of 100% CPU grinding and the profiler log will show nothing to explain it. However, if you delete from the module a few of the scripts (NSS and NCS) that occupy object heartbeat slots (placeables > doors > triggers > creatures > module), the CPU creep is slower. Note that these scripts can be empty; just a return statement, and you get the same slowdown- and again, this problem is resolved IMMEDIATELY when a player or DM logs in, only to begin again when the server goes back down to 0 clients logged in.
This is an issue we've been dealing with continuously through all of NWN2-ALFA; it has to do with something involving heartbeat events during idle time (no clients logged in). The severity of the symptoms increase with more areas (more objects with heartbeats). I have tried to keep, at a minimum, the acf_plc_onheartbeat script deleted from all hosted Live modules to avoid the problem; however with some mods (Moonshaes, I'm looking at you) it keeps showing up again every time they do an update. I've mentioned it to Castano a few times, but I suspect it hitchhikes in with builder erfs.
Best hope at a real fix would probably be if it could be addressed by the xp_bugfix plugin by Skywing, but since this bug doesn't generate crash dumps, I've not had useful data to supply to him to work from.
A simple workaround would be to use a copy of the Standalone DM client (also by Skywing) to keep a dummy DM avatar logged in whenever a server is empty (or have it log in briefly for a few seconds every 45 minutes or so that a server remains idle/0).
Setting a timer to reset the module if it's at 0 clients logged in for more than 30m-1hr would work as well (and is do-able via the ACR), but could have a lot of other downsides:
Yes, AI uses significant CPU, as does pathfinding. Neither of these are the cause of the high CPU use when nwn2server.exe is running with 0 clients logged in.
NWNx profiler does not actually seem to catch whatever server quirk is causing this- you can load an empty module exhibiting this problem and log 10 minutes of 100% CPU grinding and the profiler log will show nothing to explain it. However, if you delete from the module a few of the scripts (NSS and NCS) that occupy object heartbeat slots (placeables > doors > triggers > creatures > module), the CPU creep is slower. Note that these scripts can be empty; just a return statement, and you get the same slowdown- and again, this problem is resolved IMMEDIATELY when a player or DM logs in, only to begin again when the server goes back down to 0 clients logged in.
This is an issue we've been dealing with continuously through all of NWN2-ALFA; it has to do with something involving heartbeat events during idle time (no clients logged in). The severity of the symptoms increase with more areas (more objects with heartbeats). I have tried to keep, at a minimum, the acf_plc_onheartbeat script deleted from all hosted Live modules to avoid the problem; however with some mods (Moonshaes, I'm looking at you) it keeps showing up again every time they do an update. I've mentioned it to Castano a few times, but I suspect it hitchhikes in with builder erfs.
Best hope at a real fix would probably be if it could be addressed by the xp_bugfix plugin by Skywing, but since this bug doesn't generate crash dumps, I've not had useful data to supply to him to work from.
A simple workaround would be to use a copy of the Standalone DM client (also by Skywing) to keep a dummy DM avatar logged in whenever a server is empty (or have it log in briefly for a few seconds every 45 minutes or so that a server remains idle/0).
Setting a timer to reset the module if it's at 0 clients logged in for more than 30m-1hr would work as well (and is do-able via the ACR), but could have a lot of other downsides:
- Would kick off/interrupt players connected waiting on ADL downloads on an otherwise empty server
- Would wipe DM event setup if no one is on
- Would mean HDMs/hosts don't know if a module is crashing or not
- Would exacerbate the server clock acceleration issue
- AcadiusLost
- Chosen of Forumamus, God of Forums
- Posts: 5061
- Joined: Tue Oct 19, 2004 8:38 am
- Location: Montara, CA [GMT -8]
- Contact:
Re: nwnx profiler results
Placeholder account now running.
"ALFAtech Placeholder" will not DM for you. Do not ask it to!
"ALFAtech Placeholder" will not DM for you. Do not ask it to!
Re: nwnx profiler results
Though it's a bandaid and no real fix, this seems to be working pretty nicely, thanks.AcadiusLost wrote:Placeholder account now running.
"ALFAtech Placeholder" will not DM for you. Do not ask it to!
"The God of the Old Testament is arguably the most unpleasant character in all fiction: jealous and proud of it; a petty, unjust, unforgiving control-freak; a vindictive, bloodthirsty ethnic cleanser; a misogynistic, homophobic, racist, infanticidal, genocidal, filicidal, pestilential, megalomaniacal, sadomasochistic, capriciously malevolent bully." -- Richard Dawkins
Re: nwnx profiler results
So are you guys opposed to the script-level change? Or did you try it and it did not work? I'm perfectly happy with a band-aid myself, and can't get TSM to load on my machine (not sure why; BG loads right up but TSM never gets past the idle stage).