O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

High Performance Browser Networking

Book Description

How prepared are you to build fast and efficient web applications? This eloquent book provides what every web developer should know about the network, from fundamental limitations that affect performance to major innovations for building even more powerful browser applications—including HTTP 2.0 and XHR improvements, Server-Sent Events (SSE), WebSocket, and WebRTC.

Author Ilya Grigorik, a web performance engineer at Google, demonstrates performance optimization best practices for TCP, UDP, and TLS protocols, and explains unique wireless and mobile network optimization requirements. You’ll then dive into performance characteristics of technologies such as HTTP 2.0, client-side network scripting with XHR, real-time streaming with SSE and WebSocket, and P2P communication with WebRTC.

  • Deliver superlative TCP, UDP, and TLS performance
  • Speed up network performance over 3G/4G mobile networks
  • Develop fast and energy-efficient mobile applications
  • Address bottlenecks in HTTP 1.x and other browser protocols
  • Plan for and deliver the best HTTP 2.0 performance
  • Enable efficient real-time streaming in the browser
  • Create efficient peer-to-peer videoconferencing and low-latency applications with real-time WebRTC transports

Table of Contents

  1. Foreword
  2. Preface
    1. About This Book
    2. Conventions Used in This Book
    3. Safari® Books Online
    4. How to Contact Us
    5. Content Updates
      1. May 23, 2014
  3. I. Networking 101
    1. 1. Primer on Latency and Bandwidth
      1. Speed Is a Feature
      2. The Many Components of Latency
      3. Speed of Light and Propagation Latency
      4. Last-Mile Latency
      5. Bandwidth in Core Networks
      6. Bandwidth at the Network Edge
      7. Delivering Higher Bandwidth and Lower Latencies
    2. 2. Building Blocks of TCP
      1. Three-Way Handshake
      2. Congestion Avoidance and Control
        1. Flow Control
        2. Slow-Start
        3. Congestion Avoidance
      3. Bandwidth-Delay Product
      4. Head-of-Line Blocking
      5. Optimizing for TCP
        1. Tuning Server Configuration
        2. Tuning Application Behavior
        3. Performance Checklist
    3. 3. Building Blocks of UDP
      1. Null Protocol Services
      2. UDP and Network Address Translators
        1. Connection-State Timeouts
        2. NAT Traversal
        3. STUN, TURN, and ICE
      3. Optimizing for UDP
    4. 4. Transport Layer Security (TLS)
      1. Encryption, Authentication, and Integrity
      2. TLS Handshake
        1. RSA, Diffie-Hellman and Forward Secrecy
        2. Application Layer Protocol Negotiation (ALPN)
        3. Server Name Indication (SNI)
      3. TLS Session Resumption
        1. Session Identifiers
        2. Session Tickets
      4. Chain of Trust and Certificate Authorities
      5. Certificate Revocation
        1. Certificate Revocation List (CRL)
        2. Online Certificate Status Protocol (OCSP)
      6. TLS Record Protocol
      7. Optimizing for TLS
        1. Computational Costs
        2. Early Termination
        3. Session Caching and Stateless Resumption
        4. TLS False Start
        5. TLS Record Size
        6. TLS Compression
        7. Certificate-Chain Length
        8. OCSP Stapling
        9. HTTP Strict Transport Security (HSTS)
      8. Performance Checklist
      9. Testing and Verification
  4. II. Performance of Wireless Networks
    1. 5. Introduction to Wireless Networks
      1. Ubiquitous Connectivity
      2. Types of Wireless Networks
      3. Performance Fundamentals of Wireless Networks
        1. Bandwidth
        2. Signal Power
        3. Modulation
      4. Measuring Real-World Wireless Performance
    2. 6. WiFi
      1. From Ethernet to a Wireless LAN
      2. WiFi Standards and Features
      3. Measuring and Optimizing WiFi Performance
        1. Packet Loss in WiFi Networks
      4. Optimizing for WiFi Networks
        1. Leverage Unmetered Bandwidth
        2. Adapt to Variable Bandwidth
        3. Adapt to Variable Latency
    3. 7. Mobile Networks
      1. Brief History of the G’s
        1. First Data Services with 2G
        2. 3GPP and 3GPP2 Partnerships
        3. Evolution of 3G Technologies
          1. Evolution of 3GPP technologies
          2. Evolution of 3GPP2 technologies
        4. IMT-Advanced 4G Requirements
        5. Long Term Evolution (LTE)
        6. HSPA+ is Leading Worldwide 4G Adoption
        7. Building for the Multigeneration Future
      2. Device Features and Capabilities
        1. User Equipment Category
      3. Radio Resource Controller (RRC)
        1. 3G, 4G, and WiFi Power Requirements
        2. LTE RRC State Machine
        3. HSPA and HSPA+ (UMTS) RRC State Machine
        4. EV-DO (CDMA) RRC State Machine
        5. Inefficiency of Periodic Transfers
      4. End-to-End Carrier Architecture
        1. Radio Access Network (RAN)
        2. Core Network (CN)
        3. Backhaul Capacity and Latency
      5. Packet Flow in a Mobile Network
        1. Initiating a Request
        2. Inbound Data Flow
      6. Heterogeneous Networks (HetNets)
      7. Real-World 3G, 4G, and WiFi Performance
    4. 8. Optimizing for Mobile Networks
      1. Preserve Battery Power
      2. Eliminate Periodic and Inefficient Data Transfers
        1. Eliminate Unnecessary Application Keepalives
      3. Anticipate Network Latency Overhead
        1. Account for RRC State Transitions
        2. Decouple User Interactions from Network Communication
      4. Design for Variable Network Interface Availability
      5. Burst Your Data and Return to Idle
      6. Offload to WiFi Networks
      7. Apply Protocol and Application Best Practices
  5. III. HTTP
    1. 9. Brief History of HTTP
      1. HTTP 0.9: The One-Line Protocol
      2. HTTP/1.0: Rapid Growth and Informational RFC
      3. HTTP/1.1: Internet Standard
      4. HTTP/2: Improving Transport Performance
    2. 10. Primer on Web Performance
      1. Hypertext, Web Pages, and Web Applications
      2. Anatomy of a Modern Web Application
        1. Speed, Performance, and Human Perception
        2. Analyzing the Resource Waterfall
      3. Performance Pillars: Computing, Rendering, Networking
        1. More Bandwidth Doesn’t Matter (Much)
        2. Latency as a Performance Bottleneck
      4. Synthetic and Real-User Performance Measurement
      5. Browser Optimization
    3. 11. HTTP/1.X
      1. Benefits of Keepalive Connections
      2. HTTP Pipelining
      3. Using Multiple TCP Connections
      4. Domain Sharding
      5. Measuring and Controlling Protocol Overhead
      6. Concatenation and Spriting
      7. Resource Inlining
    4. 12. HTTP/2
      1. Brief History of SPDY and HTTP/2
      2. Design and Technical Goals
        1. Binary Framing Layer
        2. Streams, Messages, and Frames
        3. Request and Response Multiplexing
        4. Stream Prioritization
        5. One Connection Per Origin
        6. Flow Control
        7. Server Push
        8. Header Compression
        9. Upgrading to HTTP/2
      3. Brief Introduction to Binary Framing
        1. Initiating a New Stream
        2. Sending Application Data
        3. Analyzing HTTP/2 Frame Data Flow
    5. 13. Optimizing Application Delivery
      1. Optimizing Physical and Transport Layers
      2. Evergreen Performance Best Practices
        1. Cache Resources on the Client
        2. Compress Transferred Data
        3. Eliminate Unnecessary Request Bytes
        4. Parallelize Request and Response Processing
      3. Optimizing for HTTP/1.x
      4. Optimizing for HTTP/2
        1. Eliminate Domain Sharding
        2. Minimize Concatenation and Image Spriting
        3. Eliminate Roundtrips with Server Push
        4. Test HTTP/2 Server Quality
  6. IV. Browser APIs and Protocols
    1. 14. Primer on Browser Networking
      1. Connection Management and Optimization
      2. Network Security and Sandboxing
      3. Resource and Client State Caching
      4. Application APIs and Protocols
    2. 15. XMLHttpRequest
      1. Brief History of XHR
      2. Cross-Origin Resource Sharing (CORS)
      3. Downloading Data with XHR
      4. Uploading Data with XHR
      5. Monitoring Download and Upload Progress
      6. Streaming Data with XHR
      7. Real-Time Notifications and Delivery
        1. Polling with XHR
        2. Long-Polling with XHR
      8. XHR Use Cases and Performance
    3. 16. Server-Sent Events (SSE)
      1. EventSource API
      2. Event Stream Protocol
      3. SSE Use Cases and Performance
    4. 17. WebSocket
      1. WebSocket API
        1. WS and WSS URL Schemes
        2. Receiving Text and Binary Data
        3. Sending Text and Binary Data
        4. Subprotocol Negotiation
      2. WebSocket Protocol
        1. Binary Framing Layer
        2. Protocol Extensions
        3. HTTP Upgrade Negotiation
      3. WebSocket Use Cases and Performance
        1. Request and Response Streaming
        2. Message Overhead
        3. Data Efficiency and Compression
        4. Custom Application Protocols
        5. Deploying WebSocket Infrastructure
      4. Performance Checklist
    5. 18. WebRTC
      1. Standards and Development of WebRTC
      2. Audio and Video Engines
        1. Acquiring Audio and Video with getUserMedia
      3. Real-Time Network Transports
        1. Brief Introduction to RTCPeerConnection API
      4. Establishing a Peer-to-Peer Connection
        1. Signaling and Session Negotiation
        2. Session Description Protocol (SDP)
        3. Interactive Connectivity Establishment (ICE)
        4. Incremental Provisioning (Trickle ICE)
        5. Tracking ICE Gathering and Connectivity Status
        6. Putting It All Together
          1. Initiating a WebRTC connection
          2. Responding to a WebRTC connection
      5. Delivering Media and Application Data
        1. Secure Communication with DTLS
        2. Delivering Media with SRTP and SRTCP
        3. Delivering application data with SCTP
      6. DataChannel
        1. Setup and Negotiation
        2. Configuring Message Order and Reliability
        3. Partially Reliable Delivery and Message Size
      7. WebRTC Use Cases and Performance
        1. Audio, Video, and Data Streaming
        2. Multiparty Architectures
        3. Infrastructure and Capacity Planning
        4. Data Efficiency and Compression
      8. Performance Checklist
  7. Index
  8. Colophon
  9. Copyright