Jump to content

High s-side CPU usage


Sylvek

Recommended Posts

Hi!

I scripted function that makes loop which gets result from MySQL and put this to gridlist. It's like refresh button which loads items for sale. Problem is that one use of this button take about 0.25% server CPU usage. Bigger problem is that I can spam this button and it takes about 10% of server cpu usage. Don't know if it's normal or too high. Could you help me and say how to decrease this and it's normal?

Edited by Sylvek
Link to comment
  • Moderators

 

 

Show the query you are using.

 

Solutions:

  • You might want to use a callback, because the lua code will pause when you execute the query(if no call back). (which can cause a lot of lagg if the requested data size is very large)
  • Save the data you collected inside of a table(as buffer). Use tickcount to decide if you re-call the mysql database or use the buffer. (which can improved your performance with 100 t/m 1000%) So if a guy is spamming/pushing the button a lot of time, your cpu usage will stay normal.
  • Improve your query and set a: LIMIT 1000. Which will make sure that you do not overheat your database. You might not get all the results you need, but you can also request more later, see this example: https://stackoverflow.com/questions/5767479/mysql-limit-range

 

 

Edited by IIYAMA
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...