Jump to content

Data Storage


Tuna

Recommended Posts

Hello, I've got some questions.

The server has been very busy the past week (reaching 105 players on sunday) and some of the resources are really putting a strain on the CPU which is really affecting the playability. So I used PerformanceBrowser (Thankyou ccw) to find which resources were causing the problem.

The resources were important things like the core, player vehicle database, and police/crime database. There were times when some would jump to over 50% usage which is insane for a 3ghz dual core CPU. The similarity with these resources were that they all use get/setAccountData a lot and the SQL funcs.

I debugged one of the resource intensive functions with getTickCount() to see what part was causing it and it all took 0 miliseconds apart from 2 getAccountDatas which were taking around 50 miliseconds each. One of the getAccountDatas I was able to remove as it wasn't needed and the other already had a lua table storing the data. The function now executes in 0 miliseconds and uses a tiny fraction of the CPU it was using before.

So the problem is the SQL functions. I know they're gonna be slow because they access the hard drive but why does it have to use up so much of the CPU? Is there any other data storage method which is more efficient? Can't the registry.db and internal.db be fully loaded to RAM so atleast reading from them doesn't take so long?

Link to comment

are you sure you cant optimize sql queries too?

SELECT column FROM table WHERE id="1"

-- some math, or something, using the data from DB

SELECT column2 FROM table WHERE id="1"

-- something, using the data (nothing was updated meantime)

is for example slower than

SELECT column,column2 FROM table WHERE id="1"

-- some math, or something, using the data from DB

-- something 2

Lot of ppl are doing their queries like that.

Link to comment

Its only the police/crime database that are using SQL funcs, core and vehicles both use account data. For example when a player spawns it has to gets their team, skin, money, health, armour, weapons, position. And just those few getAccountDatas seem to be able to use a large portion of CPU.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...