3

Could somebody please give some tips on how to improve web2py performance (WSGI apache + MySQL)? I have an application that receives Ajax requests from the client every few seconds to access database and return results. The server is a Ubuntu machine with 640 Mb RAM (virtual server on Amazon EC2, no Xserver).

There are 4 WSGI-processes in apache config. A newly started apache2 instance leaves ca 300 Mb free, but after a hundred requests the system is getting slow and there are long delays. Restarting the server helps to free up memory (I set up cron to do it every 30 minutes - but I guess it is bad practice).

Will be grateful for any advance! A more powerful server is not an option yet because of the budget.

Thanks in advance!

Andrei
  • 71
  • 1
  • 3

3 Answers3

2

Make sure you use connection pools. Makes a big difference.

Also do not use cron. Use a background process. Cron may eat more memory than necessary.

Massimo
  • 1,653
  • 12
  • 11
1

Read 11 Deployment Recipes of the Web2Py book ! There are a lot of ways to improve web2py performance

Unitech
  • 5,781
  • 5
  • 40
  • 47
1

If you are using background scripts, make sure to commit() or rollback() your transactions. This is not needed on web2py environment. But if you are running outside scripts it will be needed.