Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-09-2009, 06:20 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
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?
__________________
Reply With Quote
  #2  
Old 11-09-2009, 01:53 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
I've noticed it too.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #3  
Old 12-23-2009, 09:39 PM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
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.
Reply With Quote
  #4  
Old 12-23-2009, 09:48 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by WhiteDragon View Post
I have no idea if the /stats are accurate
Doubt it, once went to 123% or something.
Reply With Quote
  #5  
Old 12-23-2009, 09:52 PM
Riot Riot is offline
Delteria Management
Join Date: Nov 2003
Location: Seminole County, Florida
Posts: 280
Riot is on a distinguished road
Quote:
Originally Posted by Crow View Post
Doubt it, once went to 123% or something.
If its anything like cpu load on Linux that does not mean its inaccurate.
Reply With Quote
  #6  
Old 12-23-2009, 10:10 PM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
Quote:
Originally Posted by Crow View Post
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.
Reply With Quote
  #7  
Old 12-24-2009, 01:40 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Quote:
Originally Posted by WhiteDragon View Post
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
Reply With Quote
  #8  
Old 12-24-2009, 01:48 AM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
Quote:
Originally Posted by Twinny View Post
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.
Reply With Quote
  #9  
Old 02-16-2010, 12:36 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
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.
Reply With Quote
  #10  
Old 02-16-2010, 12:42 AM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
Quote:
Originally Posted by Stefan View Post
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.
Reply With Quote
  #11  
Old 02-16-2010, 12:50 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Quote:
Originally Posted by WhiteDragon View Post
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.
Reply With Quote
  #12  
Old 02-16-2010, 01:31 AM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
Quote:
Originally Posted by Stefan View Post
It shows the memory the npcserver/gserver are currently allocating in /stats.
Right but how much memory is available?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 07:05 AM.


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