cit 470: advanced network and system administration

27
CIT 470: Advanced Network and System Administration Slide #1 CIT 470: Advanced Network and System Administration Performance Monitoring

Upload: lok

Post on 04-Feb-2016

44 views

Category:

Documents


1 download

DESCRIPTION

CIT 470: Advanced Network and System Administration. Performance Monitoring. Topics. Performance testing Performance tuning. CPU Memory Disk Network. What is performance testing?. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #1

CIT 470: Advanced Network and System Administration

Performance Monitoring

Page 2: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #2

Topics

1. Performance testing

2. Performance tuning.

3. CPU

4. Memory

5. Disk

6. Network

Page 3: CIT 470: Advanced Network and System Administration

What is performance testing?

Performance testing is a type of testing intended to determine the responsiveness, throughput, reliability, and/or scalability of a system under a given workload.

- http://perftestingguide.codeplex.com/

Performance testing goals:– Assess production readiness– Evaluate against performance criteria– Compare performance characteristics of multiple systems or

system configurations– Find the source of performance problems– Support system tuning– Find throughput levels

Page 4: CIT 470: Advanced Network and System Administration

Performance Testing Activities

http://perftestingguide.codeplex.com/

Page 5: CIT 470: Advanced Network and System Administration

Testing Types

Performance testing: determining performance, scalability, or stability characteristics of system; a superset of the other testing types.

Load testing: determining performance characteristics of system when subjected to work load expected during production.

Stress testing: determining performance characteristics of system when subjected to work loads beyond those expected during production to determine under what conditions system will fail.

Page 6: CIT 470: Advanced Network and System Administration

Baselines

A baseline is a set of data used for comparison.

In performance testing, baselines are used to evaluate the effectiveness of subsequent performance-improving changes to the system.

Once the system has been changed, a new baseline must be measured.

Page 7: CIT 470: Advanced Network and System Administration

Benchmarking

Benchmarking is the process of measuring system performance using standard tests and comparing it against a well known system.

SPEC CPU2006 (SPECint, SPECfp)SPEC power2008 (power usage)SPEC sfs2008 (NFS, CIFS)SPEC virt2010 (virtualization)SPEC web2005 (PHP or JSP)

BogoMipsDhrystoneWhetstone

Weighted TeraFLOPS

NAS Parallel Benchmarks

Page 8: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #8

Identify Bottlenecks

Identify which aspect of performanceLatency: delay until initial access.

Throughput: rate of transfer/processing.

Identify which system componentCPU

Memory

Disk

Network

Page 9: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #9

Performance Tuning Process

1. Learn the customer’s problem.Identify specifically what’s wrong.

2. Find the problem’s cause and fix it.1. When does the problem occur?

2. Has anything about the system changed?

3. What critical resource is affecting performance?

3. Have the right tools.Historical monitoring data will show what’s normal and

identify any trends.

Page 10: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #10

Experimenter Effect

Monitoring the system affects performance.Monitoring tools use system resources.

If you’ve consistently monitored system, then monitoring won’t alter system performance.

Page 11: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #11

Performance Problem Solutions1. Get more of needed resource.

Ex: Upgrade processor, use striped disk array.

2. Reduce system requirements.Ex: Kill processes, move services to other hosts.

3. Eliminate inefficiency and waste.Ex: Produce a static home page every 15 minutes instead

of regenerating each access.

4. Ration resource usage.Ex: Set process priorities with renice.

Ex: Limit process resource usage with limit.

Page 12: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #12

Monitoring Processes

uptimeProvides aggregate data about system load.

psShows running processes with CPU, mem usage.

topUpdated list of running processes + summaries.

vmstatSummary data about processes and CPU usage.

Page 13: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #13

Uptime

Uptime provides the following dataHow long system has been running.Number of users logged in.Average number of runnable processes.

In last 1, 5, 15 minutes.Want a load average under 3.

Uptime example> uptime 17:40 up 126 days, 8:03, 6 users, load average: 1.40, 1.03, 0.55

Page 14: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #14

Monitoring CPU with vmstatImportant Columns:

– Number of Runnable and Blocked processes.– CPU usage by user, system, idle, and waiting.

High CPU usage indicators– r > 0 in multiple consecutive rows– us+sy > 80 in many consecutive rows– id < 20 in many consecutive rows

> vmstat 5 4procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu---- r b swpd free buff cache si so bi bo in cs us sy id wa 0 0 395716 45176 211284 88480 0 0 1 2 1 2 9 3 88 0 2 0 395716 45168 211300 88480 0 0 0 50 1035 1677 71 2 27 0 3 0 395716 45168 211300 88480 0 0 0 0 1040 1670 75 3 23 0 5 0 395716 45168 211300 88480 0 0 0 0 1033 1660 83 3 13 0

Page 15: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #15

Identifying CPU Shortages

1. Short-term CPU spikes are normal.

2. Consistently high number of runnable processes (r) in vmstat.

3. Consistent high total CPU usage (sy+us).

4. High system time compared to user time and high context switches indicates system is thrashing between processes instead of doing user work.

Page 16: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #16

Changing Process Priorities

Nice valuesPositive values lower priorities.

Negative values increase priorities.

If you know a process will be a CPU hog,nice +5 command_name

If you detect a CPU hog after it’s started,renice 5 PID

Page 17: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #17

Managing Processes with kill

TERM (default)Terminates process execution (Ctrl-c).

Processes can catch or ignore signal.

KILL (9)Terminates process execution.

Processes cannot catch or ignore.

Processes waiting on I/O will not die.

STOPSuspends process execution until SIGCONT (Ctrl-z).

Useful for moving CPU hog out of way temporarily.

Page 18: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #18

Monitoring Memory with vmstatImportant columns

– si (swap in) = loading pages from disk, including program starts– so (swap out) = saving pages to disk because out of RAM

Memory problems are indicated by:– so > 0 in multiple consecutive rows– si > 1000 in many consecutive rows

> vmstat 5 4procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu---- r b swpd free buff cache si so bi bo in cs us sy id wa 0 0 395716 45176 211284 88480 0 0 1 2 1 2 9 3 88 0 0 0 395716 45168 211300 88480 0 5 0 50 1035 1677 0 0 100 0 0 0 395716 45168 211300 88480 0 8 0 0 1040 1670 0 0 99 0 0 0 395716 45168 211300 88480 0 6 0 0 1033 1660 0 0 100 0

Page 19: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #19

Managing Memory

1. Improving paging capacity.Add new swapfiles with swapon.

Add new swap partitions.

2. Improving paging performance.Use swap partitions instead of swap files.

Distribute swap resources across disks.

3. Migrate memory hogs to another host.

4. Add more memory.

Page 20: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #20

Identifying I/O bottlenecksImportant Columns:

– Number of Runnable and Blocked processes.– Blocked processes cannot run because waiting on I/O.– Blocks/second transferred in (bi) and out (bo)

Identifying problems:– b > 0 consistently across multiple rows– bi and/or bo > 1000 across many rows

> vmstat 5 4procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu---- r b swpd free buff cache si so bi bo in cs us sy id wa 0 0 395716 45176 211284 88480 0 0 1 2 1 2 9 3 88 0 0 5 395716 45168 211300 88480 0 0 0 50 1035 1677 0 0 100 0 0 7 395716 45168 211300 88480 0 0 0 0 1040 1670 0 0 99 0 0 6 395716 45168 211300 88480 0 0 0 0 1033 1660 0 0 100 0

Page 21: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #21

Monitoring Disk I/O

Use iostat to get per disk statistics.Transactions per second (tps).

Blocks read/written per second.

Managing disk performance problems.Distribute heavily used data across disks/ctrlers.

Get more or faster disks.

Use RAID or LVM striping.

Page 22: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #22

iostat> iostat 2Linux 2.6.15-23-386 (zim) 03/26/2007

avg-cpu: %user %nice %system %iowait %steal %idle 8.55 0.18 3.22 0.09 0.00 87.96

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtnhde 0.69 8.18 9.43 89783416 103565744hdh 0.15 1.33 3.37 14590831 36969599hdc 0.00 0.00 0.00 9548 0

avg-cpu: %user %nice %system %iowait %steal %idle 0.17 0.00 0.17 0.00 0.00 99.67

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtnhde 0.33 0.00 21.33 0 128hdh 0.00 0.00 0.00 0 0hdc 0.00 0.00 0.00 0 0

Page 23: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #23

Managing Disk Capacity

Detecting disk resource usage.List all partition usage with df –hIdentify high usage directories with du

Summary data: du –sHighest usage directories: du -k /|sort –rn

Use find to detect disk hogs.Use find –size to search for big files.

Use –atime +X to identify files that haven’t been used in X days.

Page 24: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #24

Managing Disk Shortages

1. Add more disks.

2. Move files to remote fileservers.

3. Eliminate unnecessary files.

4. Compress large infrequently used files.

5. Impose disk quotas on users.Soft limit: can be violated temporarily.

Hard limit: cannot be violated.

Page 25: CIT 470: Advanced Network and System Administration

IPTraf

CIT 470: Advanced Network and System Administration Slide #25

Page 26: CIT 470: Advanced Network and System Administration

iftop

CIT 470: Advanced Network and System Administration Slide #26

Page 27: CIT 470: Advanced Network and System Administration

References

1. Mark Burgess, Principles of System and Network Administration, Wiley, 2000.

2. Aeleen Frisch, Essential System Administration, 3rd edition, O’Reilly, 2002.

3. Mike Loukides and Gian-Paolo D. Musumeci, System Performance Tuning, 2nd edition, O’Reilly, 2003.

4. Evi Nemeth et al, UNIX System Administration Handbook, 3rd edition, Prentice Hall, 2001.

5. patterns & practices, Performance Testing Guidance for Web Applications, http://perftestingguide.codeplex.com/