Merge lp:~hloeung/ubuntu-repository-cache/ipv4-over-ipv6 into lp:ubuntu-repository-cache

Proposed by Haw Loeung
Status: Merged
Approved by: Haw Loeung
Approved revision: 336
Merged at revision: 378
Proposed branch: lp:~hloeung/ubuntu-repository-cache/ipv4-over-ipv6
Merge into: lp:ubuntu-repository-cache
Diff against target: 41 lines (+10/-0)
3 files modified
config.yaml (+4/-0)
lib/ubuntu_repository_cache/squid.py (+2/-0)
templates/squid-deb-proxy/squid-deb-proxy.conf (+4/-0)
To merge this branch: bzr merge lp:~hloeung/ubuntu-repository-cache/ipv4-over-ipv6
Reviewer Review Type Date Requested Status
Barry Price Approve
Canonical IS Reviewers Pending
Review via email: mp+399958@code.launchpad.net

Commit message

Allow overriding squid to prefer IPv4 over IPv6 for requests to upstream Ubuntu Archive servers/backend

In some cases, IPv4 results in lower latency, in others it can be an issue with connectivity.

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
Haw Loeung (hloeung) wrote :

See Ben's finding where there appears to be network related issues between an AWS region and us - https://pastebin.canonical.com/p/GB5rKBJjsm/

Also from a unit within that same region. IPv4:

| [hloeung@aerodent ~]$ ping -c 5 54.251.159.151
| PING 54.251.159.151 (54.251.159.151) 56(84) bytes of data.
| 64 bytes from 54.251.159.151: icmp_seq=1 ttl=49 time=153 ms
| 64 bytes from 54.251.159.151: icmp_seq=2 ttl=49 time=153 ms
| 64 bytes from 54.251.159.151: icmp_seq=3 ttl=49 time=153 ms
| 64 bytes from 54.251.159.151: icmp_seq=4 ttl=49 time=153 ms
| 64 bytes from 54.251.159.151: icmp_seq=5 ttl=49 time=153 ms
|
| --- 54.251.159.151 ping statistics ---
| 5 packets transmitted, 5 received, 0% packet loss, time 4000ms
| rtt min/avg/max/mdev = 153.173/153.239/153.318/0.354 ms

Now IPv6:

| [hloeung@aerodent ~]$ ping6 -c 5 2406:da18:395:c800:5609:e9e4:9c2d:c153
| PING 2406:da18:395:c800:5609:e9e4:9c2d:c153(2406:da18:395:c800:5609:e9e4:9c2d:c153) 56 data bytes
| 64 bytes from 2406:da18:395:c800:5609:e9e4:9c2d:c153: icmp_seq=1 ttl=240 time=174 ms
| 64 bytes from 2406:da18:395:c800:5609:e9e4:9c2d:c153: icmp_seq=2 ttl=240 time=171 ms
| 64 bytes from 2406:da18:395:c800:5609:e9e4:9c2d:c153: icmp_seq=3 ttl=240 time=171 ms
| 64 bytes from 2406:da18:395:c800:5609:e9e4:9c2d:c153: icmp_seq=4 ttl=240 time=172 ms
| 64 bytes from 2406:da18:395:c800:5609:e9e4:9c2d:c153: icmp_seq=5 ttl=240 time=174 ms
|
| --- 2406:da18:395:c800:5609:e9e4:9c2d:c153 ping statistics ---
| 5 packets transmitted, 5 received, 0% packet loss, time 4004ms
| rtt min/avg/max/mdev = 171.435/172.981/174.714/1.454 ms

That's ~20ms lower via IPv4.

Revision history for this message
Barry Price (barryprice) wrote :

LGTM +1

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

Change successfully merged at revision 378

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'config.yaml'
--- config.yaml 2022-08-04 00:42:20 +0000
+++ config.yaml 2022-08-22 02:16:14 +0000
@@ -179,6 +179,10 @@
179 description: >179 description: >
180 Use daily extension like YYYMMDD instead of simply adding a number180 Use daily extension like YYYMMDD instead of simply adding a number
181 default: True181 default: True
182 squid_dns_v4_first:
183 type: boolean
184 default: false
185 description: If true, prefer IPv4 addresses for dual-stack sites.
182 squid_snmp:186 squid_snmp:
183 type: boolean187 type: boolean
184 description: >188 description: >
185189
=== modified file 'lib/ubuntu_repository_cache/squid.py'
--- lib/ubuntu_repository_cache/squid.py 2022-07-27 01:20:17 +0000
+++ lib/ubuntu_repository_cache/squid.py 2022-08-22 02:16:14 +0000
@@ -190,6 +190,8 @@
190 LOG('Rendering squid configuration templates')190 LOG('Rendering squid configuration templates')
191 config = hookenv.config()191 config = hookenv.config()
192 context = {}192 context = {}
193 context['DNS_v4_First'] = config.get('squid_dns_v4_first')
194
193 # cache_mem() needs to be called before cache_dirs() as it sets195 # cache_mem() needs to be called before cache_dirs() as it sets
194 # unitdata.kv().get('squid-cache-disk').196 # unitdata.kv().get('squid-cache-disk').
195 context['Cache_Memory_Config'] = cache_mem()197 context['Cache_Memory_Config'] = cache_mem()
196198
=== modified file 'templates/squid-deb-proxy/squid-deb-proxy.conf'
--- templates/squid-deb-proxy/squid-deb-proxy.conf 2022-07-25 01:16:01 +0000
+++ templates/squid-deb-proxy/squid-deb-proxy.conf 2022-08-22 02:16:14 +0000
@@ -62,6 +62,10 @@
6262
63collapsed_forwarding on63collapsed_forwarding on
6464
65{% if DNS_v4_First %}
66dns_v4_first on
67{%- endif %}
68
65# pid69# pid
66pid_filename /var/run/squid-deb-proxy.pid70pid_filename /var/run/squid-deb-proxy.pid
6771

Subscribers

People subscribed via source and target branches