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

Publisher resources

View/Submit Errata

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
  4. 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
  5. 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
  6. 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
  7. 4. Transport Layer Security (TLS)
    1. Encryption, Authentication, and Integrity
    2. HTTPS Everywhere
    3. TLS Handshake
      1. RSA, Diffie-Hellman and Forward Secrecy
      2. Application Layer Protocol Negotiation (ALPN)
      3. Server Name Indication (SNI)
    4. TLS Session Resumption
      1. Session Identifiers
      2. Session Tickets
    5. Chain of Trust and Certificate Authorities
    6. Certificate Revocation
      1. Certificate Revocation List (CRL)
      2. Online Certificate Status Protocol (OCSP)
      3. OCSP Stapling
    7. TLS Record Protocol
    8. Optimizing for TLS
      1. Reduce Computational Costs
      2. Enable 1-RTT TLS Handshakes
      3. Optimize Connection Reuse
      4. Leverage Early Termination
      5. Configure Session Caching and Stateless Resumption
      6. Enable TLS False Start
      7. Optimize TLS Record Size
      8. Optimize the Certificate Chain
      9. Configure OCSP Stapling
      10. Enable HTTP Strict Transport Security (HSTS)
      11. Enable HTTP Public Key Pinning (HPKP)
      12. Update Site Content to HTTPS
      13. Performance Checklist
    9. Testing and Verification
  8. II. Performance of Wireless Networks
  9. 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
  10. 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
  11. 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
      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
  12. 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
  13. III. HTTP
  14. 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
  15. 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
  16. 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
  17. 12. HTTP/2
    1. Brief History of SPDY and HTTP/2
    2. Design and Technical Goals
    3. Binary Framing Layer
    4. Streams, Messages, and Frames
    5. Request and Response Multiplexing
    6. Stream Prioritization
    7. One Connection Per Origin
    8. Flow Control
    9. Server Push
    10. Header Compression
    11. Upgrading to HTTP/2
    12. Brief Introduction to Binary Framing
      1. Initiating a New Stream
      2. Sending Application Data
      3. Analyzing HTTP/2 Frame Data Flow
  18. 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
  19. IV. Browser APIs and Protocols
  20. 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
  21. 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
  22. 16. Server-Sent Events (SSE)
    1. EventSource API
    2. Event Stream Protocol
    3. SSE Use Cases and Performance
  23. 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
  24. 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
    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
  25. Index
  26. About the Author(s)

Product information

  • Title: High Performance Browser Networking
  • Author(s): Ilya Grigorik
  • Release date: September 2013
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781449344764