As is my hobby on some weekends, I’ve been tuning my web server for greater performance. While last time I used Apache and PHP5-FPM to get extra performance in a small footprint, today I’m trying openlitespeed. So far, I like it.
My previous configuration worked well, but was fragile on every upgrade. By leveraging so many different components, at times I’d realize I was actually running two different PHP’s or a config file had broken which would suck a lot of performance and RAM. Not ideal.
So, how does openlitespeed compare to my previous concoction? It blows it away. With 100 users/second (which is four times the user load before), it’s nearly four times as fast:
According to ps_mem, it’s using about 250 MiB of memory for webserving and PHP even under load:
21.7 MiB + 5.1 MiB = 26.7 MiB litespeed (3) 36.2 MiB + 6.4 MiB = 42.6 MiB systemd-journald 63.0 MiB + 143.6 MiB = 206.7 MiB lsphpnew (5) 255.1 MiB + 632.5 KiB = 255.7 MiB mysqld --------------------------------- 623.9 MiB Total
And, for the first time in a long time, I’m running with a form of “KeepAlive” on which they call “smartKeepAlive” which doesn’t hold connections open for the next request. At least in profiling, that seems to be a good trick.
My openlitespeed configuration is pretty much stock from this one-click installer provided by Digital Ocean. Quite a simple config.
My mysql configuration needed just a bit of tuning to not melt the server under the heavy loads the web server seems to be able to handle now:
key_buffer_size = 32M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 2
max_connections = 100
innodb_buffer_pool_size = 8M
query_cache_limit = 1M
query_cache_size = 16M
And that was about it. After many years of Apache, it takes some getting used to the new config files for OpenLiteSpeed, but the docs are pretty decent and the web-based configurator works well for easy changes. So far so good!