From: Michael Tremer Date: Fri, 18 Aug 2023 09:51:10 +0000 (+0000) Subject: database: Don't keep so many connections open and idle X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c5167e8c03b5a2e5e08c7e2192e976d4ad55644b;p=pbs.git database: Don't keep so many connections open and idle Since we usually peak briefly, we will fork a lot of PostgreSQL processes that we will never need again. In order to avoid wasting too much memory, we close those connections quicker, but at least 8 open so that new tasks will quickly be able to acquire a database connection. Signed-off-by: Michael Tremer --- diff --git a/src/buildservice/database.py b/src/buildservice/database.py index a6fda988..4aab4ff8 100644 --- a/src/buildservice/database.py +++ b/src/buildservice/database.py @@ -51,14 +51,14 @@ class Connection(object): configure=self.__configure, # Set limits for min/max connections in the pool - min_size=4, + min_size=8, max_size=128, # Give clients up to one minute to retrieve a connection timeout=60, - # Close connections after they have been idle for one minute - max_idle=60, + # Close connections after they have been idle for 15 seconds + max_idle=15, ) def __configure(self, conn):