Presentation is loading. Please wait.

Presentation is loading. Please wait.

Database Storage Considerations Adam Backman White Star Software DB-05:

Similar presentations


Presentation on theme: "Database Storage Considerations Adam Backman White Star Software DB-05:"— Presentation transcript:

1 Database Storage Considerations Adam Backman White Star Software adam@wss.com DB-05:

2 © 2005 White Star Software DB-05 Database Storage Considerations Outline ä Why is DB storage so important? ä Hardware options ä RAID vs. JBOD ä Network Storage (SAN, NAS, …) ä Database setup options ä Block size ä Cluster size (DB and BI) ä Splitting Data into areas

3 © 2005 White Star Software DB-05 Database Storage Considerations Why is DB Storage So Important? ä Everything starts from the disk ä Disks need to be reliable and fast ä All physical disks are only capable of doing approximately 100 operations per second ä Salespeople are weasels

4 © 2005 White Star Software DB-05 Database Storage Considerations Who cares about 100 I/O operations per second? Example: 10000 read operations 90% buffer hit rate 1 disk would take 10 seconds to complete 10 disks would take 1 second to complete Which of these would your users choose?

5 © 2005 White Star Software DB-05 Database Storage Considerations Stop I/O before it gets to the disks ä Application code ä Use indexes ä Watch out for can-find ä Bulk updates vs. many small updates ä Use memory not disk ä Add system memory (no swapping or paging) ä Increase buffers (-B, -Bt, -Bp) ä Add cache to disk controllers

6 © 2005 White Star Software DB-05 Database Storage Considerations A little more about buffer hit rate Using same example: 10000 Logical reads 90% buffer hit rate = 1000 Physical reads 95% buffer hit rate = 500 Physical reads 96% buffer hit rate = 400 Physical reads See the effect buffer efficiency has on disks!

7 © 2005 White Star Software DB-05 Database Storage Considerations What causes disk I/O? ä Operating system (swapping and paging) ä Progress ä Database (DB and BI) ä Application (code and temp files) ä Other applications

8 © 2005 White Star Software DB-05 Database Storage Considerations Hardware Options ä RAID vs. JBOD ä Buying disks ä What is variance ä Simplicity and cost vs. control and budget ä Network vs. Locally Attached Storage ä Definitions ä Configuration ä Pros and Cons

9 © 2005 White Star Software DB-05 Database Storage Considerations Buying Disks ä Buy small disks Each disk regardless of it’s size is capable of doing the same number of I/Os per second ä Buy fast disks Slow disk = slow performance ä Buy reliable disks ä Buy many disks The inner portion of the disk is 20% faster than the outer portion of the disk

10 © 2005 White Star Software DB-05 Database Storage Considerations Balancing Disk I/O Balancing disk I/O is the process of making sure you are using all of the available disk resources (file systems, disks and controllers) are working equally as hard at load. This is also called eliminating variance. A well tuned system will have less than a 15% variance across all disks.

11 © 2005 White Star Software DB-05 Database Storage Considerations How can I eliminate variance? Warning: This is a religious argument. Everyone has an opinion and everyone is right. There are two schools of thought. ä The system should take care of this. ä I will take care of this.

12 © 2005 White Star Software DB-05 Database Storage Considerations The system will take care of this. Disk I/O can be effectively distributed by the operating system with the use of smart I/O systems. Most notably RAID. Basic Definition of RAID: Redundant Array of Independent Disks

13 © 2005 White Star Software DB-05 Database Storage Considerations What RAID really means RAID has many levels. I will only cover a few. ä RAID 0: This level is also called striping. ä RAID 1: This is referred to as mirroring. ä RAID 5: Most popular RAID level ä RAID 10: This is mirroring and striping. Also known as RAID 0 + 1

14 © 2005 White Star Software DB-05 Database Storage Considerations Network vs. Local Storage ä Network storage options ä Benefits of network storage ä Drawbacks of network storage

15 © 2005 White Star Software DB-05 Database Storage Considerations Network Storage Options ä SAN (Storage Area Network) A dedicated storage network supporting multiple computers ä NAS (Network Attached Storage) A dedicated storage device on an existing network including a SAN ä iSCSI A storage networking protocol allows storage traffic to travel through general-purpose networks instead of the specialized Fibre Channel SAN

16 © 2005 White Star Software DB-05 Database Storage Considerations Benefits of Network Storage ä Centralized data store - buy a SAN, hook up many servers ä Easier to maintain (backup one place)

17 © 2005 White Star Software DB-05 Database Storage Considerations Drawbacks to Network Storage ä More complex performance monitoring Many servers all making requests at the same time make it difficult to resolve conflicts ä Overall more complex More things to break ä Single point of failure Many vendors support array to array mirroring to resolve this issue ä Generally more expensive Unless you have a large number of servers using the network storage

18 © 2005 White Star Software DB-05 Database Storage Considerations Creative Hardware Solution: Solid State Disks ä PROs ä Reliable ä Fast ä CONs ä Expensive ä Really expensive ä Conclusion: Good for logs (AI and BI) and limited portions (hot spots) of the database

19 © 2005 White Star Software DB-05 Database Storage Considerations I will take care of this ä Manual spread of data across disks ä Better control as you can see where the I/O is going ä More attention by system administrator is needed ä Administrator must think about reliability as well

20 © 2005 White Star Software DB-05 Database Storage Considerations Database Setup Options ä Database Stuff ä Storage areas ä Blocksize and Records per block ä Type II areas ä BI cluster size ä Effect of BI cluster size ä Why are APWs affected by BI Cluster size

21 © 2005 White Star Software DB-05 Database Storage Considerations Storage Areas ä Benefits ä Greater control of location of data ä Minimize downtime for utilities ä Stripe some, leave some on straight disks ä Drawbacks ä More things to break ä More complex to monitor

22 © 2005 White Star Software DB-05 Database Storage Considerations Storage Areas - Control ä A Storage Area can hold 1 or more data objects (index, table, schema, …) ä Separate schema from data if possible ä Isolate the logs (AI and BI) ä Try to keep the number of areas manageable, only add more areas for valid business reasons

23 © 2005 White Star Software DB-05 Database Storage Considerations Database Block Size ä 8k for most (4k for NT) ä More in synch with the operating system ä More stuff per read ä Especially good for index reads ä Watch the number of records per block so you don’t waste block space

24 © 2005 White Star Software DB-05 Database Storage Considerations Records per Block ä Can be set to a binary number between 1 and 256 ä If it is set too low you will waste space at the end of each block ä If you set it too high you run the risk of fragmenting records (most true for records that grow over time) ä More important to get right for type II areas

25 © 2005 White Star Software DB-05 Database Storage Considerations Setting Records per Block First do a database analysis. proutil -C dbanalys > filename Then take the mean record size of the table(s) you are working with and add 20 bytes for record and block overhead. Divide the result above into your block size. Last take a binary number just above the result above.

26 © 2005 White Star Software DB-05 Database Storage Considerations Example: Setting Records/Block ä Table 1 has a mean record size of 120 bytes ä Add 20 bytes of overhead (140) ä Divide block size (8192) by result (140) This (58.51) is how many mean-sized records will fit in a single database block ä Take the next higher binary number (64) Are there exceptions, you bet!

27 © 2005 White Star Software DB-05 Database Storage Considerations Type II Areas ä The table and index blocks from individual objects are clustered together ä The cluster size is “tunable” to 8, 64 or 512 block clusters ä Benefits: Potential performance benefits ä Drawbacks: Yet another thing to try to get right, potential wasted space

28 © 2005 White Star Software DB-05 Database Storage Considerations How Type II Areas Work ä The data blocks are clustered together and in turn these clusters are chained together ä Scan type operations need only find the first block and the rest of the blocks will follow Example: When you do an index rebuild, the first step is to delete all of the index blocks. In a type 1 area all of the blocks in the area are scanned and the index blocks are deleted. In a type II area the first cluster is put on the free chain and no other updates are needed.

29 © 2005 White Star Software DB-05 Database Storage Considerations Why are APWs Affected by BI Cluster Size ä The BI cluster size determines the length of the checkpoint ä The APW efficiency determines the efficiency of the checkpoint ä Generally, I start with 1 apw and the “correct” BI cluster size and then add 1 apw if I see buffers flushed at checkpoint during my “important” processing times.

30 © 2005 White Star Software DB-05 Database Storage Considerations BI Cluster Size ä The default value of 512 KB is wrong for most people ä Monitor the DB during your high update portion of the day ä Set the cluster size high enough to keep checkpoint lengths greater than 2 minutes ä Generally, 1 MB to 8 MB for most sites

31 © 2005 White Star Software DB-05 Database Storage Considerations Conclusion ä Look at your storage ä No RAID 5 ä RAID or JBOD ä To network or not to network ä Get your DB setup right ä Block size (remember records per block) ä Rational split of your data into storage areas ä Type II areas (where needed) ä Get your BI cluster size right

32 © 2005 White Star Software DB-05 Database Storage Considerations Use Both Methods ä Use mirroring to protect your data ä Use stripping to get your data onto more physical drives ä Use storage areas and extents eliminate variance ä Use storage areas and extents to further spread your data

33 © 2005 White Star Software DB-05 Database Storage Considerations Questions


Download ppt "Database Storage Considerations Adam Backman White Star Software DB-05:"

Similar presentations


Ads by Google