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 Mergebot (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 Mergebot (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 Mergebot (canonical-is-mergebot) wrote :

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

Revision history for this message
Canonical IS Mergebot (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
1=== modified file 'lib/ubuntu_repository_cache/apache.py'
2--- lib/ubuntu_repository_cache/apache.py 2021-03-10 00:46:28 +0000
3+++ lib/ubuntu_repository_cache/apache.py 2021-03-11 23:09:41 +0000
4@@ -92,7 +92,9 @@
5 if not config['serverlimit']:
6 # Benchmarking shows single process multiple threads performs better
7 # than multiple processes multiple threads.
8- config['serverlimit'] = 1
9+ # Unfortunately, we need more than one server process to allow for
10+ # graceful restarts. See LP#1918211.
11+ config['serverlimit'] = 2
12
13 if not config['threadsperchild']:
14 # We could take into consideration how much memory the system
15@@ -104,8 +106,8 @@
16 # (likely squid-deb-proxy bottleneck). But let's cap it here,
17 # someone can override it by setting the
18 # apache2_mpm_threadlimit charm config.
19- if config['threadsperchild'] > 2560:
20- config['threadsperchild'] = 2560
21+ if (config['threadsperchild'] * config['serverlimit']) > 2560:
22+ config['threadsperchild'] = int(2560 / config['serverlimit'])
23
24 if not config['threadlimit']:
25 # Hard limit should match per child limit.
26
27=== modified file 'lib/ubuntu_repository_cache/tests/test_apache.py'
28--- lib/ubuntu_repository_cache/tests/test_apache.py 2021-01-31 22:33:24 +0000
29+++ lib/ubuntu_repository_cache/tests/test_apache.py 2021-03-11 23:09:41 +0000
30@@ -38,12 +38,12 @@
31 }
32 expected = {
33 'startservers': 1,
34- 'minsparethreads': 512,
35- 'maxsparethreads': 1024,
36+ 'minsparethreads': 1024,
37+ 'maxsparethreads': 2048,
38 'threadlimit': 1024,
39 'threadsperchild': 1024,
40- 'serverlimit': 1,
41- 'maxrequestworkers': 1024,
42+ 'serverlimit': 2,
43+ 'maxrequestworkers': 2048,
44 'maxconnectionsperchild': 10000,
45 }
46 self.assertEqual(apache.tune_mpm_configs(config), expected)
47@@ -63,9 +63,9 @@
48 'startservers': 1,
49 'minsparethreads': 1280,
50 'maxsparethreads': 2560,
51- 'threadlimit': 2560,
52- 'threadsperchild': 2560,
53- 'serverlimit': 1,
54+ 'threadlimit': 1280,
55+ 'threadsperchild': 1280,
56+ 'serverlimit': 2,
57 'maxrequestworkers': 2560,
58 'maxconnectionsperchild': 10000,
59 }
60@@ -84,12 +84,12 @@
61 }
62 expected = {
63 'startservers': 1,
64- 'minsparethreads': 128,
65- 'maxsparethreads': 256,
66+ 'minsparethreads': 256,
67+ 'maxsparethreads': 512,
68 'threadlimit': 256,
69 'threadsperchild': 256,
70- 'serverlimit': 1,
71- 'maxrequestworkers': 256,
72+ 'serverlimit': 2,
73+ 'maxrequestworkers': 512,
74 'maxconnectionsperchild': 10000,
75 }
76 self.assertEqual(apache.tune_mpm_configs(config), expected)
77@@ -107,12 +107,12 @@
78 }
79 expected = {
80 'startservers': 1,
81- 'minsparethreads': 256,
82- 'maxsparethreads': 512,
83+ 'minsparethreads': 512,
84+ 'maxsparethreads': 1024,
85 'threadlimit': 512,
86 'threadsperchild': 512,
87- 'serverlimit': 1,
88- 'maxrequestworkers': 512,
89+ 'serverlimit': 2,
90+ 'maxrequestworkers': 1024,
91 'maxconnectionsperchild': 10000,
92 }
93 self.assertEqual(apache.tune_mpm_configs(config), expected)
94
95=== modified file 'tests/unit/test_apache.py'
96--- tests/unit/test_apache.py 2021-03-08 21:00:00 +0000
97+++ tests/unit/test_apache.py 2021-03-11 23:09:41 +0000
98@@ -238,10 +238,10 @@
99 '/etc/apache2/conf-available/000mpm-worker.conf',
100 {
101 'maxconnectionsperchild': 10000,
102- 'maxrequestworkers': 512,
103- 'maxsparethreads': 512,
104- 'minsparethreads': 256,
105- 'serverlimit': 1,
106+ 'maxrequestworkers': 1024,
107+ 'maxsparethreads': 1024,
108+ 'minsparethreads': 512,
109+ 'serverlimit': 2,
110 'startservers': 1,
111 'threadlimit': 512,
112 'threadsperchild': 512,

Subscribers

People subscribed via source and target branches