You are previewing Web Performance Tuning.
O'Reilly logo
Web Performance Tuning

Book Description

For as long as there's been a Web, people have been trying to make it faster. The maturation of the Web has meant more users, more data, more bells and whistles, and consequently longer waits on the Web. Improved performance has become one of the most important factors in determining the usability of both the Web in general and of individual sites in particular. Web Performance Tuning is about getting the best performance from the Web. This book isn't just about tuning the web server software; it's also about getting optimal performance from a browser, tuning the hardware (on both the server and browser ends), and maximizing the capacity of the network itself. Web Performance Tuning hits the ground running, giving concrete advice for quick results--the "blunt instruments" for improving crippled performance right away. The book then takes a breath and pulls back to give a conceptual background of the principles of computing performance. The latter half of the book approaches each element of a web transaction--from client to network to server--to examine the weak links in the chain and how to strengthen them. Tips include:

  • Using simultaneous downloads to locate bottlenecks

  • Adjusting TCP for better web performance

  • Reducing the impact of DNS

  • Upgrading device drivers

  • Using alternatives to CGI

  • Locating the web server strategically

  • Minimizing browser cache lookups

  • Avoiding symbolic links for web content

Table of Contents

  1. Web Performance Tuning
    1. Preface
      1. What Is This Book Good For?
      2. Audience for This Book
      3. Assumptions of This Book
      4. How This Book Is Organized
      5. Font Conventions
      6. How to Contact Us
      7. Web Site Updates and Code Examples
      8. Other Books and Resources
        1. Books
        2. Web Sites with Performance Information
        3. Newsgroups with Web Performance Content
      9. Disclaimer
      10. Acknowledgments
    2. I. Preliminary Considerations
      1. 1. The Blunt Instruments
        1. Improving Performance from the Browser Side
        2. Improving Performance from the Server Side
        3. Key Recommendations
      2. 2. Capacity Planning
        1. Capacity Planning Is Preemptive Performance Tuning
        2. Methodology
          1. Do the Math . . .
          2. . . . But Trust Your Eyes More Than the Math
        3. Questions to Ask
        4. How Much Bandwidth Do You Need?
          1. Thinking About Bandwidth
          2. Estimating Web Server Network Bandwidth
        5. How Fast a Server Do You Need?
        6. How Much Memory Do You Need?
          1. Memory for the Operating System
          2. Memory for httpd
          3. Memory for Content
          4. Memory for CGIs
        7. Architecture Scaling Options
          1. HTTP Is Scalable
          2. Replication and Consistency
          3. NFS for Replication
          4. Directing Server Traffic
          5. Round Robin DNS
          6. Multicasting
          7. Load Balancing Products
            1. LocalDirector and DistributedDirector
            2. HydraWeb
            3. Dispatch
            4. lbnamed
            5. Network Dispatcher
            6. Web Server Director from RND
          8. Load Balancing Services
          9. The DRP Replication Protocol
        8. Key Recommendations
      3. 3. Web Performance Measurement
        1. Parameters of Performance
          1. Latency and Throughput
            1. Measuring network latency
            2. Measuring network latency and throughput
          2. Utilization
          3. Efficiency
        2. Benchmark Specifications and Benchmark Tests
        3. Web Performance Measuring Tools and Services
          1. Log File Analysis Tools
          2. Other Resources
        4. Key Recommendations
      4. 4. Case Studies
        1. Example Performance Problems, Diagnoses, and Solutions
          1. Not Enough Memory on Server
          2. Network Connection Too Slow
          3. Firewall Introducing Latency
          4. Slow Client
        2. Methodology for Performance Consulting
        3. Sample Configurations
          1. Low Volume
          2. Medium Volume
          3. High Volume
            1. AltaVista
            2. Netscape
            3. Sun
          4. What Are the Busiest Sites on the Web?
          5. Connectivity and Server Software at Well-Known Web Sites
        4. Key Recommendation
      5. 5. Principles and Patterns
        1. Principles of Performance Tuning
          1. Sometimes You Lose
          2. To Measure Something Is to Change It
          3. Reading Is Fundamental
          4. There Is No Free Lunch
          5. Returns Diminish
          6. Performance Fights Portability
          7. Memory Is Hierarchical
          8. Caches Depend on Locality of Reference
          9. I/O Is Slow
          10. Information Is Relative
          11. Hardware Is Cheap, Software Is Expensive
          12. The Goal of Tuning Is Simultaneous Failure
          13. Better Is Relative
          14. Bits Are Cost
          15. Internet Performance Degrades Nonlinearly
          16. Tuning at the Highest Level Gives the Biggest Gains
          17. It’s Not What You Know, It’s Whom You Know
        2. Patterns of Performance Improvement
          1. Amortization
          2. Caching
          3. Profiling
          4. Parallel Processing
          5. Simplicity
        3. Key Recommendations
    3. II. Tuning in Depth
      1. 6. Client Software
        1. Brief History of the Web Browser
        2. How Browsers Work
        3. Popular Browsers
          1. Netscape
          2. Internet Explorer
          3. Mosaic
          4. Lynx
          5. HotJava
          6. Non-Browser Web Clients
        4. Browser Speed
        5. Browser Tuning Tips
          1. General Tips
            1. Upgrade
            2. Do less
            3. Use shortcuts
            4. Increase caches
            5. Reboot
            6. Multitask
            7. Stop it
            8. Use Activator
          2. Internet Explorer Tips
            1. Don’t redraw while scrolling
            2. Browse in a new process
          3. Netscape Tips
            1. Prestart Java
            2. Use fewer colors
            3. Make smaller buttons
        6. Figuring Out Why the Browser Is Hanging
        7. Key Recommendations
      2. 7. Client Operating System
        1. Macintosh
          1. 68K Emulation
          2. Networking
          3. Memory and Disk
          4. Extensions
        2. Microsoft Windows
          1. System Clutter
          2. Specific Video Drivers
            1. Newest drivers
          3. Memory and Disk
          4. System Monitor
          5. Network Utilities
          6. MTU
          7. Active Desktop Problems
        3. Unix
        4. Key Recommendations
      3. 8. Client Hardware
        1. PC Hardware
          1. CPU
            1. Do you need a fast CPU?
            2. What to look for in a web client CPU
          2. RAM
          3. Cache
          4. Bus
          5. Disk
            1. Parameters
            2. IDE
            3. SCSI
            4. Fragmentation
          6. Video
            1. Cards
            2. MMX
            3. Colors and resolution
            4. Drivers
            5. 3D and video clips
            6. Video card benchmarks
          7. I/O Port
            1. The UART
            2. Hardware compression can increase overruns
          8. BIOS
        2. Key Recommendations
      4. 9. Network Hardware
        1. Lines and Terminators
          1. Forwarding and Latency
          2. Your Modem, the Information Driveway
            1. Latency and throughput modem to modem
            2. Getting synchronous
            3. Hardware compression
            4. Error correction
            5. Line quality
            6. Internal modems are faster
            7. UART buffer overruns
            8. AT commands and dialing time
            9. Bonding channels
          3. ISDN
          4. Cable Modems
          5. xDSL
          6. Higher Capacity Lines
            1. 56K, T1, and T3
            2. Frame Relay
            3. ATM
          7. Satellite
        2. Intranets
          1. Partitioning
            1. Where to put the web server?
            2. Hardware for partitioning
          2. Ethernet
            1. Packet snooping
            2. NIC buffers
            3. Fast Ethernet
            4. Switched Ethernet
            5. Ethernet cabling
            6. Noise
          3. IP Traffic Management Products
        3. Network Modeling Tools
        4. The Internet
          1. Bypassing the Internet
          2. NAPs
            1. Where do NAPs come from?
          3. ISPs
            1. Placement
            2. ISP performance
            3. Co-location and mirroring
          4. Routers
          5. Placing Blame
          6. The Future of the Internet
            1. Internet2
            2. NGI
        5. PTTs
        6. Key Recommendations
      5. 10. Network Protocols
        1. Power and Protocols
          1. Factors Affecting Network Protocol Performance
        2. The Protocols of the Web
          1. ARP
          2. PPP
          3. Routing Protocols
          4. IP
          5. TCP
            1. TCP parameters
            2. Monitoring TCP
          6. UDP
          7. DNS
          8. NFS
          9. HTTP
            1. Stateless and connectionless
            2. Asymmetric
            3. Text-based
            4. Compression
            5. Cache control
            6. The trailing slash
            7. HTTP 1.1 improvements
            8. HTTPS
            9. HTTP proxy request format
          10. FTP
          11. NNTP
          12. SNMP
          13. WebNFS
          14. CORBA
          15. X
        3. Key Recommendations
      6. 11. Server Hardware
        1. How Server Hardware Is Different
          1. Box on a Wire
          2. Good I/O
          3. Multiple Busses
          4. Fast Disks
          5. Lots of Memory
          6. Scalability
        2. Network Interface Card
        3. Bus
        4. Memory
          1. RAM Characteristics
        5. CPU
          1. CPU Construction
        6. Disk
          1. Disk Architecture and Parameters
            1. IDE
            2. EIDE
            3. SCSI
            4. Fibre Channel
            5. RAID
          2. Typical Disk Performance
          3. Fragmentation
        7. Key Recommendations
      7. 12. Server Operating System
        1. Unix and the Origin of the Web
        2. Unix Flavors
        3. Processes and the Kernel
          1. Scheduling
          2. Kernel Context
          3. Unix and httpd
          4. Reducing the Load on the OS
          5. Process Creation
          6. Address Space
        4. The Filesystem
          1. Directories
          2. Filesystem Caching
          3. Fragmentation
        5. The Windowing System
        6. Versions and Patches
        7. Configurable OS Parameters
        8. Unix OS Monitoring Tools
          1. ps
          2. perfmeter
          3. rup
          4. top
          5. System Call Tracers
          6. Network Snooping Tools
          7. netstat
          8. vmstat
          9. sar
        9. Unix Versus NT as the Web Server OS
          1. NT Pros and Cons
          2. Unix Pros and Cons
        10. Key Recommendations
      8. 13. Server Software
        1. Inside Web Server Software
          1. The Evolution of Server Software
            1. Servers spawned from inetd
            2. Forking servers
            3. Threaded servers
            4. Keepalive servers
          2. Behind the Scenes
          3. How Servers Fail
        2. Common Server Parameters
          1. Number of Processes
          2. Number of Server Threads
          3. Persistent Connections
          4. Access Control
          5. Logging
        3. Servers
          1. Apache ()
          2. Boa ()
          3. IIS ()
          4. Java Web Server ()
          5. Jigsaw ()
          6. NCSA ()
          7. Netscape ()
            1. Configuration and internals for Netscape servers
          8. Zeus ()
        4. Proxy Servers
          1. Hierarchical Caches
        5. Firewalls
        6. Key Recommendations
      9. 14. Content
        1. Size Matters
        2. HTML
          1. About HTML and Compression
          2. Performance Tips for HTML Authors
            1. Make it easy on the server
            2. Make it easy on the network
            3. Make it easy on the browser
            4. Make it easy on the user
            5. For more information on HTML
        3. Graphics
          1. Weight watching
            1. Consolidation
            2. Reuse
            3. Psychology
          2. Formats
          3. Animation
          4. VRML
        4. Audio
        5. Video
        6. Key Recommendations
      10. 15. CGI Programs
        1. CGI Internals and Performance Problems
        2. General CGI Tips
          1. Infinite Loops
            1. How to find and kill infinitely looping CGIs
          2. Runaways
          3. Guarding Against Infinitely Looping CGIs
          4. Don’t Keep the Customer Waiting
          5. Push State or Processing into the Browser
          6. Cookies
          7. Java
          8. Preprocess Queries and Cache the Results
          9. Small Is Beautiful
          10. Scaling Issues
          11. Break Up Long Forms into Several Small Forms
          12. Server DNS Lookup
          13. Debug and Optimize
        3. CGI Language-Specific Optimization Tips
          1. Shell Scripts
          2. Perl
          3. C
        4. Daemonize It
        5. CGI Database Access Performance
        6. Key Recommendations
      11. 16. Java
        1. What Java Does for You
        2. Java Compared to Native Code
        3. Why It’s Getting Better
        4. Performance Tips: What You Can Do
          1. Get the Best VM for Your Runtime Platform
          2. Profile Your Code
          3. Use Threads
          4. Be Clever with Loops
          5. Use Final Methods
          6. Load and Use Fewer Classes
          7. Use String Buffers or Arrays
          8. Don’t Manage by Exception
          9. Keep the Paint Method Small
          10. Use Sockets Rather Than URLs
          11. Use Native Methods
          12. Compile With -O
          13. Platform-Dependent Compilation
          14. JITs
          15. Server-Side Java
          16. Distributed Object Performance
        5. Key Recommendations
      12. 17. Databases
        1. Do You Really Need a Relational Database?
          1. When You Need a Professional Database
          2. Alternatives
        2. Performance Tips
          1. Planning
          2. Multiple Tiers
          3. Queries
          4. Indexes
          5. Combined Web Server/Databases
        3. Key Recommendations
    4. III. Appendixes
      1. A. Netscape Enterprise Server 3.0 Tuning
        1. Introduction
        2. Audience
        3. What Is perfdump?
        4. Installing perfdump
        5. Using perfdump Statistics
          1. ListenSocket Information
            1. Address
              1. Tuning
            2. Threads
            3. ActiveThreads
              1. Note
              2. Tuning
            4. WaitingThreads
              1. Tuning
            5. BusyThreads
              1. Tuning
            6. Thread limits
              1. Tuning
            7. KeepAlive Information
            8. KeepAliveCount (KeepAliveCount/KeepAliveMaxCount)
              1. Tuning
            9. KeepAliveHits
              1. Tuning
            10. KeepAliveFlushes
              1. Tuning
          2. Cache Information
            1. enabled
              1. Tuning
            2. CacheEntries (CurrentCacheEntries/MaxCacheEntries)
              1. Tuning
            3. CacheSize (CurrentCacheSize / MaxCacheSize)
              1. Tuning
            4. Hit Ratio (CacheHits / CacheLookups (Ratio))
              1. Tuning
            5. pollInterval
              1. Tuning
            6. maxFileSize
              1. Tuning
            7. Obsolete fields
          3. DNS Cache Information
            1. enabled
              1. Tuning
            2. CacheEntries (CurrentCacheEntries / MaxCacheEntries)
              1. Tuning
            3. HitRatio (CacheHits / CacheLookups (Ratio))
              1. Tuning
            4. Obsolete fields
          4. Asynchronous DNS Lookup Information (Unix Only)
            1. enabled
              1. Tuning
            2. NameLookups
              1. Tuning
            3. AddrLookups
              1. Tuning
            4. LookupsInProgress
              1. Tuning
          5. Common Performance Problems to Check For
            1. The server is under-throttled
            2. The cache is not utilized
            3. KeepAlives are getting flushed
        6. Platform-Specific Issues
          1. Unix
        7. Benchmarking the Netscape Enterprise Server
          1. SPECweb96 Tuning
          2. WebStone Tuning
      2. B. Apache Performance Notes
        1. Introduction
        2. Hardware and Operating System Issues
        3. Runtime Configuration Issues
          1. HostnameLookups
          2. FollowSymLinks and SymLinksIfOwnerMatch
          3. AllowOverride
        4. Negotiation
        5. Process Creation
        6. Compile-Time Configuration Issues
          1. mod_status and Rule STATUS=yes
          2. Accept Serialization—Multiple Sockets
          3. Accept Serialization—Single Socket
          4. Lingering Close
          5. Scoreboard File
            1. DYNAMIC_MODULE_LIMIT
        7. Detailed Analysis of a Trace
        8. The Preforking Model
      3. C. Solaris 2.x—Tuning Your TCP/IP Stack and More
        1. Please Share Your Knowledge
        2. History and Introduction
        3. TCP Connection Initiation
        4. Retransmission-Related Parameters
        5. Path MTU Discovery
        6. Further Advice, Hints, and Remarks
          1. Common TCP Timers
          2. Erratic IPX Behavior
        7. Windows, Buffers, and Watermarks
        8. Tuning Your System
          1. Things to Watch
          2. General Entries in the File /etc/system
          3. 100Mbit Ethernet-Related Entries
          4. How to Find Further Entries
        9. Recommended Patches
        10. Related Books and Software
          1. Books
          2. Internet Resources
          3. Mentioned RFCs and Internet Resources
          4. Unmentioned but Important Internet Resources for Web Services
    5. Index
    6. Colophon