I decided to take the plunge and get rid of Apache for something with a smaller footprint and twice the power: Litespeed.
I got a little tired of having to constantly monitor apache as it frequently took up too much memory and affected other services. Sometimes this resulted in my VPS having services killed off for too much memory usage by Virtuozzo.
As I write this, Litespeed is currently running at 14.4MB RAM usage and 0.1% CPU usage. Compare that to Apache swallowing a whopping 80MB+ or RAM, not to mention CPU time you can probably see why switching over to Litespeed is a good idea!
The main selling point of Litespeed for me was the easy replacement of Apache on a WHM/cPanel server. It’s very easy to configure Litespeed to utilise the Apache configuration files that WHM/cPanel writes to. This has the benefit of being fully integrated into the custom tools that WHM and cPanel use in their respective control panels.
Here’s a very quick guide on how to install it.
wget http://litespeedtech.com/packages/3.0/lsws-3.3-std-i386-linux.tar.gz tar -xvfz lsws-3.3-std-i386-linux.tar.gz cd lsws* ./install.sh
Once you’ve run through the configuration interface you can now setup Litespeed to load the Apache configuration file. Login through the new administration interface and click Configuration -> Server. Change the following.
Load Apache Configuration => Yes Auto Reload On Changes => Yes Apache Configuration File => /usr/local/apache/conf/httpd.conf Apache Port Offset => 2000
You do have the option to enable PHP suEXEC for additional security, although if you enable this you won’t be able to use an opcode cache like APC.
Once you’ve made sure that Litespeed is functioning correctly, you can go back to the above configuration and change the Apache Port Offset to 0 and then disable Apache.
For more thorough guides on how to setup Litespeed and a custom PHP install, I’d suggest visiting Litespeed Install and Litespeed custom PHP.
I do like PHPsuEXEC makes things alot easier, not used APC, does it give a big improvement over normal caching in PHP?
PHPsuEXEC is good when you host a lot of people you don’t know. It allows you track down misuse and resource intensive scripts. For my purposes it’s not so good.
PHP itself doesn’t do any caching. You can implement a system of your own, which works well, but it’s much better to employ an opcode cache like APC. Here’s how things are cached at the moment on my server.
That shows that 1,095 PHP files have their compiled state stored in the cache. This means that any call to those 1,095 PHP files calls the compiled PHP file and doesn’t have to recompile the PHP file and execute it.
This saves on resources used to compile the file and cuts down on overheads.
Obviously, if someone requests a file that’s not already cached, APC stores that file for the next access. It’s a win win situation really. You also have the added benefit of being able to store custom data in the APC cache.
Just as a side note, I’ve decided not to go with Litespeed any more. The speed improvements were noticeable, however the price tag and similar RAM usage to apache made me think otherwise.