Python psycopg2 + mod_wsgi: connection is very slow and automatically close
If you are using mod_wsgi in embedded moe, especially with preform MPM for Apache, then likely that Apache is killing off the idle processes. Try using mod_wsgi daemon mode, which keeps process persistent and see if it makes a difference.
I have made a python ladon webservice and I run is on Ubuntu with Apache2 and mod_wsgi. (I use Python 2.6).
The webservice connect to a postgreSQL database with psycopg2 python module.
My problem is that the psycopg2.connection is closed (or destroyed) automatically after a little time (after about 1 or 2 minutes). 
The other hand if I run the server with
ladon2.6ctl testserve
command (http://ladonize.org/index.php/Python_Configuration)
than the server is working and the connection is not closed automatically.
I can't understand why the connection is closed with apache+mod_wsgi and in this case the webserver is very slowly.
Can anyone help me?