Tuna Posted October 28, 2010 Share Posted October 28, 2010 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
dzek (varez) Posted October 28, 2010 Share Posted October 28, 2010 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
Tuna Posted October 28, 2010 Author Share Posted October 28, 2010 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
dzek (varez) Posted October 28, 2010 Share Posted October 28, 2010 is server in 1.0.4 version? Link to comment
Tuna Posted October 28, 2010 Author Share Posted October 28, 2010 Yes it is. I'm gonna have to resort to storing stuff in a lua table as well as SQL so it can read from the table cause its just getting seriously out of hand now... Edit: ccw has made a fix for this which works extremely well. Get any version of 1.0.4 which is higher than r2049 http://code.google.com/p/mtasa-blue/sou ... ail?r=2049 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now