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
1=== modified file 'config.yaml'
2--- config.yaml 2022-08-04 00:42:20 +0000
3+++ config.yaml 2022-08-22 02:16:14 +0000
4@@ -179,6 +179,10 @@
5 description: >
6 Use daily extension like YYYMMDD instead of simply adding a number
7 default: True
8+ squid_dns_v4_first:
9+ type: boolean
10+ default: false
11+ description: If true, prefer IPv4 addresses for dual-stack sites.
12 squid_snmp:
13 type: boolean
14 description: >
15
16=== modified file 'lib/ubuntu_repository_cache/squid.py'
17--- lib/ubuntu_repository_cache/squid.py 2022-07-27 01:20:17 +0000
18+++ lib/ubuntu_repository_cache/squid.py 2022-08-22 02:16:14 +0000
19@@ -190,6 +190,8 @@
20 LOG('Rendering squid configuration templates')
21 config = hookenv.config()
22 context = {}
23+ context['DNS_v4_First'] = config.get('squid_dns_v4_first')
24+
25 # cache_mem() needs to be called before cache_dirs() as it sets
26 # unitdata.kv().get('squid-cache-disk').
27 context['Cache_Memory_Config'] = cache_mem()
28
29=== modified file 'templates/squid-deb-proxy/squid-deb-proxy.conf'
30--- templates/squid-deb-proxy/squid-deb-proxy.conf 2022-07-25 01:16:01 +0000
31+++ templates/squid-deb-proxy/squid-deb-proxy.conf 2022-08-22 02:16:14 +0000
32@@ -62,6 +62,10 @@
33
34 collapsed_forwarding on
35
36+{% if DNS_v4_First %}
37+dns_v4_first on
38+{%- endif %}
39+
40 # pid
41 pid_filename /var/run/squid-deb-proxy.pid
42

Subscribers

People subscribed via source and target branches