Graal Forums

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

cbk1994 11-09-2009 06:20 AM

CPU Usage for requestsql
 
The CPU usage that shows in /stats seems to be bloated significantly for scripts using requestsql (even with transactions). I could be wrong, but I don't think so. Has anyone else experienced similar things?

xXziroXx 11-09-2009 01:53 PM

I've noticed it too.

WhiteDragon 12-23-2009 09:39 PM

If you are working with an unindexed schema, the queries will use a lot of CPU. Transactions have nothing to do with it. Certainly queries are unindexable.

I have no idea if the /stats are accurate, but be aware that SQLite doesn't perform any magic if you don't tell it to.

If you post your schema/queries I can give some pointers.

Crow 12-23-2009 09:48 PM

Quote:

Originally Posted by WhiteDragon (Post 1546600)
I have no idea if the /stats are accurate

Doubt it, once went to 123% or something.

Riot 12-23-2009 09:52 PM

Quote:

Originally Posted by Crow (Post 1546606)
Doubt it, once went to 123% or something.

If its anything like cpu load on Linux that does not mean its inaccurate.

WhiteDragon 12-23-2009 10:10 PM

Quote:

Originally Posted by Crow (Post 1546606)
Doubt it, once went to 123% or something.

If there is more than one core allocated on your machine, that is possible since SQLite is thread-safe and uses a thread per connection.

Although, it still is a possibility that /stats is inaccurate.

Twinny 12-24-2009 01:40 AM

Quote:

Originally Posted by WhiteDragon (Post 1546621)
If there is more than one core allocated on your machine, that is possible since SQLite is thread-safe and uses a thread per connection.

Although, it still is a possibility that /stats is inaccurate.

Hell, my Linux servers hit a load average of 140 during the incredible, "let's DDoS the crap out if it!" sessions =x

WhiteDragon 12-24-2009 01:48 AM

Quote:

Originally Posted by Twinny (Post 1546658)
Hell, my Linux servers hit a load average of 140 during the incredible, "let's DDoS the crap out if it!" sessions =x

Load average doesn't have much to do with CPU utilization. It just gives information on the load queue of processes. However, the CPU percent does give an accurate CPU utilization statistic.

Admins 02-16-2010 12:36 AM

The displayed CPU usage is not very accurate when other processes run at the same time and slow down the machine. Most servers with playerworlds on them don't take a lot of CPU time though, it's often more about memory usage which leads to memory swapping if many servers use too much memory. It's always the first thing you should check when your npcserver is slow. Get rid of npcs with tons of variables, try to delete database npcs when you have more than 5000. You can also use "this.dontsave = true" and "this.savelocally = true" to reduce the number of npcs.

For optimizing SQLite I found the query "PRAGMA synchronous=OFF" very helpful, it's basicly not flushing the database to file each time you do an update. It should still be quite reliable.

WhiteDragon 02-16-2010 12:42 AM

Quote:

Originally Posted by Stefan (Post 1556348)
The displayed CPU usage is not very accurate when other processes run at the same time and slow down the machine. Most servers with playerworlds on them don't take a lot of CPU time though, it's often more about memory usage which leads to memory swapping if many servers use too much memory. It's always the first thing you should check when your npcserver is slow. Get rid of npcs with tons of variables, try to delete database npcs when you have more than 5000. You can also use "this.dontsave = true" and "this.savelocally = true" to reduce the number of npcs.

For optimizing SQLite I found the query "PRAGMA synchronous=OFF" very helpful, it's basicly not flushing the database to file each time you do an update. It should still be quite reliable.

Do you think you could add "total memory" to /memstats ? That way we could tell if things are about to swap or not.

Admins 02-16-2010 12:50 AM

Quote:

Originally Posted by WhiteDragon (Post 1556349)
Do you think you could add "total memory" to /memstats ? That way we could tell if things are about to swap or not.

It shows the memory the npcserver/gserver are currently allocating in /stats.

WhiteDragon 02-16-2010 01:31 AM

Quote:

Originally Posted by Stefan (Post 1556350)
It shows the memory the npcserver/gserver are currently allocating in /stats.

Right but how much memory is available?


All times are GMT +2. The time now is 09:17 AM.

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