I started with a dedicated web server running on a 256MB Linux machine with a single-core.  It's the machine that's hosting this website right now.  I've had some very good experiences with this machine and some not-so-good.  I've upgraded the memory to 512MB, but still finding myself stretching for resources.  Also, apache seemed to crash on occasion and I kept fighting with it over and over again to provide good response times and still tune for low-memory.  I found several issues that I'd like to mention in case others are having similar issues.  Mysql is taking 200Mb for a key buffer, the OS takes approx 100MB, so that leaves about 200MB for Apache/PHP.  The solution is to not keep servers hanging around processing unlimited keepalive requests.  The setting "MaxRequestsPerChild" forces apache to respawn children after a certain number of requests have been processed.  This keeps apache and PHP from dying - if PHP has a bug and hangs, then PHP will be broken, but apache will continue to serve static content until it reaches the limit of this value, then it'll respawn and PHP will be all better again.  This is not optimal for a mega-busy webserver, but it's a good 'stable' configuration for a medium-busy web server like mine.  I host 40+ medium-to-small websites on this single machine using these settings.

Tweet
submit to reddit