Forums

Slow web2py app

I have a web2py app hosted on a paid PA account, whose performance is drastically slower than when I run it locally. When I ran it with the profiler enabled, I discovered that it was spending a large portion of its time in fcntl.flock, much large (in absolute and percentage terms) than locally. This is occurring within the execution of the db model (with migration disabled). I'm using SQLite and my account only has a few web workers, but the cases I profiled were where there was an isolated request.

I realize this may be more of a web2py question than a PA question, but I was wondering if anyone had any insight into anything about how PA accounts work that might cause this and, more importantly, what I might be able to do about it.

  • Scott

I think the problem you're seeing is because filesystem access on PythonAnywhere is likely to be slower than it is on your local machine. Files are stored on network-attached storage (so that we can distribute computation across multiple servers), so SQLite is considerably slower. We strongly recommend using MySQL for your database for any site that isn't just a simple testing site -- MySQL, by centralising all of the file storage, locking, and so on, in one place, works much faster.