Skip to content

Commit 1e6aaf1

Browse files
committed
Some experimental tweaks to postgresql backend conn pool in order to address some issues seen under load.
1 parent b40e6bb commit 1e6aaf1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

credenza/api/session/storage/backends/postgresql.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def __init__(self, url: str = "postgresql:///credenza", idle_timeout: int = 60,
7878
# TODO: add configuration for minconn, maxconn here?
7979
self.dsn = url
8080
minconn = 1 # need to keep an idle connection open to really benefit from pool?
81-
maxconn = 4
81+
maxconn = 6
8282
self.pool = psycopg2.pool.ThreadedConnectionPool(minconn, maxconn, dsn=url, connection_factory=connection)
8383
logger.debug(f"Using threaded connection pool for PostgreSQL: minconn={minconn} maxconn={maxconn} url={self.dsn}")
8484
self.idle_timeout = idle_timeout
@@ -88,7 +88,7 @@ def _get_conn(self):
8888
conn = self.pool.getconn()
8989
if self.trace:
9090
logger.debug(f"Got pooled connection dsn={conn.dsn} status={conn.status}")
91-
conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_REPEATABLE_READ)
91+
conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_READ_COMMITTED)
9292
return conn
9393

9494
def _put_conn(self, conn):

0 commit comments

Comments
 (0)