Performance Tuning for a Linux Web Server: Part 1

by Mike on February 14, 2009 · 1 comment

in Web Server

This tutorial will help you review overall web server system performance and then try to provide some tips on finding the bottlenecks that are hindering the overall system.

With system performance you want to evaluate five major areas; partition placement, CPU usage, memory usage, disk I/O and network  usage.

Evaluate Server Performance

Disk Performance

CPU Performance

Memory Performance

I/O Performance

Network Performance

Design Evaluation
Before you build a server it is always a good idea to evaluate not only what partitions you want to create but also evaluate where you will place them.
Partition Placement
Depending upon your Linux distribution and your server purpose you should create separate partitions for each of /, swap, /var, /usr/ and /home.  Which partitions you create does depend somewhat on the purpose of the server.  If you were setting up an anonymous ftp server the /var partition is the location for ftp in CentOS but ftp is located in /home on Ubuntu.  The web server is located in /var in all distributions.  If you are using your server as a Samba server of course those files will be saved in /home.  So think about the purpose of the server so you can determine how to partition it.  Next think about partition placement.  Because  lower number partitions are placed on the outside of the disk, place those partitions which will be frequently accessed in the lower partition numbers which will provide faster access.  For example the first partition that you should place is SWAP as that may be accessed frequently.  Next place your /var partition on the outside if you have a web server or a database in /var.  If you are creating a Samba server or a FTP server with Ubuntu place that partition on the outside.

Multiple Drives
With multiple drives you could place the most used partitions on the outside of the disk on several drives.  The SWAP on the outside of one drive and /var on the outside of the other disk.  This way you will be achieving maximum speed.

Of course if you are using multiple disks you will want to consider RAID.  RAID 0 will give you multiple reads and writes across several disks.  There will be no redundancy if something goes wrong but you will have the better performance and you will need to consider a different option for backups.

Drive Design
The more the head has to move to read data the slower the performance. The rotation speed of the disk is also a major consideration.  If you have a disk with a 5400 RPM it will be considerably slower than a drive at 10,000 RPM. Another aspect t consider is drive geometry.

With a smaller diameter, the disk drive will have to move less space to access the drive data.  So you can see the current move of SATA drives from a 3 ½ “  to 2 ½” diameter.  The smaller diameter is allowing SATA drives to reach 10,000 RPM, the speed of some SCSI drives.  In addition these smaller drives have a cooling section around them to aid is dispensing heat. Here is an example of VelociRaptor made by Western Digital  with a 10,000 RPM.

Cache      16MB
Average Seek Time     4.2ms
Average Write Time     4.7ms
Average Latency     5.5ms

Cache size on the disk can increase speed as the disk can save data until it has time to write.  Here you can see an average seek time of 4.2ms which is a great speed for a SATA drive.  In summary, location of partitions and the physical attributes of the drive are important in trying to achieve maximum speeds with your server.

{ 1 trackback }

Previous post:

Next post: