I'm using web2py 2.9.5-stable+timestamp.2014.03.15.21.24.06 in a Linode [1] server (a VPS with 4 cores, 4gbs of ram, and SSD storage). The server uses Ubuntu server 12.04, and there I have multiple instances of web2py running with lighttpd and python flup [2].
Those multiple instances of web2py correspond to serveral websites, all running an exact same copy of my web2py app, each one with it's own database. The database server is PostgreSQL. All the instances of web2py connect to their database using pool_size parameter [3] with a value of 20. In the other hand, I have set max_connections parameter in postgresql.conf with a value of 50. Yesterday, I added an new website (a new instance of web2py with the same app that the others), and I started to see intermitent http 500 errors, and this error in web2py log: <type 'exceptions.RuntimeError'> Failure to connect, tried 5 times: Traceback (most recent call last): File "/var/www/ejemplo/gluon/dal.py", line 7845, in __init__ self._adapter = ADAPTERS[self._dbname](**kwargs) File "/var/www/ejemplo/gluon/dal.py", line 688, in __call__ obj = super(AdapterMeta, cls).__call__(*args, **kwargs) File "/var/www/ejemplo/gluon/dal.py", line 2870, in __init__ if do_connect: self.reconnect() File "/var/www/ejemplo/gluon/dal.py", line 669, in reconnect self.connection = f() File "/var/www/ejemplo/gluon/dal.py", line 2868, in connector return self.driver.connect(msg,**driver_args) File "/usr/lib/python2.7/dist-packages/psycopg2/__init__.py", line 179, in connect connection_factory=connection_factory, async=async) OperationalError: FATAL: remaining connection slots are reserved for non-replication superuser connections I analyzed the "pg_stat_activity" table on postgresql, and I see always around 5 idle connections per web2py instance. First doubt there: should this number be more close to the "pool_size" parameter specified on db.py? Anyway, today I changed the "max_connections" parameter in postgresql.conf to a value of 75, and the errors apparently disappear, but I don't fully understand the situation. In addition, I can see that the postgres takes up to 1.5gb of used ram, and I don't know if that's ok. So, I'm wondering if I should try setting pool_size in 0 (that is, disable web2py's connection pooling) and enabling some external pooling software like pgBouncer [4]. Any tip or comment will be very appreciated. Thanks in advance. [1] - https://www.linode.com/ [2] - https://pypi.python.org/pypi/flup [3] - http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Connection-pooling [4] - https://wiki.postgresql.org/wiki/PgBouncer -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

