How to make the Internet faster

Tamara Zoe Schmitz

September 17 2022

What

  • Writing better applications
  • Tuning your servers and hosting
  • Improving user networks

Me

  • Apprentice since Autumn 2020 at a Linux Distributor
  • Likes server hosting things, storage, networked thingies
  • Reads RFCs, IETFs, kernel code and documentation
  • Does system level C, Python, Bash and a little Ruby
  • Likes to present other people’s work

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Writing better applications

REST Example Part 1
REST Example Part 2
REST Example Part 3

Round Trip Time

An HTTPS 1.1 TLS1.2 Request

Let’s count

  • 30ms times 8 RTTs = 240ms
  • 150ms times 8 RTTs = 1200ms
  • 240ms times 50 Requests = 12.000s
  • 1200ms times 50 Requests = 60.000s

Reuse the connection!

REST Example Improved

Reuse connections in the Web!

  • Connect to webserver and download HTML
  • Parse the HTML
  • Our CSS is in another castle
  • Connect to other webserver and download CSS
  • Parse stylesheet
  • Start rendering page

Don’t:

Do:

  • JS and CSS library CDNs are not pratically better
  • If you need a CDN, use a CDN
  • Cross Site Resource caching is dead
  • External embedded images or videos are fine

Tuning your servers

Good old TCP

  • connection oriented
  • detects errors and asks for retransmissions
  • guarantees send order
  • has you acknowledge packets
  • employs network congestion avoidance
Downloading 908MiB
Start of downloading 908MiB
tcptrace downloading 908MiB
Downloading 539KiB
tcptrace downloading 539KiB

Congestion Control

  • Default on Linux: cubic

  • Default on FreeBSD: newreno

  • Default for Torrents: ledbat

BBR

  • Delay based congestion detection not just lost based congestion detection
  • More aggresive probing

https://blog.cloudflare.com/http-2-prioritization-with-nginx/

/etc/sysctl.d/custom.conf

net.ipv4.tcp_congestion_control=bbr
net.ipv4.tcp_notsent_lowat=16384
net.core.default_qdisc=fq

https://grapheneos.org/articles/server-traffic-shaping

Use a newer HTTP version

Apache:

<VirtualHost ...>
    Protocols h2 h2c http/1.1
</VirtualHost>

Nginx:

server {
    listen 443 ssl http2;
}

Improving user networks

Want some cake?

Data path

  • Bufferbloat is when your hops buffer too much
  • Buffers too small -> low throughput
  • Buffers too big -> high latency
Speedtest in IGER WiFi on Fast.com
  • Latency without load != Latency under load
  • Latency rises if slowest link is highly utilised
  • -> Should notify about congestion to avoid peak utilisation
  • –> Drop Packets or add a controlled delay

Cake Gains:

  • Consistent Latency
  • Simultaneous Low Latency Voice Calls and Steam Downloads
  • Fast web and apps

Cake Caveats:

  • Requires static knowledge of maximum link speed (-> not suitable for mobile)
  • Usually 5-10% throughput loss
  • Breaks NAT offloading

Thanks!

Presentation available at:

https://0x90.space/tamara-iger-talk/

Created with pandoc and reveal.js