- CentOS, Genel, Linux, LiteSpeed, Ubuntu, Web Server
- Written by: Minussoft
- Leave a comment
- permalink
6 Steps for Servers With Better Performance With LiteSpeed
Hello all system administrators! We are all have some critical web servers to manage. The health and correct operation of these web servers is more important than anything for us.
We telling you, first of all the performance settings in the web server must be configured. If you start work from your web server, you can fix this without straining your hardware devices. Now let me show you some tactics.
- OS Optimization (LSWS Web Admin -> Configuration -> Tuning)
- I/O Event Dispatcher: Specifies which I/O event dispatcher to use. Poll is supported by all platforms, and is the default selection. For high traffic web sites, an altenative event dispatcher can be used to improve the scalability of the server. Different operating systems support different types of event dispatcher:
- Poll
- Epoll
- RAM Disk Path: Setting the RAM Disk Path allows you to designate the location of a RAM disk. A RAM disk is a world-writable directory stored in memory. A server with excess RAM can reduce disk I/O by serving content from this RAM disk. Accessing content from RAM is much faster than reading data from the disk. LSWS will use this RAM disk to optimize performance when there is enough memory available.
- Default SHM Directory: Changes shared memory’s default directory to the specified path. If the directory does not exist, it will be created. All SHM data will be stored in this directory unless otherwise specified.
- I/O Event Dispatcher: Specifies which I/O event dispatcher to use. Poll is supported by all platforms, and is the default selection. For high traffic web sites, an altenative event dispatcher can be used to improve the scalability of the server. Different operating systems support different types of event dispatcher:
- Connection (LSWS Web Admin -> Configuration -> Tuning)
- Max Connection: Specifies the maximum number of concurrent connections that the server can accept. This includes both plain TCP connections and SSL connections. This setting should not be set to exceed the hard limit set by the server software edition or license: 500 for VPS license, 800 for Ultra VPS license. Once the maximum concurrent connections limit is reached, the server will close Keep-Alive connections when they complete active requests.
- Max SSL Connection: Specifies the maximum number of concurrent SSL connections the server will accept. Since total concurrent SSL and non-SSL connections cannot exceed the limit specified by “Max Connections”, the actual number of concurrent SSL connections allowed must be lower than this limit.
- Connection Timeout (sec): Specifies the maximum connection idle time allowed during processing one request. The connection will be closed if it has been idle, i.e. no I/O activity, for this period of time.
- Max Keep-Alive Requests: Specifies the maximum number of requests that can be served through a keep-alive (persistent) session. The connection will be closed once this limit is reached. You can set this limit for each virtual host as well.
- Smart Keep-Alive: Specifies whether to turn on Smart Keep-Alive. This option is effective only if “Max Keep-Alive Requests” is greater than 1. If enabled, you can also enable/disable it at the 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, the 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 browser after the 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 sent through another non-keep-alive connection. This method will reduce idle connections and in turn increase the capacity to handle more concurrent requests and users.
- Keep-Alive Timeout (sec): 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. This setting only applies to HTTP/1.1 connections. HTTP/2 connections have long keep-alive timeouts by design and are not affected by this setting.
- Send Buffer Size (bytes): The sending buffer size of each TCP socket. 512K is the maximum allowed buffer size.
- Receive Buffer Size (bytes): The receiving buffer size of each TCP socket. 512K is the maximum allowed buffer size.
- Request / Response (LSWS Web Admin -> Configuration -> Tuning)
- Max Request URL Length (bytes): Specifies the maximum size of a request URL. URL is the full text address used to access a server resource including the query string. 8192 bytes is the hard limit.
- Max Request Header Size (bytes): Specifies the maximum size of an HTTP request header including request URL. Hard limit is 16380 bytes.
- Max Request Body Size (bytes): Specifies the maximum size of an HTTP request body. For a 32Bit OS, 2GB is the hard limit. For a 64Bit OS, it is virtually unlimited.
- Max Dynamic Response Header Size (bytes): Specifies the maximum header size of a dynamically generated response. Hard limit is 8KB.
- Max Dynamic Response Body Size (bytes): Specifies the maximum body size of a dynamically generated response. Hard limit is 2047MB.
- Static File Delivery Optimization (LSWS Web Admin -> Configuration -> Tuning)
- Max Cached Small File Size (bytes): 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 this setting are served from memory buffer cache. Files whose size is larger than this setting, but smaller than the “Max MMAP File Size (bytes)” will be served from memory-mapped cache. Files whose size is larger than the “Max MMAP File Size (bytes)” will be served via plain read/write or sendfile(). It is optimal to serve static files smaller than 4K from the memory buffer cache.
- Total Small File Cache Size (bytes): Specifies the total memory that can be allocated to the buffer cache in order to cache/serve small static files.
- Max MMAP File Size (bytes): 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 (bytes)” are served from memory buffer cache. Files whose size is larger than the “Max Cached Small File Size (bytes)”, 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 (2GB), it is not recommended to memory map very large files.
- Total MMAP Cache Size (bytes): Specifies the total memory that can be allocated for memory- mapped cache in order to cache/serve medium sized static files.
- Use sendfile(): Specifies whether to use the 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(). Files smaller than the “Max Cached Small File Size (bytes)” are served from memory buffer cache. Files larger than the “Max Cached Small File Size (bytes)” but smaller than the “Max MMAP File Size (bytes)” will be served from memory-mapped cache. Files larger than the “Max MMAP File Size (bytes)” 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 an optimized network card kernel driver and thus may not be suitable for some small-vendor network adapters.
- Use Asynchronized disk I/O (AIO): Specifies whether to use AIO to serve static files. AIO will help if your server has a high I/O wait. For 64bit operation system, there is an option to keep files mapped in process address space to improve AIO performance.
- AIO Block Size: Specifies the sent block size for AIO. This block size multiplied by the total files being processed should be less than the physical memory of the server, otherwise, AIO will not help. If your server has enough memory, you can choose a bigger size. Default value is “1M”.
- File ETag: Specifies whether to use a file’s inode, last-modified time, and size attributes to generate the ETag HTTP response header for static files. All three attributes are enabled by default. If you plan to serve the same file out of mirrored servers, you should not include inode; otherwise, the ETag generated for one file will be different on different servers.
- GZIP Compression (LSWS Web Admin -> Configuration -> Tuning)
- Enable Compression: Controls GZIP compression for both static and dynamic HTTP responses.
- Enable Dynamic Compression: Controls GZIP compression for dynamically generated HTTP response. “Enable Compression” must be set to Yes in order to enable dynamic GZIP compression.
- Compression Level (Dynamic Content): Specifies the level of compression for dynamic content. Ranges from 1 (lowest) to 9 (highest). The default is 2.
- Compressible Types: Specifies what MIME types are allowed to be compressed.
- Auto Update Static File: Specifies whether to let the server automatically create/update GZIP-compressed versions of compressible static files or not. If set to Yes, when a file with a MIME type listed in “Compressible Types” is requested, the server may create or update the corresponding compressed version of the file depending on the compressed file’s timestamp. This compressed file is created under the “Static GZIP Cache Directory”. The filename is based on a MD5 hash of the path of the original file.
- Static GZIP Cache Directory: Specifies the path of the directory used to store compressed files for static content. The default is “Swapping Directory”.
- Compression Level (Static File): Specifies the level of compression for static content. Ranges from 1 (lowest) to 9 (highest). The default is 6.
- Max Static File Size (bytes): Specifies the maximum size of a static file for which the server will create a compressed file automatically.
- Min Static File Size (bytes): Specifies the minimum size of a static file for which the server will create a corresponding compressed file.
- Brotli Compression (LSWS Web Admin -> Configuration -> Tuning)
- Enable Brotli Compression: Controls Brotli compression for static HTTP responses. The default value is enabled.
- Compression Level (Static File): Specifies the level of compression for static content. Ranges from 1 (lowest) to 9 (highest). The default is 5.
- QUIC (LSWS Web Admin -> Configuration -> Tuning)
- Enable QUIC: Enables the QUIC network protocol server wide. Default value is Yes.
- QUIC SHM Directory: Specifies the directory used to save QUIC data to shared memory. By default, the server’s default SHM directory, /dev/shm, will be used.
- QUIC Versions: A list of enabled QUIC versions. This setting should only be used to limit QUIC support to the versions listed and is best left blank.
- Connection Flow Control Window: The initial size of the buffer allocated for a QUIC connection. Default value is 1.5M.
- Max Connection Flow Control Window: Specifies the maximum size that a connection flow control window buffer is allowed to reach due to window auto-tuning.
- Stream Flow Control Window: The initial amount of data a QUIC connection is willing to receive per stream. Default value is 1M.
- Max Stream Flow Control Window: Specifies the maximum size that a stream flow control window is allowed to reach due to window auto-tuning.
- Max Concurrent Streams Per Connection: The maximum number of concurrent streams allowed per QUIC connection. Default value is 100.
- Handshake Timeout (secs): The time in seconds a new QUIC connection is given to complete its handshake, after which the connection is aborted. Default value is 10.
- Idle Timeout (secs): The time in seconds after which an idle QUIC connection will be closed. Default value is 30.