Forums

Performance Optimization

Hi,

we are currently in the stage of fine tuning and optimizing our web app. One of the bottlenecks of the past have been really long load times due to poor design. By now only a basic framework is rendered directly and most of the content is handled asynchronously via JS.

One of the topics at the moment is the drop in performance online vs local. For exactly the same procedure (loading and rendering data with pymysql) some log data is provided below:

Local

time(s) function
0.121   connect
0.122   connection.cursor
0.183   cursor.execute (run 1)
0.026   connection.commit
0.000   cursor.fetchall

Online

time(s) function
0.423   connect
0.428   connection.cursor
0.344   cursor.execute (run 1)
0.105   connection.commit
0.000   cursor.fetchall

Is this a typical behaviour due to the difference in computing power on my local machine vs on your servers?

Do you know of some way to improve the communication between an external mysql server and the application?

That is a natural slow down that you should exxpect because, on PythonAnywhere, the database is not on the same machine as the web app code. You can possibly reduce the execution and commit times by optimising your database queries optimising your database with indexes.