Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Insane CPU Usage (https://forums.graalonline.com/forums/showthread.php?t=87269)

cbk1994 08-06-2009 02:00 AM

Insane CPU Usage
 
On Era Dev, we're constantly seeing things like this in our stats:

Quote:

Originally Posted by /stats
Top 10 of npcs taken most CPU time:
1. 14.767989811 percent -System/Commands (commands_items,commands_def,commands_staff)

This is absolutely ridiculous; there is no feasible way the script could be this CPU-intensive. The only command used was a single summon. This happens to virtually all of our scripts, from the simplest to the most complex. I don't notice any pattern or specific time this happens, but at some points the server is so laggy we can't do anything, even on RC with no scripts running. I have checked out the scripts with function profiling and all other tools we have, but there is no reason for this to be occurring.

This is clearly a problem with the server and not our scripts, and I'd like to hear from Stefan about what we can to to fix this. It is impossible to get any kind of clue how efficient our scripts are when they're constantly reaching 15percent on the CPU usage list for no reason.

WhiteDragon 08-06-2009 02:11 AM

If you already did function profiling on everything and analyzed /stats when the problem was happening, I imagine this would be a problem Stefan would have to take care of.

It's possible there is something else on the machine making iowait go up and therefore artificially boosting all the "CPU usage" percentages on the GServer.

It could also be one of your scripts doing too much I/O. Is your memory usage too high? Perhaps it's swapping.

There are a number of things that could be happening, but I guess it'll be tough to tell without someone with access to check these things coming.

Switch 08-06-2009 02:21 AM

RELEASE THE CPU EFFICIENCY TOOL!/caps

cbk1994 08-06-2009 02:29 AM

Quote:

Originally Posted by WhiteDragon (Post 1513260)
If you already did function profiling on everything and analyzed /stats when the problem was happening, I imagine this would be a problem Stefan would have to take care of.

It's possible there is something else on the machine making iowait go up and therefore artificially boosting all the "CPU usage" percentages on the GServer.

It could also be one of your scripts doing too much I/O. Is your memory usage too high? Perhaps it's swapping.

There are a number of things that could be happening, but I guess it'll be tough to tell without someone with access to check these things coming.

We're using approximately 8 MB (8.1937561) of memory, so that's not the problem.

As far as I know, virtually all UC servers are on the same machine, so I wonder if that's the problem? Perhaps we could be transferred to whatever machine Era is on.

WhiteDragon 08-06-2009 02:36 AM

Quote:

Originally Posted by cbk1994 (Post 1513264)
As far as I know, virtually all UC servers are on the same machine, so I wonder if that's the problem? Perhaps we could be transferred to whatever machine Era is on.

I think the best bet is that another machine is doing something intensive that makes your script wait on some resource and say that it's using more CPU than it actually is.

cbk1994 08-06-2009 02:41 AM

Quote:

Originally Posted by WhiteDragon (Post 1513266)
I think the best bet is that another machine is doing something intensive that makes your script wait on some resource and say that it's using more CPU than it actually is.

I'm wondering if it has something to do with Stefan's backups as well. I know that has caused problems like this for servers in the past.

xXziroXx 08-06-2009 04:31 PM

We get the same once a day on Maloria around 00.30-02.00 GMT+1, scripts containing basically no script at all start complaining about 20% CPU usage while the server itself lags unbearably much.

Every day, same time.

Pelikano 08-06-2009 04:48 PM

You might want to show this to Crow, I think he once had the same problem with a script... nick-system?

Cloven 08-06-2009 05:16 PM

There's a massive lag issue at the same time daily on Delteria Dev as well. NC usually dies reliably at the same time along with it (or at the very least, does not work properly for a short period of time). In one instance I've actually had a script revert to an older version of itself without explanation. o_O

cbk1994 08-06-2009 05:16 PM

Quote:

Originally Posted by Pelikano (Post 1513351)
You might want to show this to Crow, I think he once had the same problem with a script... nick-system?

That was clientside lag, and it had to do with him using player attributes to display nick names :p.



Sounds to me like this is a common issue, and perhaps Stefan is spreading the machines too thin?

WhiteDragon 08-06-2009 05:28 PM

Judging by what everyone is saying, it sounds like Stefan runs some sort of backup which somehow uses a resource (probably i/o) that makes all the GServers wait on stuff and artificially boosts their CPU usage.

I imagine something should be able to be done by it considering there is this sort of problem in any real-time system that requires backing up.

Switch 08-06-2009 05:32 PM

Quote:

Originally Posted by cbk1994 (Post 1513361)
Sounds to me like this is a common issue, and perhaps Stefan is spreading the machines too thin?

And/or maybe a server is doing some lag-intensive script at that time.

cbk1994 08-06-2009 05:35 PM

Quote:

Originally Posted by Switch (Post 1513368)
And/or maybe a server is doing some lag-intensive script at that time.

Well, besides the fact that there is no such thing as a "lag-intensive" script, I think you'd be hard pressed to make a script capable of pretty much crashing every single server on the machine you're on.

Crow 08-06-2009 05:41 PM

Quote:

Originally Posted by cbk1994 (Post 1513361)
That was clientside lag, and it had to do with him using player attributes to display nick names :p.

This.

I'm thinking as well that the issue is related to the machine Era Dev is on.

xXziroXx 08-06-2009 06:42 PM

Quote:

Originally Posted by Switch (Post 1513368)
And/or maybe a server is doing some lag-intensive script at that time.

Unlikely, since it happens every day at the same time.

Quote:

Originally Posted by cbk1994 (Post 1513369)
Well, besides the fact that there is no such thing as a "lag-intensive" script, I think you'd be hard pressed to make a script capable of pretty much crashing every single server on the machine you're on.

... I did it once. :cry:

cbk1994 08-06-2009 06:44 PM

Quote:

Originally Posted by xXziroXx (Post 1513393)
... I did it once. :cry:

:cool:

What was the script doing, anyway?

Switch 08-06-2009 06:49 PM

Quote:

Originally Posted by cbk1994 (Post 1513369)
Well, besides the fact that there is no such thing as a "lag-intensive" script, I think you'd be hard pressed to make a script capable of pretty much crashing every single server on the machine you're on.

A script that causes extreme lag? And also I'm pretty sure Zodiac did that one time.




Quote:

Originally Posted by xXziroXx (Post 1513393)
Unlikely, since it happens every day at the same time.

Quote:

Originally Posted by Switch (Post 1513368)
And/or maybe a server is doing some lag-intensive script at that time.




Also, I didn't see that "backing-up" post, which seems likely as well.

cbk1994 08-06-2009 06:51 PM

Quote:

Originally Posted by Switch (Post 1513395)
A script that causes extreme lag? And also I'm pretty sure Zodiac did that one time.

"Lag" is not a resource, therefore a script cannot be lag-intensive.

CharlieM 08-06-2009 07:19 PM

Probably sloppy and/or poor scripting Perhaps everything is being commanded to start or do checks at the same time?

xXziroXx 08-06-2009 09:18 PM

Quote:

Originally Posted by cbk1994 (Post 1513394)
:cool:

What was the script doing, anyway?

I don't quite remember. It was something along the lines of a huge loop in another huge loop doing excessive file .txt file manipulation. Took 25 minutes for the script to cancel itself, and during that time, I apparently lagged all servers (or so Bell stated, I went afk shopping food when I realized RC wasn't responding to me).

Pelikano 08-06-2009 09:19 PM

Quote:

Originally Posted by xxziroxx (Post 1513428)
i don't quite remember. It was something along the lines of a huge loop in another huge loop doing excessive file .txt file manipulation. Took 25 minutes for the script to cancel itself, and during that time, i apparently lagged all servers (or so bell stated, i went afk shopping food when i realized rc wasn't responding to me).

LOL caps

WhiteDragon 08-06-2009 09:57 PM

I still think all the servers should be virtualized with Xen to avoid stuff like that; although, I don't know how powerful the hardware is over at Cyberjouers.

Riot 08-06-2009 11:45 PM

Quote:

Originally Posted by Cloven (Post 1513360)
There's a massive lag issue at the same time daily on Delteria Dev as well. NC usually dies reliably at the same time along with it (or at the very least, does not work properly for a short period of time). In one instance I've actually had a script revert to an older version of itself without explanation. o_O

Generally though, scripts don't start using a lot of CPU time as reported by /stats (I've noticed it happening maybe 5 times, while the slowdowns have been happening for months).

The laglog on Delteria Dev for periods of slowdowns in the last day looks like so:

HTML Code:

08/06/2009 05:34:32 - scripttime: 900 (players: 2, levels: 45, npcs: 95)
08/06/2009 05:32:29 - scripttime: 1600 (players: 2, levels: 43, npcs: 95)
08/06/2009 05:31:29 - scripttime: 1200 (players: 2, levels: 43, npcs: 95)
08/06/2009 05:29:24 - scripttime: 2000 (players: 2, levels: 42, npcs: 113)
08/06/2009 05:24:17 - scripttime: 2000 (players: 2, levels: 45, npcs: 95)
08/06/2009 05:21:11 - scripttime: 2400 (players: 2, levels: 52, npcs: 95)
08/06/2009 05:20:02 - scripttime: 4900 (players: 2, levels: 53, npcs: 95)
08/06/2009 05:18:01 - scripttime: 2100 (players: 2, levels: 52, npcs: 113)
08/05/2009 23:24:49 - scripttime: 3400 (players: 3, levels: 28, npcs: 77)
08/05/2009 23:23:49 - scripttime: 2000 (players: 3, levels: 27, npcs: 95)
08/05/2009 23:22:26 - scripttime: 2200 (players: 3, levels: 30, npcs: 95)
08/05/2009 23:21:16 - scripttime: 1500 (players: 3, levels: 30, npcs: 113)
08/05/2009 23:20:06 - scripttime: 600 (players: 3, levels: 28, npcs: 113)
08/05/2009 23:19:02 - scripttime: 300 (players: 3, levels: 28, npcs: 95)
08/05/2009 23:17:48 - scripttime: 1100 (players: 3, levels: 31, npcs: 77)
08/05/2009 23:16:41 - scripttime: 600 (players: 3, levels: 31, npcs: 90)
08/05/2009 23:15:31 - scripttime: 300 (players: 3, levels: 29, npcs: 72)
08/05/2009 23:14:25 - scripttime: 800 (players: 3, levels: 29, npcs: 90)
08/05/2009 23:12:43 - scripttime: 1200 (players: 3, levels: 38, npcs: 95)
08/05/2009 23:11:38 - scripttime: 900 (players: 3, levels: 42, npcs: 113)
08/05/2009 23:10:28 - scripttime: 400 (players: 3, levels: 44, npcs: 95)
08/05/2009 23:09:19 - scripttime: 1100 (players: 3, levels: 49, npcs: 95)
08/05/2009 23:08:13 - scripttime: 500 (players: 3, levels: 52, npcs: 77)
08/05/2009 23:07:02 - scripttime: 400 (players: 3, levels: 55, npcs: 95)
08/05/2009 23:05:52 - scripttime: 300 (players: 3, levels: 55, npcs: 95)
08/05/2009 23:04:50 - scripttime: 400 (players: 3, levels: 56, npcs: 77)
08/05/2009 23:03:26 - scripttime: 1100 (players: 3, levels: 56, npcs: 95)
08/05/2009 05:33:17 - scripttime: 1000 (players: 1, levels: 46, npcs: 95)
08/05/2009 05:32:16 - scripttime: 2400 (players: 1, levels: 46, npcs: 113)
08/05/2009 05:30:10 - scripttime: 3300 (players: 1, levels: 44, npcs: 95)
08/05/2009 05:29:08 - scripttime: 3300 (players: 1, levels: 44, npcs: 113)
08/05/2009 05:24:57 - scripttime: 2100 (players: 1, levels: 46, npcs: 113)
08/05/2009 05:23:56 - scripttime: 2500 (players: 1, levels: 46, npcs: 113)
08/05/2009 05:21:49 - scripttime: 1100 (players: 1, levels: 50, npcs: 95)
08/05/2009 05:20:47 - scripttime: 2300 (players: 1, levels: 50, npcs: 11)


xXziroXx 08-07-2009 12:13 AM

It's happening right now, 00:15 GMT+1 on Maloria. Occuring for anyone else?

cbk1994 08-07-2009 12:51 AM

Quote:

Originally Posted by xXziroXx (Post 1513481)
It's happening right now, 00:15 GMT+1 on Maloria. Occuring for anyone else?

Yep, our server just crashed on us.


All times are GMT +2. The time now is 05:30 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.