Forums

MySQL performance

Hi all, I've moved a Flask application to PythonAnywhere and upgraded to Hacker account.

I've tested performance on a heavy request and compared with existing environment (2 vCPU, 6GB used by nginx, MySQL, mongodb). It turned out the request execution took about 60 seconds (compared to 7 seconds at existing environment). The amount of CPU time consumed though didn't exceed 0.1 seconds. So I assume the main time was spent by MySQL server serving the queries.

Is there any overview of MySQL server performance?

By the amount of CPU time, do you mean the amount measured on your Dashboard? That doesn't include time spent processing website code, so wouldn't indicate what it is that is running slowly.

I think it would be a good idea to instrument your code to find out what is taking all of the time -- if you do something like this:

print(f"{datetime.now()} log message here", flush=True)

...then it will put a timestamped log message into the website's server log, so with a few of those in your view code you should be able to track down what is taking up the time.