PythonAnywhere performance is significantly slower than locally

1,213 views
Skip to first unread message

NeoToren

unread,
Mar 21, 2015, 4:21:40 PM3/21/15
to web...@googlegroups.com
My website is using MySQL and consists mostly of queries and simple display of textual results. No images or fancy CSS.

Locally, queries response time is sub second.
Deployed to PythonAnywhere (using the couple of basic efficiency tricks in the book) - and the same queries may take 7-8 seconds each !
PA support mentioned that inefficiencies in my code, which are not evident locally may become an issue on the network.
Ok...what kind of inefficiencies should I look for ? 

Any ideas how I can improve the performance when hosted at PythonAnywhere ? 
Anybody experienced similar issues ?

Thanks

Massimo Di Pierro

unread,
Mar 21, 2015, 4:37:54 PM3/21/15
to web...@googlegroups.com
I have not experience performance issues on pythonanywere but I have not used MySQL. One possibility is that on your local machine the database and the server run on the same machine. On pythonanywhere (and most hosting) they may run on different machines therefore you have network latency. Moreover I do not know if the mysql instance if dedicated or shared between many users. 

If this is a latency/bandwith issues you may want to consider rewriting your select so that you retrieve only the columns you actually need.

NeoToren

unread,
Mar 23, 2015, 10:53:08 PM3/23/15
to web...@googlegroups.com
  1. I have installed the EXACT configuration Web2Py app on MySQL DB with a different email on your machines. Performance still is unacceptable - but it is twice as better than the one on the original ICD10 installation ! I am talking about AVERAGE of 4-6 seconds on the new installation vs. average of 15 -30 seconds on the original (I've checked tens of same queries on both).

  2. I've run several queries DIRECTLY on the MySQL instance on your side. Consistently 0.04-0.08 sec. Very reasonable I'd say. Again - locally on my Mac - ANY query on this configuration - is sub second. I think we can safely say the problem is NOT in my SQL code.

  3. The above plus the fluctuations in performance during the time of day - means that Massimo was probably right - the bottle neck is somewhere between the MySQL and the Web2Py servers. BTW - what is the webserver you guys use - Rocket or something else ?

  4. Now to your question, specifically. As you can check yourself at icd10doc.com: user enters either free text or a specific code in to a search box. Problem of latency is most annoying with free text where it may take 15-60 seconds (?!?) for response. With that being said - even 2-3 seconds response time on a search with a code (not free text) for a disease on an indexed table, when directly on MySQL it is measured in milliseconds and locally is always sub second - still shows there is a problem. The MySQL response to the query is just being parsed by Web2Py into a view, usually with links to other pages.

  5. And here is another issue - when user clicks on one link on page - even though it is a simple query (on an indexed table) which responds with another W2P view- it still may take 2-5 seconds ! Why ?

Please - HELP !



Can you tell us a bit more about what kind of query you're running? What's the direct SQL? And what kind of processing do you do in Python?

Staff harry | 1156 posts | PythonAnywhere staff | March 23, 2015, 12:35 p.m.

Derek

unread,
Mar 26, 2015, 6:01:13 PM3/26/15
to web...@googlegroups.com
I'm not seeing the slowness. I checked, and maximum time was maybe half a second. Geographically where are you located?

Derek

unread,
Mar 26, 2015, 6:11:29 PM3/26/15
to web...@googlegroups.com
nevermind, apparently this conversation was going on on their website and spilled here... they fixed it.

NeoToren

unread,
Mar 31, 2015, 6:27:11 PM3/31/15
to web...@googlegroups.com
PythonAnywhere took care of it...
Some rogue processes on their behalf 
Now everything is working great and I am happy as a clam on high-tide
Thanks
NeoToren


On Saturday, March 21, 2015 at 4:21:40 PM UTC-4, NeoToren wrote:
Reply all
Reply to author
Forward
0 new messages