Measuring Firebird Disk I/O


Published on

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Measuring Firebird Disk I/O

  1. 1. Measuring Firebird Disc I/O Paul Reeves IBPhoenix
  2. 2. IntroductionDisc I/O is one of the main bottlenecks inFirebird. A good disc array can give amassive increase in available IOPS. Thequestion is how do we measure our discI/O requirements?
  3. 3. Two Basic Ways To Measure IOFrom within Firebird itselfFrom the host O/S
  4. 4. Measuring I/O from Firebird Firebird knows what it has done –MON$IO_STATS allows us to catch thisinfo. Portable across platforms and architecures Works wih all versions since Fb 2.1 Sort of a work in progress -enhanced in 2.5
  5. 5. MON$IO_STATSFirebird tracks four IO countersPage Reads - physical reads from discPage Writes – physical writes to discPage Fetches – pages read from memoryPage Marks – pages marked in memory forwriting to disc.
  6. 6. About FetchesMostly we can ignore Fetches but be sure tomake sure that the cache is big enoughotherwise excessive reads will occur.Be sure to tune DB Cache before drawingany conclusions about Firebird disc I/O.
  7. 7. Understanding How the MON$ tables work All the Firebird monitoring tables run withinsnapshot table stability transactions. You need to start a new transaction to seethe latest data in the monitoring tables. Historic data is not stored. Once a transaction is finished or an attach-ment is disconnected the details disappearfrom the monitoring tables. Cumulative database level stats requirespersistent connections. This means thateven database level stats are lost if all con-nections to the database are closed.
  8. 8. Making Stats persist - DBTriggers DB Triggers available at Connection and Transaction Level. Stats are stored at Attachment and Trans- action Level (amongst others.) Solution – catch stats at end of Connection or Transaction.
  9. 9. Capturing Txn Stats Initial analysis indicated that txn level statsmay not be complete – more study required. Worse – Txn commit triggers and read onlytransactions dont mix.
  10. 10. Capturing Connection Level Stats Stats seem to be complete(ish). No problems with r/o txns.
  12. 12. And a trigger to capture it with...
  13. 13. Add a couple of Stored Procs...And we can start to analyse our disc I/O byApplication, User, IP address.
  14. 14. Add a couple of Stored Procs...And we can start to analyse our disc I/O byApplication, User, IP address.
  15. 15. Problems with MON$IO_STATS Attachment level stats are almost complete– except that SS doesnt include back-ground threads. Accurate stats can only be acquired byrunning Classic. Long running attachments will produce rub-bish stats if tracking IOPS is the goal. But well written applications do not leaveconnections open – do they?.
  16. 16. Using the host O/S for monitoring All? modern O/S have monitoring and dia- gnostic tools. Well take a look at the one that comes with Windows.
  17. 17. Setting up perfmonPerfmon has one of the worst gui designs Ihave ever seen.Fortunately we dont have to use it.We use logman instead.Logman is the script interface to the perf-mon counters.
  18. 18. Register a counter set for logmanTypical command-line: logman.exe create counter configname -cf d:pathtodconfig.cfg -f csv --v -o d:pathtodoutputfile -y -si 1These options mean: Param Description -cf Name of config file -f csv Use csv file format --v Attach file versioning information to the end of the log name -o Output path and file name -y Answer yes to all questions without prompting -si 1 Sample interval in seconds.
  19. 19. What to log at disc level?Counter DescriptionCacheData Maps/sec Data Maps/sec is the frequency that a file system such as NTFS, maps a page of a file into the file system cache to read the page.LogicalDisk($DRIVE)Disk Reads/secLogicalDisk($DRIVE)Disk Read Bytes/secLogicalDisk($DRIVE)Disk Writes/secLogicalDisk($DRIVE)Disk Write Bytes/secLogicalDisk($DRIVE)Avg. Disk Read Queue LengthLogicalDisk($DRIVE)Avg. Disk Write Queue LengthLogicalDisk($DRIVE)Current Disk Queue Length is the number of requests outstanding on the disk at the time the performance data is collected. ... Requests experience delays proportional to the length of this queue minus the number of spindles on the disks. For good performance, this difference should average less than two.LogicalDisk($DRIVE)Split IO/sec reports the rate at which I/Os to the disk were split into multiple I/Os. A split I/O may result from requesting data of a size that is too large to fit into a single I/O or that the disk is fragmented. Use sed to convert $DRIVE to actual drive: sed s/$DRIVE/d:pathtoddrive/g master.cfg > logman_drive.cfg
  20. 20. What to log at Firebird levelProcess(fb_inet_server#1)% Processor TimeProcess(fb_inet_server#1)IO Read Operations/secProcess(fb_inet_server#1)IO Write Operations/secProcess(fb_inet_server#1)Virtual BytesProcess(fb_inet_server#1)Working Set Note syntax for fb_inet_server processes. You can log as many fb_inet_server processes as you want, even if they dont exist.
  21. 21. Start logmanJust use:logman start counterset
  22. 22. Logman – useful things to knowlogman -? prints the help screenlogman query will list all known configsand show their status.logman stop configname will stop a run-ning config. Useful if you kill a batch file.Otherwise the dataset just keeps increasing.logman delete configname will do exactlywhat it says on the tin.
  23. 23. OK, weve got some data. Now What? That is a good question. Step One – analyse it for anomalies. Datacaches are usually the problem. Once all caching is disabled we can start torun meaningful tests to compare, say, asingle user with ten concurrent users.
  24. 24. Estimating required IOPS With the table above we can start to guestimate ourrequirements with one of the following:POTENTIAL_WIOPS = NUM_DISKS * DISK_WIOPSorPOTENTIAL_RIOPS = NUM_DISKS * DISK_RIOPS
  25. 25. Dont forget the write penaltyIf the test envionment is using a differentdisc sub-system to the target production en-vironment then be sure to account for theRAID write penalty.You need to look at the split betweenWIOPS and RIOPS and adjust accordingly.
  26. 26. SummaryWeve looked at two different ways ofmeasuring Firebird disc I/O.Weve seen some of the caveats requiredwhen studying the data results.Weve made a start at estimating disc sub-system requirements for Firebird.
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.