Merge lp:~hloeung/ubuntu-repository-cache/squid-cache-eviction-watermarks into lp:ubuntu-repository-cache

Proposed by Haw Loeung
Status: Merged
Approved by: Haw Loeung
Approved revision: 343
Merged at revision: 343
Proposed branch: lp:~hloeung/ubuntu-repository-cache/squid-cache-eviction-watermarks
Merge into: lp:ubuntu-repository-cache
Diff against target: 84 lines (+34/-2)
5 files modified
.bzrignore (+1/-0)
charmcraft.yaml (+17/-0)
config.yaml (+12/-0)
lib/ubuntu_repository_cache/squid.py (+2/-0)
templates/squid-deb-proxy/squid-deb-proxy.conf (+2/-2)
To merge this branch: bzr merge lp:~hloeung/ubuntu-repository-cache/squid-cache-eviction-watermarks
Reviewer Review Type Date Requested Status
Paul Collins lgtm Approve
Canonical IS Reviewers Pending
Review via email: mp+423130@code.launchpad.net

Commit message

Allow overriding squid-cache's watermark thresholds (cache_swap_low & cache_swap_high) to tune memory usage

To post a comment you must log in.
Revision history for this message
Paul Collins (pjdc) :
review: Approve (lgtm)
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 :

Change successfully merged at revision 343

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2021-02-22 00:49:41 +0000
3+++ .bzrignore 2022-05-23 03:31:53 +0000
4@@ -10,6 +10,7 @@
5 .tox/
6 .cache/
7 __pycache__/
8+build/
9 builds/
10 deps/
11 repo-info
12
13=== added file 'charmcraft.yaml'
14--- charmcraft.yaml 1970-01-01 00:00:00 +0000
15+++ charmcraft.yaml 2022-05-23 03:31:53 +0000
16@@ -0,0 +1,17 @@
17+type: "charm"
18+bases:
19+ - build-on:
20+ - name: "ubuntu"
21+ channel: "20.04"
22+ - name: "ubuntu"
23+ channel: "22.04"
24+ run-on:
25+ - name: "ubuntu"
26+ channel: "20.04"
27+ - name: "ubuntu"
28+ channel: "22.04"
29+parts:
30+ charm:
31+ source: .
32+ plugin: reactive
33+ build-snaps: [charm]
34
35=== modified file 'config.yaml'
36--- config.yaml 2021-03-09 04:28:19 +0000
37+++ config.yaml 2022-05-23 03:31:53 +0000
38@@ -83,6 +83,18 @@
39 description: |
40 Configurable option (in MBytes) to tune/override storage used by
41 squid cache. If 0 or unset, then auto-calculate.
42+ cache-swap-high:
43+ default: 85
44+ type: int
45+ description: |
46+ Configurable option to tune/override the high-water mark for cache object
47+ eviction.
48+ cache-swap-low:
49+ default: 80
50+ type: int
51+ description: |
52+ Configurable option to tune/override the low-water mark for cache object
53+ eviction.
54 nagios_context:
55 default: 'juju'
56 type: string
57
58=== modified file 'lib/ubuntu_repository_cache/squid.py'
59--- lib/ubuntu_repository_cache/squid.py 2021-03-10 00:53:26 +0000
60+++ lib/ubuntu_repository_cache/squid.py 2022-05-23 03:31:53 +0000
61@@ -196,6 +196,8 @@
62 context['Cache_Storage_Config'] = cache_dirs()
63 context['Cache_Peers'] = peer_config()
64 context['Cache_Hostname'] = hookenv.unit_private_ip()
65+ context['Cache_Swap_Low'] = config.get('cache-swap-low', 80)
66+ context['Cache_Swap_High'] = config.get('cache-swap-high', 85)
67 if config['squid_snmp']:
68 context[
69 'Snmp_Config'
70
71=== modified file 'templates/squid-deb-proxy/squid-deb-proxy.conf'
72--- templates/squid-deb-proxy/squid-deb-proxy.conf 2021-06-08 03:24:12 +0000
73+++ templates/squid-deb-proxy/squid-deb-proxy.conf 2022-05-23 03:31:53 +0000
74@@ -42,8 +42,8 @@
75 {{ Cache_Storage_Config }}
76
77 # Cache swap more aggressive to avoid having the cache size going above the cache_dir size parameter
78-cache_swap_low 80
79-cache_swap_high 85
80+cache_swap_low {{ Cache_Swap_Low }}
81+cache_swap_high {{ Cache_Swap_High }}
82
83 # use different logs
84 cache_log /var/log/squid-deb-proxy/cache.log

Subscribers

People subscribed via source and target branches