Hescominsoon
OMG Member
- Joined
- Mar 22, 2010
- Messages
- 103
There are a few things I do that have helped my servers run longer w/o needing things like apc or any other addons other than the basic LAMP stack and whatever forums I run. For web facing servers I use Debian. For internal/file servers i use Centos.
Hardware:
CPU: Dual core 2.0 ghz or higher
RAM 2.0 Gigs or more
Hard disk: It highly depends on the scenario. This is one you have to research yourself.
32-bit or 64 bit. 1-3 gigs 32 bit. more than 3 gigs 64 bit.
Machine being profiled:
dual p-4 based xeon 2.8 ghz w/HT active
3 gigs ram
2x 36 gig 15k rpm SCSI Hardware RAID 1 with 1 hot spare
32 bit Debian install
10 megabit unmetered connection
Linux distro:
I use either Debian or Centos. Order of preference is:
1. Debian. This was a recent change. I looked at Ubuntu but I got tired of having to jump through hoops to get to root.(I'm not a fan of sudo..I also don't like the fact the OS "hides" root from the admin). Ubuntu is a modified Debian. As a matter of fact when you pull an update more than half of the servers queried are Debian. This made me wonder why bother with this? I'll just head to the parent. The installer is not too bad anymore(it used to require an engineering degree). Debian has always been known for stability. Ubuntu has had a record of regressions and bugs in new releases that take an update or two to work out. This is unacceptable in a server release.
2. Centos. The granddaddy of Enterprise distros..RHEL..has it's whitebox offspring..Centos. I ran this distro exclusively since Cent 4.0. I started running into issue with their policy of back porting security to the older versions. Newer software was balking at the older versions they kept for stability. This is what prompted my search for a new distro to base from(see above). I never had a major issue with Centos. However once the software/scripts i ran started falling over on a regular basis due to the older versions that were kept(requiring manuall installs of newer version or third party distros) I moved to Debian.
Control software:
Virtualmin GPL edition. I can't say enough about this software. It simplifies webserver administration so much it's crazy. The community support is not only active but highly engaged by the developers themselves. you install a base Debian system, install sshd, then go grab the .sh script for install. install and then log into the webmin installation and off you go. You do have to install a couple of things via apt--but that's totally painless(like php5-gd for XF installs). I also use this software to easily setup the php wrapper that runs all php/cgi scripts as the user and not as apache. This increases security without a huge performance hit. backups, php settings, disk quotas..etc etc or stupid easy after this. Moving a site with virtualmin is as easy as make a backup of the entire virtualmin setup(minus the server settings) start up new server..install virt..restore backup..boom you're back. I just did this to move a virt hosted on a dedi cent box to a dedi debian box..gzipped it and ssh'ed it directly to the new box and then restored it on the new box form the import tool in the new box's virt. I actually bought a license just to support their excellent work.
Apache settings:
Apache uses the preform method by default. This fires up multiple copies of apache one per request. This is slower and uses ram inefficiently. I always disable prefork and enable worker.mpm which means you run Apache in a multi threaded mode and not a multi-process mode. Here's a sample of my .conf file.
# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
# <IfModule mpm_prefork_module>
# StartServers 5
# MinSpareServers 5
# MaxSpareServers 10
# MaxClients 150
# MaxRequestsPerChild 0
# </IfModule>
# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_worker_module>
StartServers 2
MaxClients 65
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 250
</IfModule>
Right now this server also hosts two real-time audio streams so i have the maximum users cut down a bit. If we start hitting that limit I’ll look into bumping it up. I also have the max requests set low(25)) to make sure the server processes are scavenged to preserve ram usage. If there is a need I can easily up this..but the more requests you allow per child the longer it lives and the more ram it'll consume over time. The tradeoff is speed vs ram usage.
Keeping the box from swapping.
As we all know the instant the machine has to swap performance craters. Most 2.6 kernels are set for vm.swappiness=60. This is unacceptably high. I've seen boxes with 50% ram free start swapping with this parameter set this high. I ALWAYS set this value to zero...without fail. There's nothing more annoying to have a server with 25% or more ram free and it's swapping like you don't have enough ram by 50%.
These are some basic things i do at startup for any machine.
Hardware:
CPU: Dual core 2.0 ghz or higher
RAM 2.0 Gigs or more
Hard disk: It highly depends on the scenario. This is one you have to research yourself.
32-bit or 64 bit. 1-3 gigs 32 bit. more than 3 gigs 64 bit.
Machine being profiled:
dual p-4 based xeon 2.8 ghz w/HT active
3 gigs ram
2x 36 gig 15k rpm SCSI Hardware RAID 1 with 1 hot spare
32 bit Debian install
10 megabit unmetered connection
Linux distro:
I use either Debian or Centos. Order of preference is:
1. Debian. This was a recent change. I looked at Ubuntu but I got tired of having to jump through hoops to get to root.(I'm not a fan of sudo..I also don't like the fact the OS "hides" root from the admin). Ubuntu is a modified Debian. As a matter of fact when you pull an update more than half of the servers queried are Debian. This made me wonder why bother with this? I'll just head to the parent. The installer is not too bad anymore(it used to require an engineering degree). Debian has always been known for stability. Ubuntu has had a record of regressions and bugs in new releases that take an update or two to work out. This is unacceptable in a server release.
2. Centos. The granddaddy of Enterprise distros..RHEL..has it's whitebox offspring..Centos. I ran this distro exclusively since Cent 4.0. I started running into issue with their policy of back porting security to the older versions. Newer software was balking at the older versions they kept for stability. This is what prompted my search for a new distro to base from(see above). I never had a major issue with Centos. However once the software/scripts i ran started falling over on a regular basis due to the older versions that were kept(requiring manuall installs of newer version or third party distros) I moved to Debian.
Control software:
Virtualmin GPL edition. I can't say enough about this software. It simplifies webserver administration so much it's crazy. The community support is not only active but highly engaged by the developers themselves. you install a base Debian system, install sshd, then go grab the .sh script for install. install and then log into the webmin installation and off you go. You do have to install a couple of things via apt--but that's totally painless(like php5-gd for XF installs). I also use this software to easily setup the php wrapper that runs all php/cgi scripts as the user and not as apache. This increases security without a huge performance hit. backups, php settings, disk quotas..etc etc or stupid easy after this. Moving a site with virtualmin is as easy as make a backup of the entire virtualmin setup(minus the server settings) start up new server..install virt..restore backup..boom you're back. I just did this to move a virt hosted on a dedi cent box to a dedi debian box..gzipped it and ssh'ed it directly to the new box and then restored it on the new box form the import tool in the new box's virt. I actually bought a license just to support their excellent work.
Apache settings:
Apache uses the preform method by default. This fires up multiple copies of apache one per request. This is slower and uses ram inefficiently. I always disable prefork and enable worker.mpm which means you run Apache in a multi threaded mode and not a multi-process mode. Here's a sample of my .conf file.
# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
# <IfModule mpm_prefork_module>
# StartServers 5
# MinSpareServers 5
# MaxSpareServers 10
# MaxClients 150
# MaxRequestsPerChild 0
# </IfModule>
# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_worker_module>
StartServers 2
MaxClients 65
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 250
</IfModule>
Right now this server also hosts two real-time audio streams so i have the maximum users cut down a bit. If we start hitting that limit I’ll look into bumping it up. I also have the max requests set low(25)) to make sure the server processes are scavenged to preserve ram usage. If there is a need I can easily up this..but the more requests you allow per child the longer it lives and the more ram it'll consume over time. The tradeoff is speed vs ram usage.
Keeping the box from swapping.
As we all know the instant the machine has to swap performance craters. Most 2.6 kernels are set for vm.swappiness=60. This is unacceptably high. I've seen boxes with 50% ram free start swapping with this parameter set this high. I ALWAYS set this value to zero...without fail. There's nothing more annoying to have a server with 25% or more ram free and it's swapping like you don't have enough ram by 50%.
These are some basic things i do at startup for any machine.