43
Operating System Operating System Performance Performance prepared by prepared by Jason Meyer Jason Meyer Presented by Presented by Group 4 Group 4

Operating System Performance prepared by Jason Meyer Presented by Group 4

Embed Size (px)

Citation preview

Page 1: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System Operating System PerformancePerformance

prepared byprepared byJason MeyerJason Meyer

Presented byPresented byGroup 4Group 4

Page 2: Operating System Performance prepared by Jason Meyer Presented by Group 4

AgendaAgenda• Mindcraft BenchmarksMindcraft Benchmarks

– First BenchmarkFirst Benchmark– Open BenchmarkOpen Benchmark

• Linux OptimizationsLinux Optimizationsa.a. General TipsGeneral Tipsb.b. Hardware TuningHardware Tuningc.c. Network TuningNetwork Tuningd.d. File ServingFile Servinge.e. Web ServingWeb Servingf.f. Mail Serving Mail Serving

• ReferencesReferences

Page 3: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System Operating System PerformancePerformance

• Mindcraft’s first BenchmarkMindcraft’s first Benchmark– April 13, 1999April 13, 1999

– Performed a File and Web Server Performed a File and Web Server comparison between Windows NT and comparison between Windows NT and RedHat Linux 5.2 (kernel 2.2.2)RedHat Linux 5.2 (kernel 2.2.2)

– Used Dell PowerEdge 6300m with Used Dell PowerEdge 6300m with 4x400MHz Pentium II Xeon processors, 4 4x400MHz Pentium II Xeon processors, 4 GB RAM, and a RAID disk.GB RAM, and a RAID disk.

Page 4: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System Operating System PerformancePerformance

• Mindcraft’s first BenchmarkMindcraft’s first Benchmark– Linux: Linux:

•Samba 2.0.3 as the SMB file server Samba 2.0.3 as the SMB file server

•Apache 1.3.4 as the Web server. Apache 1.3.4 as the Web server.

– Windows NT: Windows NT: •embedded SMB file server embedded SMB file server

• Internet Information Server 4.0 Web server. Internet Information Server 4.0 Web server.

Page 5: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System Operating System PerformancePerformance

• Mindcraft’s first BenchmarkMindcraft’s first Benchmark– File server performance tested with Ziff-Davis File server performance tested with Ziff-Davis

Benchmark Operation NetBench 5.01Benchmark Operation NetBench 5.01•Measures throughput in Bytes/secondMeasures throughput in Bytes/second•A number of test systems read and write files on A number of test systems read and write files on

a servera server•NetBench test suite made up of a number of NetBench test suite made up of a number of

mixes. mixes. – A mix is a particular configuration of NetBench A mix is a particular configuration of NetBench

parameters. parameters. – Each mix increases the number of test systemsEach mix increases the number of test systems

•Mindcraft used 10 mixes, ranging from 1 to 144 Mindcraft used 10 mixes, ranging from 1 to 144 test systems (clients).test systems (clients).

Page 6: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System Operating System PerformancePerformance

• Mindcraft’s first BenchmarkMindcraft’s first Benchmark– Web server performance tested with Web server performance tested with

Ziff-Davis Benchmark Operation Ziff-Davis Benchmark Operation WebBench 2.0WebBench 2.0•A number of test systems request URLs. A number of test systems request URLs.

•Measures 2 things:Measures 2 things:– The number of HTTP GET requests per second. The number of HTTP GET requests per second. – The number of bytes per second that a Web The number of bytes per second that a Web

server sends to all test systemsserver sends to all test systems

Page 7: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System Operating System PerformancePerformance

• Mindcraft’s first Mindcraft’s first BenchmarkBenchmark

Results:Results:– Windows NT Server Windows NT Server

4.0 was 2.5 times 4.0 was 2.5 times faster than Linux as a faster than Linux as a File Server and 3.7 File Server and 3.7 times faster as a Web times faster as a Web ServerServer

Page 8: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System Operating System PerformancePerformance

• Outcry from Linux CommunityOutcry from Linux Community– Mindcraft did not reveal they were Mindcraft did not reveal they were

funded by Microsoft, worked in a funded by Microsoft, worked in a Microsoft lab, and had help from Microsoft lab, and had help from Microsoft to tune NTMicrosoft to tune NT

– Mindcraft claimed to have attempted to Mindcraft claimed to have attempted to tune Linux but couldn’t get any helptune Linux but couldn’t get any help

– Many people in the Linux community Many people in the Linux community believed they purposefully tried not to believed they purposefully tried not to tune Linux, or at the least made no effort tune Linux, or at the least made no effort to tune Linux.to tune Linux.

Page 9: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System Operating System PerformancePerformance

• Mindcraft’s ResponseMindcraft’s Response– Re-ran the benchmark (but never Re-ran the benchmark (but never

released results).released results).– Mindcraft offered to do another “Open Mindcraft offered to do another “Open

Benchmark”.Benchmark”.– Leaders from the Linux community were Leaders from the Linux community were

invited to offer tips for improving invited to offer tips for improving performance and were allowed to be performance and were allowed to be present for the actual test.present for the actual test.

– Took place June 30, 1999Took place June 30, 1999

Page 10: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System PerformanceOperating System Performance

• Open Benchmark results:Open Benchmark results:– Overall, results were similar to the first Overall, results were similar to the first

benchmark.benchmark.

– Windows NT was about 2 times faster as Windows NT was about 2 times faster as a File Server and a Web Server, a File Server and a Web Server, depending on the setup used.depending on the setup used.

Page 11: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System PerformanceOperating System Performance

Open Benchmark results:Open Benchmark results:

Page 12: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System PerformanceOperating System Performance

• Linux Community response:Linux Community response:– Some downplayed these results for Some downplayed these results for

various reasonsvarious reasons• Claimed benchmarks not reflective of real Claimed benchmarks not reflective of real

worldworld

• Claimed Microsoft had unfair advantage in Claimed Microsoft had unfair advantage in tuning performance.tuning performance.

– At the least, this showed that Linux At the least, this showed that Linux was not miles ahead of NT or at least was not miles ahead of NT or at least had room for improvement.had room for improvement.

– The following website was developed The following website was developed to aid in improving performance on to aid in improving performance on Linux: Linux: http://linuxperf.nl.linux.org/http://linuxperf.nl.linux.org/

Page 13: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System PerformanceOperating System Performance

• General Tips:General Tips:– The following tips can be relevant The following tips can be relevant

no matter what the primary purpose no matter what the primary purpose of a machine is.of a machine is.

– If the system seems to be running If the system seems to be running slow, the first step is to track down slow, the first step is to track down why it is slow, and then find a fix for why it is slow, and then find a fix for the problem.the problem.

– Even if no problems are noticeable, Even if no problems are noticeable, the following tips could help the following tips could help improve performance.improve performance.

Page 14: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System PerformanceOperating System Performance

• Common Problems that hinder Common Problems that hinder performance:performance:– Swapping: Problem if process needs Swapping: Problem if process needs

to be continuously mapped back into to be continuously mapped back into main memory.main memory.

– Can check with “top” and seeing the Can check with “top” and seeing the process ‘kswapd’ takes a large process ‘kswapd’ takes a large percentage of the CPU for several percentage of the CPU for several seconds.seconds.

– Can also check with vmstat and Can also check with vmstat and iostat.iostat.

Page 15: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System PerformanceOperating System Performance

• Common Problems that hinder performanceCommon Problems that hinder performance::– Example of top where swapping is not a problem:Example of top where swapping is not a problem: 2:22pm up 21 days, 5:39, 2 users, load average: 0.34, 0.08, 0.022:22pm up 21 days, 5:39, 2 users, load average: 0.34, 0.08, 0.02

54 processes: 53 sleeping, 1 running, 0 zombie, 0 stopped54 processes: 53 sleeping, 1 running, 0 zombie, 0 stopped

CPU0 states: 0.0% user, 6.1% system, 0.0% nice, 93.3% idleCPU0 states: 0.0% user, 6.1% system, 0.0% nice, 93.3% idle

CPU1 states: 6.2% user, 2.1% system, 0.0% nice, 91.0% idleCPU1 states: 6.2% user, 2.1% system, 0.0% nice, 91.0% idle

Mem: 1545264K av, 1188708K used, 356556K free, 0K shrd, 28944K buffMem: 1545264K av, 1188708K used, 356556K free, 0K shrd, 28944K buff

Swap: 1542232K av, 0K used, 1542232K free 967872K cachedSwap: 1542232K av, 0K used, 1542232K free 967872K cached

PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME COMMANDPID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME COMMAND

4997 fcsl 17 0 31256 30M 9896 D 8.7 2.0 0:04 otbsaf4997 fcsl 17 0 31256 30M 9896 D 8.7 2.0 0:04 otbsaf

764 root 9 0 0 0 0 SW 0.3 0.0 0:00 rpciod764 root 9 0 0 0 0 SW 0.3 0.0 0:00 rpciod

4933 root 9 0 644 644 540 S 0.1 0.0 0:00 in.telnetd4933 root 9 0 644 644 540 S 0.1 0.0 0:00 in.telnetd

4962 fcsl 10 0 1064 1064 856 R 0.1 0.0 0:00 top4962 fcsl 10 0 1064 1064 856 R 0.1 0.0 0:00 top

1 root 8 0 520 520 452 S 0.0 0.0 0:15 init1 root 8 0 520 520 452 S 0.0 0.0 0:15 init

2 root 8 0 0 0 0 SW 0.0 0.0 0:00 keventd2 root 8 0 0 0 0 SW 0.0 0.0 0:00 keventd

3 root 19 19 0 0 0 SWN 0.0 0.0 0:00 ksoftirqd_CPU03 root 19 19 0 0 0 SWN 0.0 0.0 0:00 ksoftirqd_CPU0

4 root 18 19 0 0 0 SWN 0.0 0.0 0:00 ksoftirqd_CPU14 root 18 19 0 0 0 SWN 0.0 0.0 0:00 ksoftirqd_CPU1

5 root 9 0 0 0 0 SW 0.0 0.0 0:00 kswapd5 root 9 0 0 0 0 SW 0.0 0.0 0:00 kswapd

Page 16: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System PerformanceOperating System Performance

• Common Problems that hinder performanceCommon Problems that hinder performance::– Example of vmstat where swapping is not a problemExample of vmstat where swapping is not a problem

[fcsl@seneca ~]$ vmstat[fcsl@seneca ~]$ vmstat

procs memory procs memory swapswap io system cpu io system cpu

r b w swpd free buff cache r b w swpd free buff cache si sosi so bi bo in cs us sy id bi bo in cs us sy id

0 0 0 0 309944 28944 984756 0 0 0 0 309944 28944 984756 0 00 0 0 0 6 2 0 0 6 0 0 6 2 0 0 6

wherewhere

swap:swap:

si: Amount of memory swapped in from disk (kB/s).si: Amount of memory swapped in from disk (kB/s).

so: Amount of memory swapped to disk (kB/s).so: Amount of memory swapped to disk (kB/s).

Page 17: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System PerformanceOperating System Performance

• Common Problems cont’d.:Common Problems cont’d.:– Accessing the disk too hardAccessing the disk too hard

– Can check by running `ps axlw` and Can check by running `ps axlw` and the STAT field will contain a “D” the STAT field will contain a “D” when the process is waiting on the when the process is waiting on the disk.disk.

– Not much to help, perhaps use a Not much to help, perhaps use a faster disk or RAID.faster disk or RAID.

Page 18: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System PerformanceOperating System Performance

• Common Problems cont’d.:Common Problems cont’d.:– Example of ps alwx without anything waiting Example of ps alwx without anything waiting

on disk access:on disk access:[fcsl@ute OTBSAF]$ ps alwx[fcsl@ute OTBSAF]$ ps alwx F UID PID PPID PRI NI VSZ RSS WCHAN F UID PID PPID PRI NI VSZ RSS WCHAN STATSTAT TTY TIME COMMAND TTY TIME COMMAND100 0 1 0 8 0 1412 468 do_sel 100 0 1 0 8 0 1412 468 do_sel SS ? 0:18 init [5] ? 0:18 init [5] 040 0 2 1 9 0 0 0 contex 040 0 2 1 9 0 0 0 contex SWSW ? 0:00 [keventd] ? 0:00 [keventd]040 0 3 0 19 19 0 0 ksofti 040 0 3 0 19 19 0 0 ksofti SWNSWN ? 0:09 [ksoftirqd_CPU0] ? 0:09 [ksoftirqd_CPU0]040 0 4 0 19 19 0 0 ksofti 040 0 4 0 19 19 0 0 ksofti SWNSWN ? 0:01 [ksoftirqd_CPU1] ? 0:01 [ksoftirqd_CPU1]040 0 5 0 9 0 0 0 kswapd 040 0 5 0 9 0 0 0 kswapd SWSW ? 1:21 [kswapd] ? 1:21 [kswapd]040 0 6 0 9 0 0 0 bdflus 040 0 6 0 9 0 0 0 bdflus SWSW ? 0:00 [bdflush] ? 0:00 [bdflush]040 0 7 0 9 0 0 0 kupdat 040 0 7 0 9 0 0 0 kupdat SWSW ? 0:10 [kupdated] ? 0:10 [kupdated]040 0 10 1 9 0 0 0 down_i 040 0 10 1 9 0 0 0 down_i SWSW ? 0:00 [scsi_eh_0] ? 0:00 [scsi_eh_0]040 0 11 1 9 0 0 0 down_i 040 0 11 1 9 0 0 0 down_i SWSW ? 0:00 [scsi_eh_1] ? 0:00 [scsi_eh_1]. . . . . .

NOTE, for the STAT field,NOTE, for the STAT field,S = sleepingS = sleepingW = has no resident pagesW = has no resident pagesN = low-priority taskN = low-priority task

Page 19: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System PerformanceOperating System Performance

• Common Problems cont’d.:Common Problems cont’d.:– All time spent in User processesAll time spent in User processes

•A user-level program chews up all the CPUA user-level program chews up all the CPU

•Use top to find the process that is the culpritUse top to find the process that is the culprit

•Optimize this process or move it to another Optimize this process or move it to another machine.machine.

Page 20: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System PerformanceOperating System Performance

• Common Problems cont’d.:Common Problems cont’d.:– Example of top with the process “guimain” Example of top with the process “guimain”

chewing up all the CPUchewing up all the CPU 2:57pm up 21 days, 6:12, 11 users, load average: 0.15, 0.03, 0.022:57pm up 21 days, 6:12, 11 users, load average: 0.15, 0.03, 0.02

92 processes: 85 sleeping, 7 running, 0 zombie, 0 stopped92 processes: 85 sleeping, 7 running, 0 zombie, 0 stopped

CPU0 states: 0.1% user, 0.2% system, 0.0% nice, 99.7% idleCPU0 states: 0.1% user, 0.2% system, 0.0% nice, 99.7% idle

CPU1 states: 99.9% user, 0.1% system, 0.0% nice, 0.0% idleCPU1 states: 99.9% user, 0.1% system, 0.0% nice, 0.0% idle

Mem: 1545264K av, 1491272K used, 53992K free, 0K shrd, 23536K buffMem: 1545264K av, 1491272K used, 53992K free, 0K shrd, 23536K buff

Swap: 1542232K av, 26592K used, 1515640K free 1222088K cachedSwap: 1542232K av, 26592K used, 1515640K free 1222088K cached

PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME COMMANDPID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME COMMAND

32021 fcsl 17 032021 fcsl 17 0 20292 18M 3932 R20292 18M 3932 R 99.9 1.2 0:10 guimain 99.9 1.2 0:10 guimain

6997 fcsl 9 0 3072 3068 1928 S 0.1 0.1 0:00 xterm6997 fcsl 9 0 3072 3068 1928 S 0.1 0.1 0:00 xterm

. . .. . .

Page 21: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System PerformanceOperating System Performance

• Common Problems cont’d.:Common Problems cont’d.:– All time spent in Kernel processesAll time spent in Kernel processes

• If the machine spends a large amount of If the machine spends a large amount of time in system mode, then a process is time in system mode, then a process is probably wasting system calls.probably wasting system calls.

•Use `ps axlw` to see what function call a Use `ps axlw` to see what function call a process is running at any given time process is running at any given time

•May be able to reduce the impact of the May be able to reduce the impact of the system calls by adding memory or system calls by adding memory or upgrading the CPU.upgrading the CPU.

Page 22: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System PerformanceOperating System Performance

• Common Problems cont’d.:Common Problems cont’d.:– Network ProblemsNetwork Problems

• Improve Service Speed (time to respond to Improve Service Speed (time to respond to a query)a query)

– Fewer concurrent connections, which reduces the Fewer concurrent connections, which reduces the server load.server load.

•DNS Lookup TimeDNS Lookup Time– Trying to find the hostname associated with an IP Trying to find the hostname associated with an IP

address can be slow.address can be slow.– Process is usually idle while this lookup occurs.Process is usually idle while this lookup occurs.– As more requests arrive, more process will be waiting As more requests arrive, more process will be waiting

(sleeping)(sleeping)– Can check with `ps axlw` for processes with an “S” or Can check with `ps axlw` for processes with an “S” or

with `strace –p`.with `strace –p`.

Page 23: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System PerformanceOperating System Performance

• Common Problems cont’d.:Common Problems cont’d.:– Kernel ProblemsKernel Problems

•System may spend all of its time in System may spend all of its time in system mode for no reason.system mode for no reason.

•Can try to use kernel profiling to Can try to use kernel profiling to find the slowest kernel function.find the slowest kernel function.

•Change lilo.conf so “profile=2” is Change lilo.conf so “profile=2” is passed to the kernel so that the passed to the kernel so that the kernel will keep statistics.kernel will keep statistics.

Page 24: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System PerformanceOperating System Performance

• Common Problems cont’d.:Common Problems cont’d.:

For example:For example:      image=/boot/2.2.7-sard image=/boot/2.2.7-sard

            label=linux             label=linux             append="profile=2“            append="profile=2“

– Make sure/etc/System.map matches Make sure/etc/System.map matches your kernel, run lilo, and reboot.your kernel, run lilo, and reboot.

– Use `readprofile` to view statistics on Use `readprofile` to view statistics on each of the kernel's functions to find each of the kernel's functions to find the slowest.the slowest.

Page 25: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System PerformanceOperating System Performance

• Hardware TuningHardware Tuning– Use hdparm to optimize IDE hard drives.Use hdparm to optimize IDE hard drives.

– Software raid may improve performance. Software raid may improve performance.

– Tune the disk I/O elevatorsTune the disk I/O elevators •Useful if system continuously does a large amount of Useful if system continuously does a large amount of

disk I/Odisk I/O

•Changes how long the I/O scheduler will let a request sit Changes how long the I/O scheduler will let a request sit in the queue before it has to be handled. in the queue before it has to be handled.

• I/O scheduler collapses some requests together, which I/O scheduler collapses some requests together, which can increase throughput. can increase throughput.

Page 26: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System PerformanceOperating System Performance

• Network TuningNetwork Tuning– Try to use 100BTX instead on 10BTXTry to use 100BTX instead on 10BTX

– If building a router, check the "Optimize as If building a router, check the "Optimize as router" box in the kernel configuration.  router" box in the kernel configuration. 

– ip_frag_low_thresh and ip_frag_high_thresh ip_frag_low_thresh and ip_frag_high_thresh should be increased in some should be increased in some situations, especially NFS and Samba servers.  situations, especially NFS and Samba servers.  • Server takes far more connections and puts them Server takes far more connections and puts them

together in memory before having to ditch their together in memory before having to ditch their fragments.  fragments. 

• Can safely increase these to several megabytes Can safely increase these to several megabytes without any problems.without any problems.

Page 27: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System PerformanceOperating System Performance

• Tuning for particular applications:Tuning for particular applications:• The following slides provide more detailed The following slides provide more detailed

tips for particular applicationstips for particular applications•File ServerFile Server

•Web ServerWeb Server

•Mail ServerMail Server

Page 28: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System PerformanceOperating System Performance

• Tuning a File Server:Tuning a File Server:• Increase default packet sizes used by NFS Increase default packet sizes used by NFS

clientsclients• With larger packet sizes, fewer requests With larger packet sizes, fewer requests

needed to transfer the same amount of data.needed to transfer the same amount of data.

For example:For example:mount -o rsize=8192,wsize=8192 -t nfs host:/dir mount -o rsize=8192,wsize=8192 -t nfs host:/dir

/mnt/point/mnt/point

Or on a Samba server in smb.conf :Or on a Samba server in smb.conf :socket options = SO_SNDBUF=4096 socket options = SO_SNDBUF=4096

SO_RCVBUF=4096 SO_RCVBUF=4096

Page 29: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System PerformanceOperating System Performance

• Tuning a File Server:Tuning a File Server:– Use larger block sizesUse larger block sizes

•Helpful for file systems dedicated to fairly Helpful for file systems dedicated to fairly large fileslarge files

•Increase the block size from 1024 bytes Increase the block size from 1024 bytes to 4096 bytes.to 4096 bytes.

•Leads to less fragmentation, faster Leads to less fragmentation, faster fsck’s, faster deletes, and faster raw read fsck’s, faster deletes, and faster raw read speed, due to the reduced number of speed, due to the reduced number of seeksseeks

Page 30: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System PerformanceOperating System Performance

• Tuning a File Server:Tuning a File Server:– Unfortunately, must re-format the drive:Unfortunately, must re-format the drive:

mke2fs -b 4096 -m 1 /dev/whatevermke2fs -b 4096 -m 1 /dev/whatever

where the –m 1 adds an additional where the –m 1 adds an additional improvement by only reserving 1% of the improvement by only reserving 1% of the drive for root instead of 5%.drive for root instead of 5%.

– Must be careful, though, if there are many Must be careful, though, if there are many small files – this can lead to much wasted small files – this can lead to much wasted disk space.disk space.

Page 31: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System PerformanceOperating System Performance

• Tuning a File Server:Tuning a File Server:• Don’t use the atime attributeDon’t use the atime attribute

This records the last access time This records the last access time (separate from the last modified time) (separate from the last modified time) and is not very useful.and is not very useful.

This leads to significant improvements This leads to significant improvements when running `find` as well as accessing when running `find` as well as accessing frequently changing files like the frequently changing files like the contents of /var/spool/news contents of /var/spool/news

Page 32: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System PerformanceOperating System Performance

• Tuning a File Server:Tuning a File Server:– To turn off the atime attribute:To turn off the atime attribute:

chattr -R +A /var/spool (for a whole chattr -R +A /var/spool (for a whole directory tree)directory tree)

Or mount an entire partition with no access Or mount an entire partition with no access time updating, by editing /etc/fstab:time updating, by editing /etc/fstab:

# device mount point type options dump frequency fsck pass # device mount point type options dump frequency fsck pass numbernumber

/dev/sdb1 /var/spool/news ext2 defaults,noatime 1 2/dev/sdb1 /var/spool/news ext2 defaults,noatime 1 2

Page 33: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System PerformanceOperating System Performance

• Tuning a Web Server:Tuning a Web Server:– Apache is a web server used by Linux.Apache is a web server used by Linux.– MaxRequestsPerChild should be set high MaxRequestsPerChild should be set high

(10000). (10000). • This sets the number of requests a server child This sets the number of requests a server child

process will handle before it dies.process will handle before it dies.

• If this value is too low, apache will be constantly If this value is too low, apache will be constantly restarting httpds. restarting httpds.

– Increase the number of available httpd Increase the number of available httpd processesprocesses • Default is 256, which can be exceededDefault is 256, which can be exceeded

• add -DHARD_SERVER_LIMIT=4000 to CFLAGS in Configuration add -DHARD_SERVER_LIMIT=4000 to CFLAGS in Configuration

• Or modify the apache source codeOr modify the apache source code

– This may require modifying the kernel to This may require modifying the kernel to support more processes.support more processes.

Page 34: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System PerformanceOperating System Performance

• Tuning a Web Server:Tuning a Web Server:– Use Efficient Server-side scriptingUse Efficient Server-side scripting

• If you do a lot of CGI in perl, consider using mod_perl. If you do a lot of CGI in perl, consider using mod_perl.

• The Apache::Registry module can in most cases speed up The Apache::Registry module can in most cases speed up your CGI requests with no actual changes to your code. your CGI requests with no actual changes to your code.

• Similar apache modules for most popular scripting Similar apache modules for most popular scripting languages (python, Ruby, Php, tcl). languages (python, Ruby, Php, tcl).

– Work around the process modelWork around the process model • Scalability problem with apache: one process per Scalability problem with apache: one process per

connection. connection.

• This can require a large amount of resources: RAM, This can require a large amount of resources: RAM, schedular slots, ability to grab locks, database schedular slots, ability to grab locks, database connections, file descriptors. connections, file descriptors.

Page 35: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System PerformanceOperating System Performance

• Tuning a Web Server:Tuning a Web Server:– Two methods to help:Two methods to help:

• Use a dedicated server for static files, if there are Use a dedicated server for static files, if there are lots of static files.lots of static files.

– Can use a very light apache setup, or something like thttpd, Can use a very light apache setup, or something like thttpd, boa, khttpd, or TUX. boa, khttpd, or TUX.

• Use a reverse-proxy Use a reverse-proxy – In a reverse proxy, clients make requests for content in the In a reverse proxy, clients make requests for content in the

name-space of the reverse proxy. The reverse proxy then name-space of the reverse proxy. The reverse proxy then decides where to send those requests and returns the decides where to send those requests and returns the content as if it was itself the origin. content as if it was itself the origin.

– Advantages include content caching, load balancing, and Advantages include content caching, load balancing, and the prospect of moving slow connections to lighter weight the prospect of moving slow connections to lighter weight servers.   servers.   

Page 36: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System PerformanceOperating System Performance

• Email Server Tuning:Email Server Tuning:– Mail servers comprised of two parts:Mail servers comprised of two parts:

• Mail transfer agent, MTA (also called an SMTP server)Mail transfer agent, MTA (also called an SMTP server)

• Mail retrieval agent, MRAMail retrieval agent, MRA

– Limiting factor seems to be disk I/OLimiting factor seems to be disk I/O• MTAs queue messages to a queue directory (sendmail MTAs queue messages to a queue directory (sendmail

uses /var/spool/mqueue) uses /var/spool/mqueue)

• MRAs continually access the mail store (sendmail uses MRAs continually access the mail store (sendmail uses /var/spool/mail) /var/spool/mail)

• Put these directories on different filesystems that are on Put these directories on different filesystems that are on different disks to minimize the MTA and MRA from different disks to minimize the MTA and MRA from fighting for bandwidth for the same set of disks.fighting for bandwidth for the same set of disks.

Page 37: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System PerformanceOperating System Performance

• Email Server TuningEmail Server Tuning– MTA Tuning:MTA Tuning:– Don’t allow mail server to be used as an open Don’t allow mail server to be used as an open

relayrelay• Only allow outgoing messages if from correct Only allow outgoing messages if from correct

LAN/WANLAN/WAN

• Otherwise, spammers will use the ail server to deliver Otherwise, spammers will use the ail server to deliver their messages.their messages.

– MRU Tuning:MRU Tuning: • IMAP vs. POP3IMAP vs. POP3

– POP3 is older and fasterPOP3 is older and faster– IMAP is newer and more complex (more features), so slower.IMAP is newer and more complex (more features), so slower.

• 3 ways to store mail: single file, directory hierarchy, and 3 ways to store mail: single file, directory hierarchy, and database database

– Performance depends on how the particular system is used.Performance depends on how the particular system is used.

Page 38: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System PerformanceOperating System Performance

• Repeat of HistoryRepeat of History– In April 2003, Microsoft had VeriTest run In April 2003, Microsoft had VeriTest run

another benchmark, comparing Windows another benchmark, comparing Windows Server 2003 and LinuxServer 2003 and Linux

– Results claimed Windows 2003 was about Results claimed Windows 2003 was about twice as fast as a File Server.twice as fast as a File Server.

– Linux community again up in arms about Linux community again up in arms about validity of resultsvalidity of results• Again, much support for Microsoft to fine tune Again, much support for Microsoft to fine tune

Windows Server 2003, with little to no support to Windows Server 2003, with little to no support to tune Linux.tune Linux.

Page 39: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System PerformanceOperating System Performance

• Repeat of HistoryRepeat of History

Results of Veritest benchmarks:Results of Veritest benchmarks:

Page 40: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System PerformanceOperating System Performance

• CaveatCaveat– Most of these performace improvements Most of these performace improvements

taken from taken from http://linuxperf.nl.linux.orghttp://linuxperf.nl.linux.org

– There are no dates on this website, so There are no dates on this website, so cannot tell how recent or up-to-date these cannot tell how recent or up-to-date these recommendations are (though it says it was recommendations are (though it says it was created as a direct result of the Mindcraft created as a direct result of the Mindcraft benchmarks in 1999).benchmarks in 1999).

– In newer versions of Linux, some of these In newer versions of Linux, some of these recommendations may have already been recommendations may have already been implemented by default.implemented by default.

Page 41: Operating System Performance prepared by Jason Meyer Presented by Group 4

Operating System PerformanceOperating System Performance

• Conclusions of these benchmarksConclusions of these benchmarks– Highly tuned Microsoft Windows products (NT, Highly tuned Microsoft Windows products (NT,

Windows Server 2003) may or may not be faster Windows Server 2003) may or may not be faster than Linux essentially straight out of the box.than Linux essentially straight out of the box.

– Microsoft products only measured faster in Microsoft products only measured faster in benchmarks that don’t have much applicability benchmarks that don’t have much applicability to the real world (though there aren’t many to the real world (though there aren’t many better alternatives for benchmarking).better alternatives for benchmarking).

– Need to be aware of why Operating Systems Need to be aware of why Operating Systems perform well or poorly on benchmarks, to be able perform well or poorly on benchmarks, to be able to find ways to improve their performance.to find ways to improve their performance.

Page 42: Operating System Performance prepared by Jason Meyer Presented by Group 4

ReferencesReferences• http://www.mindcraft.com/whitepapers/nts4rhlinux.htmlhttp://www.mindcraft.com/whitepapers/nts4rhlinux.html

(links to results from original benchmark and the open (links to results from original benchmark and the open benchmark).benchmark).

• http://www.kegel.com/mindcraft_redux.htmlhttp://www.kegel.com/mindcraft_redux.html (lists several (lists several issues responsible for the poor Linux performance in the issues responsible for the poor Linux performance in the benchmarks).benchmarks).

• http://linuxperf.nl.linux.org/http://linuxperf.nl.linux.org/ (performance tips for (performance tips for Linux)Linux)

• ““Windows 2000 Performance Tuning”, available Windows 2000 Performance Tuning”, available at at http://www.microsoft.com/windows2000/server/evaluhttp://www.microsoft.com/windows2000/server/evaluation/performance/reports/perftune.aspation/performance/reports/perftune.asp

Page 43: Operating System Performance prepared by Jason Meyer Presented by Group 4

ReferencesReferences• ““Microsoft Windows Server 2003 vs. Linux Microsoft Windows Server 2003 vs. Linux

Competitive File Server Performance Competitive File Server Performance Comparison,” available at: Comparison,” available at: http://www.veritest.com/clients/reports/microsoft/defhttp://www.veritest.com/clients/reports/microsoft/default.aspault.asp

• http://www.linuxworld.com/story/32673.htmhttp://www.linuxworld.com/story/32673.htm (response to above comparison). (response to above comparison).

• http://perl.apache.org/http://perl.apache.org/ (information on mod_perl) (information on mod_perl)• http://people.redhat.com/alikins/system_tuning.htmlhttp://people.redhat.com/alikins/system_tuning.html

(system tuning Linux)(system tuning Linux)