Merge lp:~hloeung/ubuntu-repository-cache/extra-server-process into lp:ubuntu-repository-cache

Proposed by Haw Loeung
Status: Merged
Approved by: Haw Loeung
Approved revision: 334
Merged at revision: 332
Proposed branch: lp:~hloeung/ubuntu-repository-cache/extra-server-process
Merge into: lp:ubuntu-repository-cache
Diff against target: 112 lines (+24/-22)
3 files modified
lib/ubuntu_repository_cache/apache.py (+5/-3)
lib/ubuntu_repository_cache/tests/test_apache.py (+15/-15)
tests/unit/test_apache.py (+4/-4)
To merge this branch: bzr merge lp:~hloeung/ubuntu-repository-cache/extra-server-process
Reviewer Review Type Date Requested Status
Paul Collins lgtm Approve
Canonical IS Reviewers Pending
Review via email: mp+399536@code.launchpad.net

Commit message

Allow an additional process to reduce short outages on graceful restart - LP:1918211

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Unable to determine commit message from repository - please click "Set commit message" and enter the commit message manually.

Revision history for this message
Paul Collins (pjdc) wrote :

There's a comment in the code already saying "VMs perform badly with over 2500 workers". I definitely want the extra process, but this this seems like it'll double the number of workers... will that be a problem?

I'm wondering what the performance impact of more processes is. Ideally we want to have one process's worth of threads unused at all times (i'm pretty sure graceful is serialized). The upstream default seems to be StartServers 3....

Revision history for this message
Paul Collins (pjdc) wrote :

For what it's worth (I checked just now out of curiosity) the 100Gbps machines seem to have close to 200 apache2 processes each at the moment.

Revision history for this message
Paul Collins (pjdc) :
review: Approve (lgtm)
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change has no commit message, setting status to needs review.

Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 332

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/ubuntu_repository_cache/apache.py'
--- lib/ubuntu_repository_cache/apache.py 2021-03-10 00:46:28 +0000
+++ lib/ubuntu_repository_cache/apache.py 2021-03-11 23:09:41 +0000
@@ -92,7 +92,9 @@
92 if not config['serverlimit']:92 if not config['serverlimit']:
93 # Benchmarking shows single process multiple threads performs better93 # Benchmarking shows single process multiple threads performs better
94 # than multiple processes multiple threads.94 # than multiple processes multiple threads.
95 config['serverlimit'] = 195 # Unfortunately, we need more than one server process to allow for
96 # graceful restarts. See LP#1918211.
97 config['serverlimit'] = 2
9698
97 if not config['threadsperchild']:99 if not config['threadsperchild']:
98 # We could take into consideration how much memory the system100 # We could take into consideration how much memory the system
@@ -104,8 +106,8 @@
104 # (likely squid-deb-proxy bottleneck). But let's cap it here,106 # (likely squid-deb-proxy bottleneck). But let's cap it here,
105 # someone can override it by setting the107 # someone can override it by setting the
106 # apache2_mpm_threadlimit charm config.108 # apache2_mpm_threadlimit charm config.
107 if config['threadsperchild'] > 2560:109 if (config['threadsperchild'] * config['serverlimit']) > 2560:
108 config['threadsperchild'] = 2560110 config['threadsperchild'] = int(2560 / config['serverlimit'])
109111
110 if not config['threadlimit']:112 if not config['threadlimit']:
111 # Hard limit should match per child limit.113 # Hard limit should match per child limit.
112114
=== modified file 'lib/ubuntu_repository_cache/tests/test_apache.py'
--- lib/ubuntu_repository_cache/tests/test_apache.py 2021-01-31 22:33:24 +0000
+++ lib/ubuntu_repository_cache/tests/test_apache.py 2021-03-11 23:09:41 +0000
@@ -38,12 +38,12 @@
38 }38 }
39 expected = {39 expected = {
40 'startservers': 1,40 'startservers': 1,
41 'minsparethreads': 512,41 'minsparethreads': 1024,
42 'maxsparethreads': 1024,42 'maxsparethreads': 2048,
43 'threadlimit': 1024,43 'threadlimit': 1024,
44 'threadsperchild': 1024,44 'threadsperchild': 1024,
45 'serverlimit': 1,45 'serverlimit': 2,
46 'maxrequestworkers': 1024,46 'maxrequestworkers': 2048,
47 'maxconnectionsperchild': 10000,47 'maxconnectionsperchild': 10000,
48 }48 }
49 self.assertEqual(apache.tune_mpm_configs(config), expected)49 self.assertEqual(apache.tune_mpm_configs(config), expected)
@@ -63,9 +63,9 @@
63 'startservers': 1,63 'startservers': 1,
64 'minsparethreads': 1280,64 'minsparethreads': 1280,
65 'maxsparethreads': 2560,65 'maxsparethreads': 2560,
66 'threadlimit': 2560,66 'threadlimit': 1280,
67 'threadsperchild': 2560,67 'threadsperchild': 1280,
68 'serverlimit': 1,68 'serverlimit': 2,
69 'maxrequestworkers': 2560,69 'maxrequestworkers': 2560,
70 'maxconnectionsperchild': 10000,70 'maxconnectionsperchild': 10000,
71 }71 }
@@ -84,12 +84,12 @@
84 }84 }
85 expected = {85 expected = {
86 'startservers': 1,86 'startservers': 1,
87 'minsparethreads': 128,87 'minsparethreads': 256,
88 'maxsparethreads': 256,88 'maxsparethreads': 512,
89 'threadlimit': 256,89 'threadlimit': 256,
90 'threadsperchild': 256,90 'threadsperchild': 256,
91 'serverlimit': 1,91 'serverlimit': 2,
92 'maxrequestworkers': 256,92 'maxrequestworkers': 512,
93 'maxconnectionsperchild': 10000,93 'maxconnectionsperchild': 10000,
94 }94 }
95 self.assertEqual(apache.tune_mpm_configs(config), expected)95 self.assertEqual(apache.tune_mpm_configs(config), expected)
@@ -107,12 +107,12 @@
107 }107 }
108 expected = {108 expected = {
109 'startservers': 1,109 'startservers': 1,
110 'minsparethreads': 256,110 'minsparethreads': 512,
111 'maxsparethreads': 512,111 'maxsparethreads': 1024,
112 'threadlimit': 512,112 'threadlimit': 512,
113 'threadsperchild': 512,113 'threadsperchild': 512,
114 'serverlimit': 1,114 'serverlimit': 2,
115 'maxrequestworkers': 512,115 'maxrequestworkers': 1024,
116 'maxconnectionsperchild': 10000,116 'maxconnectionsperchild': 10000,
117 }117 }
118 self.assertEqual(apache.tune_mpm_configs(config), expected)118 self.assertEqual(apache.tune_mpm_configs(config), expected)
119119
=== modified file 'tests/unit/test_apache.py'
--- tests/unit/test_apache.py 2021-03-08 21:00:00 +0000
+++ tests/unit/test_apache.py 2021-03-11 23:09:41 +0000
@@ -238,10 +238,10 @@
238 '/etc/apache2/conf-available/000mpm-worker.conf',238 '/etc/apache2/conf-available/000mpm-worker.conf',
239 {239 {
240 'maxconnectionsperchild': 10000,240 'maxconnectionsperchild': 10000,
241 'maxrequestworkers': 512,241 'maxrequestworkers': 1024,
242 'maxsparethreads': 512,242 'maxsparethreads': 1024,
243 'minsparethreads': 256,243 'minsparethreads': 512,
244 'serverlimit': 1,244 'serverlimit': 2,
245 'startservers': 1,245 'startservers': 1,
246 'threadlimit': 512,246 'threadlimit': 512,
247 'threadsperchild': 512,247 'threadsperchild': 512,

Subscribers

People subscribed via source and target branches