Finally! The RAID F Simulator is here ( and attachedd )
Dear All, Jesper from the Copenhagen Business School got this crazy idea some weeks ago, and with input from Michael Mller of Miracle A/S, it's my proud honor to present the World's first Oracle-based RAID-F Simulator. It's all fun and games, of course, and Jesper got inspired after reading James Morle's book. He simply copied the 20 pages or so about RAID and handed it to his boss and said that this was the knowledge he needed to understand the way Jesper was thinking about RAID! The boss did read it, and did understand it, and then Jesper went ahead with the RFS project just for fun. With the kind permission of Jared, I have attached it. So this is your Christmas gift from Jesper :-). Best regards, Mogens Spool raid.log Set pages 5 Set lines 132 Set trimspool on Set echo on /* RAID simulator == Introduction The purpose of the script is to have fun, while trying to get a better understanding of RAID-4 and RAID-5. James Morle writes in Scaling Oracle8i that one can play with XOR operations on a scientific calculator to see, that the redundancy in RAID-5 is sufficient to rebuild a crashed disk. After a few minutes using the Windows Calculator Jesper decided to automate the calculations by starting to write this script. Michael got hooked on the idea and made several improvements. The script simulates a RAID-4 system using an Oracle database. We are going to - Deal with physical data disks, a parity disk and one large logical disk. - Set up automatic maintenance of redundancy on the parity disk. - Format the disks and put some data on the logical volume. - See consequences of a disk crash followed by a successful disk rebuild. - Do some updates and check that the integrity is maintained. - Make a binary dump of everything to make it clear, what RAID is about. How to get started -- If you just want a quick tour then - Run this script with SQL*Plus against an Oracle9i database. - Open the logfile raid.log with your favourite editor. - Locate the test section (search for TESTING) and start reading. It is very simple plain SQL simulating a disk crash and a disk rebuild. If you want more then - Continue reading until you are working at the bit-level and/or - See how the simulation was set up in the first section. If you just can't get enough - Solve the exercises and write your own code. Difference Between RAID-4 and RAID-5 A RAID-4 system has a dedicated parity disk, which is maintained at block level like this: RAID-4 disk0 disk1 disk2 disk3 parity disk - - - - --- block 0block 1block 2block 3parity 1 block 4block 5block 6block 7parity 2 block 8block 9block 10 block 11 parity 3 block 12 block 13 block 14 block 15 parity 4 Etc. Considering the 4 physical data disks as one large logical volume, the Logical Volume Blocks can be mapped to the Physical Disk blocks like this: Logical Volume Address = 4 * Physical Disk Address + Disk Number From that statement we can derive: Disk Number = Mod(Logical Volume Address, 4) Physical Disk Address = Trunc(Logical Volume Address / 4) When doing a write to the logical volume we have to - Read the old data block - Read the old parity block - Write the new data block - Write the new parity block This cost of four physical I/Os for one logical write is known as the write penalty. If you are doing many random writes, then the parity disk becomes very hot. To avoid the bottleneck with one single very hot parity disk, RAID-5 stripes the parity blocks on all disks. Thus the write penalty is load balanced on more disks like this. RAID-5: disk0 disk1 disk2 disk3 disk4 - - - - - block 0block 1block 2block 3parity 1 block 4block 5block 6parity 2 block 7 block 8block 9parity 3 block 10 block 11 block 12 parity 4 block 13 block 14 block 15 Etc. NOTE: The write penalty still exists. In RAID-5 it is just load balanced. In order to keep things simple, this script simulates RAID-4. This simplifies calculations regarding where to physically find the data and parity blocks. The difference between RAID-4 and RAID-5 is only where the blocks are stored. There are no differences in the contents of the blocks. Thus we can learn how RAID-4 and RAID-5 works, without making it too difficult to deal with. If you really like complexity, then try to establish the 1:1 relationship between logical and physical blocks in RAID-5. Then migrate this script to support RAID-5. (Easier exercises can be found elsewhere in the script).
Re: Finally! The RAID F Simulator is here ( and attachedd )
LOL! Just to add my 2c worthI think you can get a simpler XOR implementation with: CREATE OR replace FUNCTION bitor( x IN NUMBER, y IN NUMBER ) RETURN NUMBER AS BEGIN RETURN x + y - bitand(x,y); END; / CREATE OR replace FUNCTION bitxor( x IN NUMBER, y IN NUMBER ) RETURN NUMBER AS BEGIN RETURN bitor(x,y) - bitand(x,y); END; / Cheers Connor --- Jared Still [EMAIL PROTECTED] wrote: Dear All, Jesper from the Copenhagen Business School got this crazy idea some weeks ago, and with input from Michael Möller of Miracle A/S, it's my proud honor to present the World's first Oracle-based RAID-F Simulator. It's all fun and games, of course, and Jesper got inspired after reading James Morle's book. He simply copied the 20 pages or so about RAID and handed it to his boss and said that this was the knowledge he needed to understand the way Jesper was thinking about RAID! The boss did read it, and did understand it, and then Jesper went ahead with the RFS project just for fun. With the kind permission of Jared, I have attached it. So this is your Christmas gift from Jesper :-). Best regards, Mogens Spool raid.log Set pages 5 Set lines 132 Set trimspool on Set echo on /* RAID simulator == Introduction The purpose of the script is to have fun, while trying to get a better understanding of RAID-4 and RAID-5. James Morle writes in Scaling Oracle8i that one can play with XOR operations on a scientific calculator to see, that the redundancy in RAID-5 is sufficient to rebuild a crashed disk. After a few minutes using the Windows Calculator Jesper decided to automate the calculations by starting to write this script. Michael got hooked on the idea and made several improvements. The script simulates a RAID-4 system using an Oracle database. We are going to - Deal with physical data disks, a parity disk and one large logical disk. - Set up automatic maintenance of redundancy on the parity disk. - Format the disks and put some data on the logical volume. - See consequences of a disk crash followed by a successful disk rebuild. - Do some updates and check that the integrity is maintained. - Make a binary dump of everything to make it clear, what RAID is about. How to get started -- If you just want a quick tour then - Run this script with SQL*Plus against an Oracle9i database. - Open the logfile raid.log with your favourite editor. - Locate the test section (search for TESTING) and start reading. It is very simple plain SQL simulating a disk crash and a disk rebuild. If you want more then - Continue reading until you are working at the bit-level and/or - See how the simulation was set up in the first section. If you just can't get enough - Solve the exercises and write your own code. Difference Between RAID-4 and RAID-5 A RAID-4 system has a dedicated parity disk, which is maintained at block level like this: RAID-4 disk0 disk1 disk2 disk3 parity disk - - - - --- block 0block 1block 2block 3 parity 1 block 4block 5block 6block 7 parity 2 block 8block 9block 10 block 11 parity 3 block 12 block 13 block 14 block 15 parity 4 Etc. Considering the 4 physical data disks as one large logical volume, the Logical Volume Blocks can be mapped to the Physical Disk blocks like this: Logical Volume Address = 4 * Physical Disk Address + Disk Number From that statement we can derive: Disk Number = Mod(Logical Volume Address, 4) Physical Disk Address = Trunc(Logical Volume Address / 4) When doing a write to the logical volume we have to - Read the old data block - Read the old parity block - Write the new data block - Write the new parity block This cost of four physical I/Os for one logical write is known as the write penalty. If you are doing many random writes, then the parity disk becomes very hot. To avoid the bottleneck with one single very hot parity disk, RAID-5 stripes the parity blocks on all disks. Thus the write penalty is load balanced on more disks like this. RAID-5: disk0 disk1 disk2 disk3 disk4 - - - - - block 0block 1block 2block 3 parity 1 block 4block 5block 6parity 2 block 7 block 8block 9parity 3 block 10 block 11 block 12 parity 4 block 13 block 14 block 15 Etc. NOTE: The write penalty still exists. In RAID-5 it is just load balanced. In order to keep things simple, this script
Re: Finally! The RAID F Simulator is here ( and attachedd )
I don't think you should be playing with this and having fun when you could use the valuable Christmas period for rebuilding all your indexes. NB Joke But since it's Oracle 9.2 that gets mentioned how about trying the new bit functions: select sys_op_rawtonum( sys_op_vecxor( sys_op_numtoraw(6), sys_op_numtoraw(5) ) ) from dual / I won't guarantee that they're faster, and they certainly look messier than the pl/sql function calls, but I think they are SQL built-ins, and therefore may be faster running than pl/sql function calls. sys_op_vecor and sys_op_vecand are also available. Regards Jonathan Lewis http://www.jlcomp.demon.co.uk The educated person is not the person who can answer the questions, but the person who can question the answers -- T. Schick Jr One-day tutorials: http://www.jlcomp.demon.co.uk/tutorial.html Three-day seminar: see http://www.jlcomp.demon.co.uk/seminar.html UK___November The Co-operative Oracle Users' FAQ http://www.jlcomp.demon.co.uk/faq/ind_faq.html - Original Message - To: Multiple recipients of list ORACLE-L [EMAIL PROTECTED] Sent: Monday, December 22, 2003 11:34 AM LOL! Just to add my 2c worthI think you can get a simpler XOR implementation with: CREATE OR replace FUNCTION bitor( x IN NUMBER, y IN NUMBER ) RETURN NUMBER AS BEGIN RETURN x + y - bitand(x,y); END; / CREATE OR replace FUNCTION bitxor( x IN NUMBER, y IN NUMBER ) RETURN NUMBER AS BEGIN RETURN bitor(x,y) - bitand(x,y); END; / Cheers Connor --- Jared Still [EMAIL PROTECTED] wrote: Dear All, Jesper from the Copenhagen Business School got this crazy idea some weeks ago, and with input from Michael Möller of Miracle A/S, it's my proud honor to present the World's first Oracle-based RAID-F Simulator. It's all fun and games, of course, and Jesper got inspired after reading James Morle's book. He simply copied the 20 pages or so about RAID and handed it to his boss and said that this was the knowledge he needed to understand the way Jesper was thinking about RAID! The boss did read it, and did understand it, and then Jesper went ahead with the RFS project just for fun. With the kind permission of Jared, I have attached it. So this is your Christmas gift from Jesper :-). Best regards, Mogens -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Jonathan Lewis INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).