djangosnippets.org: Latest snippets tagged with 'persistent'https://djangosnippets.org/tags/persistent/2013-06-28T01:48:51.902847-05:00Multi-DB Reconnecting Persistent Postgres Connection
2013-06-28T01:48:51.902847-05:00cronosahttps://djangosnippets.org/snippets/2965/<p>This is a modification of http://djangosnippets.org/snippets/1707/ that handles the database going down or PG Bouncer killing the connection. This also works in things like Twisted to make sure the connection is alive before doing a real query. Thanks @mike_tk for the original post!</p>
<p>EDIT: Updated the wrapper to handle multi-db. …</p>
Freely redistributablePersistent connection to PostgreSQL database
2009-08-29T07:02:43.120048-05:00mike_tkhttps://djangosnippets.org/snippets/1707/<p>Hi, </p>
<p>I made some small custom psycopg2 backend that implements persistent connection using global variable. With this I was able to improve the amout of requests per second from 350 to 1600 (on very simple page with few selects) Just save it in the file called base.py in any directory …</p>
Freely redistributable