Summary
The goal of this site is to provide practical assistance in Linux
server performance tuning in the fewest possible words. If you go though
this list, and check off each item as you apply it, you should end up with
close to the fastest performance possible on your hardware under
Linux. If you are benchmarking and find any platform that performs
significantly better than
Linux
in any meaningful benchmark, even after tuning your system
using this checklist, please let
me know before you publish
your results. Most likely I simply forgot to mention something relevant to
your particular benchmark. Thanks!
Compiler
Latest and best for the target platform
Best optimization options for the target platform and compiler
-
Example for Intel Pentium II
using PGCC:
CFLAGS="-mcpu=pentiumpro -march=pentiumpro -O6 -fno-exceptions"
System
Disable all automatic power management features in the system BIOS.
Disable all unused services and daemons especially network related services.
Lower the priorities of non-critical tasks and daemons using nice and renice.
Use irqtune to prioritize your devices.
example:
where:
11 = SCSI host controller
Use hdparm to configure hard drive options.
- Filesystem read ahead count
- Drive look ahead
- Drive write cache
- Drive multi-sector access
- Drive look ahead prefetch count
- OS irq unmask
- Controller 32 bit access
Apache
Get the latest stable Apache source currently 1.3.6.
Set up to compile as specified in the Compiler section.
Add AddModule modules/mod_mmap_static.o to the
Configuration file.
List the static pages in /www/conf/mmap.conf.
Compile with -DDYNAMIC_MODULE_LIMIT=0 unless you need dynamic modules.
Core content [for example index.html and its images] should be on a kernel RAM disk.
Dynamic content files should be processed on a kernel RAM disk.
Set FollowSymLinks option unless you really don't want it.
Set AllowOverride to None unless you really do need it.
Explicitly list all DirectoryIndex file options from most to least commonly used.
Tune KeepAliveTimeout starting with 3 ranging to 30 per content and connection types.
Tune StartServers starting with 64 increasing in steps of 32 until performs drops off.
Tune Max Clients starting with the value of StartServers.
NOTE: Scaling performance can fall off dramatically if Max Clients is too large!
For SMP boxes listening on a single socket try recompiling after defining SINGLE_LISTEN_UNSERIALIZED_ACCEPT.
Use the Apache HTTP server optimization information.
Samba
Get the latest stable Samba source currently 2.0.4.
Set up to compile as specified in the Compiler section.
Use the Samba SMB Windows share server optimization information.
Kernel
Get the latest stable Linux kernel source currently 2.2.9.
Add the wake one patch for improved poll/select performance on massive systems.
Set up to compile as specified in the Compiler section.
Create a customized monolithic kernel tuned to your hardware.
cd /usr/src/linux; make xconfig
- Set Processor family to PPro/6x86MX for Pentium II/III systems.
- Enable MTRR for PentiumPro/II/III and newer AMD K6-2/3 systems.
- Only enable Symmetric multiprocessing if you are using a multiprocessor box.
- Disable Advanced Power Management if you are running a server configuration.
- Disable chipset/bugfix support for all chipsets you DON'T have.
Example: CMD640 and RZ1000
- Enable Generic PCI bus-master DMA support and Use DMA by default
- Enable any custom support for chipsets you DO have.
Example: VIA82C586 for VIA VP2/3 and MVP3 motherboards.
- Enable RAID-0 (striping) if you have multiple identical disks.
- Disable Kernel/User netlink socket
- Enable only the SCSI device types you actually have.
Example: SCSI disk, but not tape/CD-ROM/generic
- Disable Probe all LUNs unless you need it.
- Disable Verbose SCSI error reporting
- Disable SCSI logging facility
- Enable ONLY the specific SCSI controller you have.
Example: Adaptec AIC7xxx
- Test and Tune the Maximum number of commands per LUN
- Disable ALL Network device support that you don't strictly require.
- Set the Maximum number of Unix98 PTYs to 128
- Disable Watchdog Timer Support
- Disable all Filesystems
EXCEPT: ISO 9660 CDROM, Second extended fs, /dev/pts, and /proc support.
- Disable all Network File Systems
EXCEPT: NFS server support and #undef NFS_PARANOIA
- Disable all Console drivers
EXCEPT: VGA text console
- Disable Enhanced Real Time Clock Support
- Disable all non-essential serial and mouse device support.
- Disable all Video for Linux
- Disable all non-SCSI/IDE/ATAPI CD-ROMs
- Disable all ISDN
- Disable all Plug and Play
- Disable all Amateur Radio
- Disable all Loadable modules
- Disable all IrDA subsystem
- Disable all Joysticks
- Disable all Ftape
- Disable all Partition Types
- Disable all Native Language Support
- Disable all Sound cards
IMPORTANT! See /usr/src/linux/net/TUNABLE for network tuning.
??? Does anyone have specific advice for network device tuning ???
|