HP-UX TCP/IP Performance White Paper, March 2008

18
4.2 Tuning Web Servers
As the demand for faster and more scalable web service increases, it is desirable to improve web server
performance and scalability by integrating web server functionality into operating systems. Web servers
have characteristics of many short-lived connections, which open and close TCP connections at a very fast
rate. In a busy web server environment, there could be tens of thousands of TCP connections per second.
The following features and configurations are recommended for optimizing Web servers:
Network Server Accelerator HTTP
Socket Caching for TCP connections
Increase the tcphashsz value
Increase the listen queue limit
MSG_EOF for TCP applications
4.2.1 Network Server Accelerator HTTP
The Network Server Accelerator HTTP (NSA HTTP) is a product that provides an in-kernel cache of web
pages in HP-UX 11i. This section describes the performance improvements achievable with NSA HTTP and
the system tuning needed to achieve these performance improvements.
The following list highlights the techniques NSA HTTP implements to achieve superior performance of Web
servers in HP-UX 11i:
Serving content from RAM (main memory) eliminates disk latency and I/O bandwidth
constraints.
In-kernel implementation decreases transitions between kernel and user mode.
Tight integration with the TCP protocol stack. This allows efficient event notification and data
transfer. In particular, a zero-copy send interface reduces data transfer by allowing responses
to be sent directly from the RAM-based cache.
Deferred-interrupt context processing removes the overhead associated with threads.
Re-use of data structures and other resources reduces the lengths of critical code paths.
The HTTP-specific portion of NSA HTTP is implemented as a DLKM module. In addition, the nsahttp utility
is provided to configure and administer NSA HTTP. For a detailed description of the utility, refer to the
nsahttp(1) man page.
The NSA HTTP product is supported on HP-UX 11i and is available from http://www.software.hp.com.
4.2.1.1 Usage Scenarios
There are a number of ways NSA HTTP can be used in a Web server environment. We briefly describe two
scenarios to highlight the most typical usage.
4.2.1.1.1 Single System Web Server with NSA HTTP
The simplest scenario uses NSA HTTP and a conventional user-level Web-server process co-located on a
single system. In this topology, NSA HTTP increases server capacity by increasing the efficiency for
processing static requests. NSA HTTP provides a fast path in the kernel that bypasses normal processing of
static requests at the user level. This fast path entails having NSA HTTP parse each HTTP request to
determine whether it can be served from the kernel. Requests that cannot be served from the kernel are
passed to the user-level server process. Adding the fast path in the kernel, therefore, introduces additional
parsing and processing to the path for requests served at the user level. This overhead is not significant and
is more than compensated for by the increased efficiency when serving static requests.