| 39 | |
| 40 | == Trac with PostgreSQL == |
| 41 | |
| 42 | When using the mod_wsgi adapter with multiple Trac instances and PostgreSQL (or MySQL?) as a database back-end the server can get a lot of open database connections. (and thus PostgreSQL processes) |
| 43 | |
| 44 | A workable solution is to disabled connection pooling in Trac. This is done by setting poolable = False in trac.db.postgres_backend on the PostgreSQLConnection class. |
| 45 | |
| 46 | But it's not necessary to edit the source of trac, the following lines in trac.wsgi will also work: |
| 47 | |
| 48 | {{{ |
| 49 | import trac.db.postgres_backend |
| 50 | trac.db.postgres_backend.PostgreSQLConnection.poolable = False |
| 51 | }}} |
| 52 | |
| 53 | Now Trac drops the connection after serving a page and the connection count on the database will be kept minimal. |