Server Tuning
 
Table of Contents
Connection Tuning Max Connections   Max SSL Connections   Connection Timeout   Max Keep-Alive Requests   Smart Keep-Alive   Keep-Alive Timeout   Send Buffer Size   Receive Buffer Size   I/O Event Dispatcher   Max Cached Small File Size   Total Small File Cache Size   Max MMAP File Size   Total MMAP Cache Size   Use sendfile()   SSL Hardware Accelerator   
Request/Response Tuning Max Request URL Length   Max Request Header Size   Max Request Body Size   Max Dynamic Response Header Size   Max Dynamic Response Body Size   
GZIP Compression Tuning Enable Compression   Enable Dynamic Compression   Compression Level (Dynamic Content)   Compressible Types   Auto Update Static File   Static GZIP Cache Directory   Compression Level (Static Content)   Max Static File Size   Min Static File Size   
 
Max ConnectionsGo to top
Description: Specifies the maximum concurrent connections that the server can accept. It includes both plain TCP connections and SSL connections. It should not exceed the hard limit set by the server: 300 for Standard Edition. Once this limit is reached, the server will close Keep-Alive connections when they complete active requests.
Syntax: Integer number
Tips: When server is started by root user, the server will try to adjust the per process file descriptor limits automatically, however, if it failed, you may need to increase it manually.
Max SSL ConnectionsGo to top
Description: Specifies the maximum concurrent SSL connections the server will accept. Since total concurrent SSL and non-SSL connections will not exceed the limit specified by Max Connections, the actual number of concurrent SSL connections allowed could be lower than this limit.
Syntax: Integer number
Connection TimeoutGo to top
Description: Specifies the maximum allowed connection idle time during processing one request. The connection will be closed whenever it is idle, no i/o activity, for this period of time.
Syntax: Integer number
Tips: [Security] Set it to as low as you can to help recover dead connections during potential DoS attack.
See Also:
Max Keep-Alive RequestsGo to top
Description: Specifies the maximum number of requests that can be served through a Keep-Alive (Persistent) session. Connection will be closed once this limit is reached. You can set this limit for each virtual host as well.
Syntax: Integer number
Tips: [Performance] Set it to a resonable high value. Value <= 1 will disable Keep-Alive.
See Also: Virtual Host Max Keep-Alive Requests
Smart Keep-AliveGo to top
Description: Specifies whether to turn on Smart Keep-Alive. This option is effective only if Max Keep-Alive Requests > 1. If enabled, you can also enable/disable it at virtual host level. Smart keep-alive will only establish keep-alive connections for requests of JavaScript, CSS Style Sheet and image files. For html pages, connection will not be kept alive. This will help serve more users more efficiently. Normally a web page contains multiple images and scripts that will be cached by the browsers after initial request. It is more efficient to send those non-html static files through a single keep-alive connection and have the text/html file send through another non-keep-alive connection. This method will reduce idle connections and in turn increase capacity to handle more concurrent requests and users.
Syntax: Select from radio box
Tips: [Performance] Enable it for high-load web sites.
See Also: Virtual Host Smart Keep-Alive
Keep-Alive TimeoutGo to top
Description: Specifies the maximum idle time between requests from a Keep-Alive connection. If no new request is received during this period of time, the connection will be closed.
Syntax: Integer number
Tips: [Security & Performance] We recommend you to set the value just long enough to handle all requests for a single page view. It is unnecessary to keep connection alive for an extended period of time. A smaller value can reduce idle connections, increase capacity to service more users and guard against DoS attacks. 2-5 seconds is a reasonable range for most applications. LiteSpeed is highly efficient in a non-keep-alive environment.
Send Buffer SizeGo to top
Description: The sending buffer size of each TCP socket. Set to 0 to use the default buffer size of the operating system. 65535 is the maximum allowed buffer size.
Syntax: Integer number
Tips: [Performance] If your web site serves large static files, increase the send buffer size to improve performance.
Receive Buffer SizeGo to top
Description: The receiving buffer size of each TCP socket. Set to 0 to use the default buffer size. 65535 is the hard limit.
Syntax: Integer number
Tips: [Performance] A large receive buffer will increase performance when processing incoming requests with large payload, i.e. file uploads.
I/O Event DispatcherGo to top
Description: Specifies which I/O event dispatcher to use. Different operating systems support different types of event dispatcher:
  • Linux kernel 2.4.x supports:
    • poll
  • Linux kernel 2.6.x supports:
    • poll
    • epoll
  • FreeBSD supports:
    • poll
    • kqueue
  • Solaris supports:
    • poll
    • devpoll
  • Mac OS X 10.3 and above supports:
    • poll
    • kqueue
poll is supported by all platforms, and is the default selection. For high traffic web sites, altenative event dispatcher can be used to improve the scalability of the web server.
Syntax: Select from drop down list
Max Cached Small File SizeGo to top
Description: Specifies the largest static file that will be cached in a pre-allocated memory buffer. Static files can be served in four different ways: memory buffer cache, memory-mapped cache, plain read/write and sendfile(). Files whose size is smaller than the Max Cached Small File Size are served from memory buffer cache. Files whose size is larger than the Max Cached Small File Size but smaller than the Max MMAP File Size will be served from memory-mapped cache. Files whose size is larger than the Max MMAP File Size will be served via plain read/write or sendfile(). It is optimal to serve static files smaller than 4K from the memory buffer cache.
Syntax: Integer number
Total Small File Cache SizeGo to top
Description: Specifies the total memory that can be allocated to buffer cache in order to cache/serve small static files.
Syntax: Integer number
Max MMAP File SizeGo to top
Description: Specifies the largest static file that will be memory mapped (MMAP). Static files can be served in four different ways: memory buffer cache, memory-mapped cache, plain read/write and sendfile(). Files whose size is smaller than the Max Cached Small File Size are served from memory buffer cache. Files whose size is larger than the Max Cached Small File Size but smaller than the Max MMAP File Size will be served from memory-mapped cache. Files whose size is larger than the Max MMAP File Size will be served via plain read/write or sendfile(). Since the server has a 32bit address space, up to 2GB, it is not recommended to mmap very large files.
Syntax: Integer number
Total MMAP Cache SizeGo to top
Description: Specifies the total memory that can be allocated for memory mapped cache in order to cache/serve medium sized static files.
Syntax: Integer number
Use sendfile()Go to top
Description: Specifies whether to use sendfile() system call to serve static files. Static files can be served in four different ways: memory buffer cache, memory-mapped cache, plain read/write, and sendfile. File smaller than Max Cached Small File Size is served from memory buffer cache, file size larger than Max Cached Small File Size but smaller than Max MMAP File Size will be served from memory-mapped cache. File larger than Max MMAP File Size will be served via plain read/write or sendfile. Sendfile() is a "zero copy" system call that can greatly reduce CPU utilization when serving very large static files. Sendfile() requires optimized network card kernel driver and thus may not be applicable for some small-vendor network adapters.
Syntax: Select from radio box
SSL Hardware AcceleratorGo to top
Description: [Enterprise Edition Only] Specifies which SSL hardware acceleration device to use. Only devices supported by OpenSSL can be used. Select OpenSSL internal engine if no device is installed.
Syntax: Select from drop down list
Max Request URL LengthGo to top
Description: Specifies the maximum size of a request URL. URL is the full text address used to access a server resource including query string. 8192 bytes is the hard limit.
Syntax: Integer number
Tips: [Security & Performance] Set it low and reasonable to reduce memory usage and help identify bogus requests and DoS attacks.
2-3K is big enough for most web sites unless HTTP GET method is used with large query string instead of POST.
Max Request Header SizeGo to top
Description: Specifies the maximum size of a HTTP request header including request URL. Hard limit is 16380 bytes.
Syntax: Integer number
Tips: [Security & Performance] Set it low and reasonable to reduce memory usage and help identify bogus requsts and DoS attacks.
4-8K is big enough for most web sites.
Max Request Body SizeGo to top
Description: Specifies the maximum size of a HTTP request body. 1GB is the hard limit.
Syntax: Integer number
Tips: [Security] Set the limit just a little higher than what is really needed to help identify DoS attack. Your swapping space must have enough free space.
Max Dynamic Response Header SizeGo to top
Description: Specifies the maximum header size of a dynamically generated response. Hard limit is 8KB
Syntax: Integer number
Tips: [Reliability & Performance] Set it low and reasonable to help recognize bad responses that are dynamically generated by external applications.
Max Dynamic Response Body SizeGo to top
Description: Specifies the maximum body size of a dynamically generated response. Hard limit is 2047MB.
Syntax: Integer number
Tips: [Reliability & Performance] set the limit low and reasonable to help identify bad responses. For example, it is not uncommon to malformed scripts continaing infinite loop which leads to infinite sized responses.
Enable CompressionGo to top
Description: Controls GZIP compression for both static and dynamic HTTP responses.
Syntax: Select from radio box
Tips: [Performance] Enable it to save network bandwidth. Text based responses such as html, css, and javascript files benefit the most and on average can be compressed to 1/2 of original size.
Enable Dynamic CompressionGo to top
Description: Controls GZIP compression for dynamically generated HTTP response. Enable Compression must be set to true in order to enable dynamic GZIP compression.
Syntax: Select from radio box
Tips: [Performance] Compressing dynamic responses increases CPU and memory utilization but saves network bandwidth. Text based responses such as html, css, and javascript files benefit the most and on average can be compressed to 1/2 of original size.
Compression Level (Dynamic Content)Go to top
Description: Specifies the level of compression for dynamic contents, ranges from 1 (lowest) to 9 (highest), default is 2.
Syntax: Number between 1 and 9.
Tips: [Performance] Higher compression level will use more memory and CPU cycles. You can set it to a higher level if your machine has additional power. There is not much difference between 6 and 9 except 9 uses much more CPU cycles.
Compressible TypesGo to top
Description: Specifies what MIME types are allowed to be compressed. For example, if you want to compress text/* but not text/css, you can have a rule like text/*, !text/css. "!" will exclude that mime type.
Syntax: MIME type list separated by commas. Wild card "*" and negate sign "!" are allowed, i.e. text/*, !text/js.
Tips: [Performance] Only allow types that will benefit from GZIP compression. Binary files such as gif/png/jpeg images and flash files do not benefit from compression.
Auto Update Static FileGo to top
Description: Specifies whether to let the web server to create/update GZIP compressed edition of compressible static files. If set to Yes, when a file with MIME type listed in Compressible Types is requested, the web server will create or update the corresponding compressed file depending on timestamp. The compressed file is created under the Static GZIP Cache Directory, the file name is based on the MD5 hash of the path of the original file.
Syntax: Select from radio box
Static GZIP Cache DirectoryGo to top
Description: Specifies the path of the directory used to store compressed file for static content, default is Swapping Directory.
Syntax: Directory Path
Compression Level (Static Content)Go to top
Description: Specifies the level of compression for static contents, ranges from 1 (lowest) to 9 (highest), default is 6.
Syntax: Number between 1 and 9.
Max Static File SizeGo to top
Description: Specifies the maximum size of a static file for which the web server will create a compressed file automatically.
Syntax: Number in bytes not less than 1K
Tips: [Performance] It is not recommended to have web server create/update compressed file for large files as the whole server service would become blocked during that period meaning no further requests can be processed before the current compression is completed.
Min Static File SizeGo to top
Description: Specifies the minimum size of a static file for which the web server will create a corresponding compressed file.
Syntax: Number in bytes not less than 200
Tips: It is not necessary to compress very small files as the bandwidth saving is negligible.