I'm looking at using Linode at a VPS host for a PHP Webapp. Linode offers a variety of Linux distros. I'm basically after a config that will absolutely minimize memory usage while still keeping the site performant. So how should I configure it?
- I've heard nginx has a smaller footprint (and is often faster) than Apache;
- I want some form of opcode cache, be it APC, eAccelerator, Zend, XCache or something else;
- I'll be running MySQL 5;
- Suggested distro? I've heard Arch Linux is fairly barebones (I'm used to Ubuntu);
- I'm using GMail for the domain email so need nothing there;
- Linode seems to offer a DNS service separately (for free) so I won't need to run DNS servers will I?
- Anything else I can do to keep memory usage low?
PHP is not very memory intensive, so I don't think you should worry too much about memory usage, unless your app needs it, in which case the memory footprint of PHP won't be too significant.
Perhaps you could look more into optimizing MySQL.
Could you tell us what kind of web app you'll be running? In the meantime, if you really want to squeeze out as much performance as possible, here are some resources:
I would definitely use a single-process web server (nginx or lighttpd) and use PHP via FastCGI. At all costs avoid Apache + mod_php as this will result in all Apache worker processes carrying the PHP overhead (and consuming lots of memory even if they then mostly just service static content).
If you are used to Ubuntu, then keep using it (as it's based on Debian, it is very flexible and you can install only those packages you really need).
I was running (now using nginx with html only site) nginx,php/FastCGI, xcache and mysql5 on a linode360 hosting a wordpress blog.
This is a very nice and lean hosting solution.
One thing to make sure you look at if you go down the FastCGI path is compiling php with php-fpm This gives some decent process management over just running php from spawn-fcgi.
The distribution you run is up to what you are comfortable maintaining as your the one doing the work.
My experience has shown, but YMMV, CentOS for servers requires less ongoing tinkering than Archlinux however the setup can be a bit more challenging as some packages tend to be a little out of date. ie: CentOS nginx = 0.6.34 Archlinux nginx = 0.7.60 and reuire building from SRPM.
I ran an Archlinux linode for 6months and 6then months ago went to a CentOS linode. I still run Archlinux at home.