Slide 1

Slide 1 text

Network Protocols & Servers Extracting performance gains like a crazy person

Slide 2

Slide 2 text

Philip Tellis Principal RUM Distiller @ Akamai Author of the OpenSource boomerang RUM library twitter:@bluesmoon ⦿ github:@bluesmoon speakerdeck:@bluesmoon

Slide 3

Slide 3 text

Sort in ascending order of signal latency ● Electrons through copper ● Light through fibre ● Pulsars ● Station Wagons ● Smoke Signals

Slide 4

Slide 4 text

Sort in ascending order of signal latency 1. Pulsars (light through vacuum) 2. Smoke Signals (light through air) 3. Electrons through copper / Light through fibre 4. Station Wagons — highest bandwidth loaded with

Slide 5

Slide 5 text

TCP Handshake and Congestion Control https://www.cdnplanet.com/blog/tune-tcp-initcwnd-for-optimum-performance/

Slide 6

Slide 6 text

initcwnd The Initial Congestion Window is the number of packets that a TCP peer waits for before sending an acknowledgement. Lower values increase latency, higher values increase probability of error.

Slide 7

Slide 7 text

initcwnd @mobtec

Slide 8

Slide 8 text

initcwnd With the current value set at 10, how many bytes can you send across before you have to wait for an ACK?

Slide 9

Slide 9 text

https://www.imperva.com/blog/mtu-mss-explained/ MTU & MSS

Slide 10

Slide 10 text

Slow Start The kernel will reset Slow Start windows once a connection goes idle. net.ipv4.tcp_slow_start_after_idle=0 https://hpbn.co/building-blocks-of-tcp/

Slide 11

Slide 11 text

Then there’s Fast Open Client can send the first data packet along with the ACK net.ipv4.tcp_fastopen=3 listen 80 fastopen=256 https://lwn.net/Articles/508865/

Slide 12

Slide 12 text

Wireshark Demo Doo Doo...

Slide 13

Slide 13 text

H2 Prioritization ● Browser opens a single TCP connection to a domain regardless of number of resources ● Browser tells server about all required resources ● Browser includes hints based on dependencies ● Server can optionally decide which resources to send in parallel to the browser based on availability and hints

Slide 14

Slide 14 text

H2 Push ● Client request an HTML page ● Server sends back page and other same-domain assets on the same response Link: ; rel=preload; as=style, ; rel=preload; as=script ● Pushing only the CSS seems to have the most benefit, but YMMV ● Definitely don’t overpush https://www.smashingmagazine.com/2017/04/guide-http2-server-push/

Slide 15

Slide 15 text

QUIC / HTTP3 ● Quick UDP Internet Connections ● Send HTTP over UDP rather than TCP ● Application layer takes care of ACKs and retries > performance.getEntriesByType("navigation")[0].nextHopProtocol "http/2+quic/43"

Slide 16

Slide 16 text

Summary ● Split your bundles up into smaller chunks ● Use the Link header to push as it falls back to a preload hint ● Use wireshark to get detailed debugging about network behaviour ● Configure TCP Slow Start and Fast Open correctly.

Slide 17

Slide 17 text

References ● High Performance Browser Networking (book) ● Tune Initial Congestion Window for optimal performance ● initcwnd settings of major CDNs ● Optimizing TCP slow start ● TCP Fast Open – Expediting web services ● Performance Impacts of H2 Prioritization ● Visualizing H2 Prioritization ● Complete guide to H2 Push ● H2 Push is tougher than I thought ● HTTP/3 is coming ● Transmission Control Protocol (TCP) ● The difference between TCP & UDP ● TCP Congestion Control ● Building blocks of TCP ● Maximum Transmission Unit (MTU) ● Maximum Segment Size (MSS) ● MTU & MSS explained ● Latency Improvements by Tuning initcwnd ● Wireshark ● HTTP/3 / IETF draft

Slide 18

Slide 18 text

Thank You!