sql 2005 disk io performance

22
Copyright © 2006 Quest Software SQL 2005 Disk I/O Performance By Bryan Oliver SQL Server Domain Expert

Upload: jpaulino

Post on 10-Apr-2015

3.213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: SQL 2005 Disk IO Performance

Copyright © 2006 Quest Software

SQL 2005 Disk I/O Performance

By Bryan OliverSQL Server Domain Expert

Page 2: SQL 2005 Disk IO Performance

2

Agenda

• Disk I/O Performance• Call to Action• Performance Analysis Demo• Q & A

Page 3: SQL 2005 Disk IO Performance

3

Some Questions To Think About

• Two queries- the first is run once a week and takes 10 mins to return its result set- the second is run 10 thoushand times a week and takes 1 second to return its result set? which of these two queries will have the potential to affect Disk I/O the greatest.

• Two computers- the first uses Raid 5 for its data drive- the second uses Raid 10 for its data drive? which of these two computers will return data faster all else been equal

Page 4: SQL 2005 Disk IO Performance

4

The Basics of I/O

1. A single fixed disk is inadequate except for the simplest needs

2. Database applications require a Redundant Array of Inexpensive Disks (RAID) for:

a. Fault tolerance

b. Availability

c. Speed

d. Different levels offer different pros/cons

Page 5: SQL 2005 Disk IO Performance

5

RAID Level 5

• Pros– Highest Read data transaction rate; Medium Write data transaction rate– Low ratio of parity disks to data disks means high efficiency– Good aggregate transfer rate

• Cons– Disk failure has a medium impact on throughput; Most complex controller

design– Difficult to rebuild in the event of a disk failure (compared to RAID 1)– Individual block data transfer rate same as single disk

Page 6: SQL 2005 Disk IO Performance

6

RAID Level 1

• Pros– One Write or two Reads possible per mirrored pair– 100% redundancy of data– RAID 1 can (possibly) sustain multiple simultaneous drive failures

Simplest RAID storage subsystem design

• Cons– High disk overhead (100%)– Cost

Page 7: SQL 2005 Disk IO Performance

7

RAID Level 10 (a.k.a. 1 + 0)

• Pros– RAID 10 is implemented as a striped array whose segments are RAID 1

arrays – RAID 10 has the same fault tolerance as RAID level 1

RAID 10 has the same overhead for fault-tolerance as mirroring alone– High I/O rates are achieved by striping RAID 1 segments– RAID 10 array can (possibly) sustain multiple simultaneous drive failures– Excellent solution for sites that would have otherwise go with RAID 1 but

need some additional performance boost

Page 8: SQL 2005 Disk IO Performance

8

SAN (Storage Area Network)

• Pros– Supports

multiple systems – Newest

technology matches RAID1 / RAID1+0 performance

• Cons– Expense and

setup– Must measure

for bandwidth requirements of systems, internal RAID, and I/O requirements

Page 9: SQL 2005 Disk IO Performance

9

Overview by Analogy

Page 10: SQL 2005 Disk IO Performance

10

Monitoring Disk Performance

1. Physical Disk

2. Logical Disk

Page 11: SQL 2005 Disk IO Performance

11

Monitoring Raw Disk Physical Performance

Avg. Disk sec/Read and Avg. Disk sec/Write• Transaction Log Access

• Avg disk writes/sec should be <= 1 msec (with array accelerator enabled)

• Database Access• Avg disk reads/sec should be <= 15-20 msec• Avg disk writes/sec should be <= 1 msec (with array

accelerator enabled)• Remember checkpointing in your calculations!

Page 12: SQL 2005 Disk IO Performance

12

Monitoring Raw I/O Physical Performance

1. Counters - Disk Transfers/sec, Disk Reads/sec, and Disk Writes/sec

2. Calculate the nbr of transfers/sec for a single drive:

a. First divide the number of I/O operations/sec by number of disk drives

b. Then factor in appropriate RAID overhead

3. You shouldn’t have more I/O requests (disk transfers)/sec per disk drive:

8KB I/O Requests 10K RPM 9-72 GB 15K RPM 9–18 GBSequential Write ~166 ~250Random Read/Write ~90 ~110

Page 13: SQL 2005 Disk IO Performance

13

Estimating Average I/O

1. Collect long-term averages of I/O counters (Disk Transfers/sec, Disk Reads/sec, and Disk Writes/sec)

2. Use the following equations to calculate I/Os per second per disk drive:a. I/Os per sec. per drive w/RAID 1 = (Disk Reads/sec + 2*Disk

Writes /sec)/(nbr drives in volume)

b. I/Os per sec. per drive w/RAID 5 = (Disk Reads/sec + 4*Disk Writes /sec)/(nbr drives in volume)

3. Repeat for each logical volume. (Remember Checkpoints!)

4. If your values don’t equal or exceed the values on the previous slide, increase speeds by:a. Adding drives to the volume

b. Getting faster drives

Page 14: SQL 2005 Disk IO Performance

14

Queue Lengths

1. Counters - Avg. Disk Queue Length and Current Disk Queue Lengtha. Avg Disk Queue <= 2 per disk drive in volume

b. Calculate by dividing queue length by number of drives in volume

2. Example:a. In a 12-drive array, max queued disk request = 22 and

average queued disk requests = 8.25

b. Do the math for max: 22 (max queued requests) divided by 12 (disks in array) = 1.83 queued requests per disk during peak. We’re ok since we’re <= 2.

c. Do the math for avg: 8.25 (avg queued requests) divided by 12 (disks in array) = 0.69 queued requests per disk on average. Again, we’re ok since we’re <= 2.

Page 15: SQL 2005 Disk IO Performance

15

Disk Time

1. Counters - % Disk Time (%DT), % Disk Read Time (%DRT), and % Disk Write Time (%DWT)a. Use %DT with % Processor Time to determine time spent

executing I/O requests and processing non-idle threads.

b. Use %DRT and %DWT to understand types of I/O performed

2. Goal is the have most time spent processing non-idle threads (i.e. %DT and % Processor Time >= 90).

3. If %DT and % Processor Time are drastically different, then there’s usually a bottleneck.

Page 16: SQL 2005 Disk IO Performance

16

Database I/O

1. Counters – Page Reads/sec, Page Requests/sec, Page Writes/sec, and Readahead Pages/sec

2. Page Reads/seca. If consistently high, it may indicate low memory allocation or

an insufficient disk drive subsystem. Improve by optimizing queries, using indexes, and/or redesigning database

b. Related to, but not the same as, the Reads/sec reported by the Logical Disk or Physical Disk objects

3. Page Writes/Sec: Ratio of Page Reads/sec to Page Writes/sec typically ranges from 5:1 and higher in OLTP environments.

4. Readahead Pages/Seca. Included in Page Reads/sec value

b. Performs full extent reads of 8 8k pages (64k per read)

Page 17: SQL 2005 Disk IO Performance

17

Tuning I/O

1. When bottlenecking on too much I/O:a. Tuning queries (reads) or transactions (writes)

b. Tuning or adding indexes

c. Tuning fill factor

d. Placing tables and/or indexes in separate file groups on separate drives

e. Partitioning tables

2. Hardware solutions include:

a. Adding spindles (reads) or controllers (writes)

b. Adding or upgrading drive speed

c. Adding or upgrading controller cache. (However, beware write cache without battery backup.)

d. Adding memory or moving to 64-bit memory.

Page 18: SQL 2005 Disk IO Performance

18

Trending and Forecasting

1. Trending and forecasting is hard work!

2. Create a tracking table to store:a. Number of records in each table

b. Amount of data pages and index pages, or space consumed

c. Track I/O per table using fn_virtualfilestats

d. Run a daily job to capture data

3. Perform analysis:a. Export tracking data to Excel

b. Forecast and graph off of data in worksheet

4. Go back to step 2d and repeat

Page 19: SQL 2005 Disk IO Performance

19

Disk Rules of Thumb for Better Performance

1. Put SQL Server data devices on a non-boot disk

2. Put logs and data on separate volumes and, if possible, on independent SCSI channels

3. Pre-size your data and log files; Don’t rely on AUTOGROW

4. RAID 1 and RAID1+0 are much better than RAID5

5. Tune TEMPDB separately

6. Create 1 data file (per filegroup) for physical CPU on the server

7. Create data files all the same size per database

8. Add spindles for read speed, controllers for write speed

9. Partitioning … for the highly stressed database

10. Monitor, tune, repeat…

Page 20: SQL 2005 Disk IO Performance

20

Resources

• See Kevin Klines webcast and read his article on SQL Server Magazine called ‘Bare Metal Tuning’ to learn about file placement, RAID comparisons, etc.

• Check out www.baarf.com and www.SQL-Server-Performance.com

• Storage Top 10 Best Practices at http://www.microsoft.com/technet/prodtechnol/sql/bestpractice/storage-top-10.mspx

Page 21: SQL 2005 Disk IO Performance

21

Call to Action – Next Steps

• Attend a live demo: http://www.quest.com/landing/qc_demos.asp

• Download white papers: http://www.quest.com/whitepapers

• Get a trial versions: http://www.quest.com/solutions/download.asp

• Email us with your questions: [email protected] or go to www.quest.com

Page 22: SQL 2005 Disk IO Performance

22

Q & A

• Send questions to me at: [email protected] • Send broader technical questions to: [email protected]• For sales questions, go to: www.quest.com

THANK YOU!