Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Understanding Network Protocols & Server Config...

Understanding Network Protocols & Server Configuration

In the previous talk, we covered some easy wins with performance optimisation. In this talk, we’ll look at aspects of frontend performance that need to be tuned or fixed server-side, either via a web server, or operating system configuration.

We’ll look at HTTP level questions like:
* How does H2 prioritization work?
* How does H2 push work?
* What is QUIC (HTTP/3)?

We’ll also look at TCP level questions like:
* What are MTU, MSS, and TCP Windows and how do they affect performance?
* What are TCP slow-start and fast-open?
* How to use Wireshark to study network activity?

At the end of this session, attendees will understand how to debug low network level performance problems, and configure systems for performance improvements.

Philip Tellis

May 22, 2019
Tweet

More Decks by Philip Tellis

Other Decks in Technology

Transcript

  1. Philip Tellis Principal RUM Distiller @ Akamai Author of the

    OpenSource boomerang RUM library twitter:@bluesmoon ⦿ github:@bluesmoon speakerdeck:@bluesmoon
  2. Sort in ascending order of signal latency • Electrons through

    copper • Light through fibre • Pulsars • Station Wagons • Smoke Signals
  3. 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
  4. 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.
  5. initcwnd With the current value set at 10, how many

    bytes can you send across before you have to wait for an ACK?
  6. 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/
  7. 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/
  8. 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
  9. H2 Push • Client request an HTML page • Server

    sends back page and other same-domain assets on the same response Link: </css/styles.css>; rel=preload; as=style, </js/scripts.js>; 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/
  10. 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"
  11. 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.
  12. 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