Merge ~blake-rouse/maas:lower-max-conns-per-worker into maas:master

Proposed by Blake Rouse
Status: Merged
Approved by: Blake Rouse
Approved revision: 62dec0c9d462133639f12821f5e36d4a117370bd
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~blake-rouse/maas:lower-max-conns-per-worker
Merge into: maas:master
Diff against target: 20 lines (+8/-1)
1 file modified
src/maasserver/utils/threads.py (+8/-1)
Reviewer Review Type Date Requested Status
Newell Jensen (community) Approve
Review via email: mp+327011@code.launchpad.net

Commit message

Lower the maximum number of connections per worker to 9 connections is allowed as 1 is reserved for the `PostgresListener`.

Allowing each worker to have a maximum of 10 connections open at a time. A region controller with 4 workers will use a maximum of 40 connections. This allows 2 region controllers to run without needing to increase the maximum number of PostgreSQL connection (default is 100 connections).

Description of the change

Without this change just running 2 region controllers would result in too many connections to PostgreSQL.

To post a comment you must log in.
Revision history for this message
Newell Jensen (newell-jensen) wrote :

LGTM

review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :

LANDING
-b lower-max-conns-per-worker lp:~blake-rouse/maas into -b master lp:~maas-committers/maas

STATUS: FAILED BUILD
LOG: http://ci-maas-jenkins.internal:8080/job/maas/job/branch-tester/73/console

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/maasserver/utils/threads.py b/src/maasserver/utils/threads.py
2index 0528d12..38a847b 100644
3--- a/src/maasserver/utils/threads.py
4+++ b/src/maasserver/utils/threads.py
5@@ -38,7 +38,14 @@ from twisted.internet.defer import DeferredSemaphore
6
7
8 max_threads_for_default_pool = 50
9-max_threads_for_database_pool = 20
10+
11+# Maximum number of database connections this worker can use. 9 connections is
12+# allowed as 1 is reserved for the `PostgresListener`. Allowing each worker to
13+# have a maximum of 10 connections open at a time. A region controller with
14+# 4 workers will use a maximum of 40 connections. This allows 2 region
15+# controllers to run without needing to increase the maximum number of
16+# PostgreSQL connection (default is 100 connections).
17+max_threads_for_database_pool = 9
18
19
20 def make_default_pool(maxthreads=max_threads_for_default_pool):

Subscribers

People subscribed via source and target branches