DTrace book sample chapter: File Systems
The long awaited DTrace book, which I posted as coming soon in September last year, is finally ready to be printed! Since then it has been through copy-edit, composition, formatting and indexing. It’s taken a while, due in part to this being an 1100 page book. It’s exciting to now see the final copy that will begin printing. Jim and I have also received the table of contents and a sample chapter from the final copy to share:
| DTrace Book: Table of Contents PDF (16 pages) |
| DTrace Book: Chapter 5 File Systems PDF (108 pages) |
Chapter 5 analyses file systems using DTrace, and includes scripts to trace VFS, UFS, ZFS, HFS+ and others. File system analysis is particularly important for performance investigations as this can measure response time as experienced by the application, and includes all file system I/O. This is often more relevant than looking at disk I/O, which may be asynchronous to the application (file system write flushing), and can miss issues entirerly. Slow I/O isn’t always due to disks – it could be kernel lock contention, for example. If there are indeed issues at the disk level, DTrace can investigate in detail there too. Chapter 4 Disk I/O shows tracing of the lower level I/O subsystem including block devices, SCSI, SATA, IDE and SAS.
I’ve summarized the chapters and appendices below, with final page counts:
| # | APPENDIX | PAGES |
|---|---|---|
| A | DTrace Tunable Variables | 6 |
| B | D Language Reference | 14 |
| C | Provider Arguments Reference | 20 |
| D | DTrace on FreeBSD | 6 |
| E | USDT Example | 12 |
| F | DTrace Error Messages | 10 |
| G | DTrace Cheat Sheet | 4 |
| - | Glossary | 12 |
| # | CHAPTER | PAGES |
|---|---|---|
| 1 | Introduction | 18 |
| 2 | The D Language | 32 |
| 3 | System View | 100 |
| 4 | Disk I/O | 140 |
| 5 | File Systems | 108 |
| 6 | Network Lower Level Protocols | 158 |
| 7 | Application Protocols | 112 |
| 8 | Languages | 114 |
| 9 | Applications | 50 |
| 10 | Databases | 34 |
| 11 | Security | 26 |
| 12 | Kernel | 54 |
| 13 | DTrace Tools | 40 |
| 14 | Tips and Tricks | 18 |
I’ve included the Glossary as it’s a particularly important part of the book. Since we cover such a wide range of topics, readers may be exposed to unfamiliar topics with unfamiliar terminology. Jim and I wrote a longer than usual Glossary to cover all the terms, which we hope is helpful.
We’ll make the scripts available to download as a tarball so that you don’t need to retype the scripts from the book, or the sample PDF (copy-n-paste from the PDF doesn’t work well anyway).
You can watch videos of Jim and myself talking about the book (taken roughly a year ago): Introduction to the DTrace book and What’s in the DTrace book.
Update Nov 3, 2011:
We have some newer videos about the DTrace book, and particularly its relevance to Oracle Solaris 11.
And there’s a website for the DTrace book.
In: DTrace · Tagged with: book, dtrace, filesystem, performance






on February 23, 2011 at 4:42 pm
Permalink
[...] This post was mentioned on Twitter by cpj1, Matthew Smillie and Bill Pijewski, Brendan Gregg. Brendan Gregg said: DTrace book sample chapter available to download http://bit.ly/icmFiC Chapter 5 File Systems [...]
on February 23, 2011 at 4:55 pm
Permalink
Congratulations, I’m sure it’s been worth the wait.
on February 23, 2011 at 5:22 pm
Permalink
Great news!
on February 23, 2011 at 7:27 pm
Permalink
An interesting chapter. I’m looking forward to Appendix C
on February 24, 2011 at 12:49 am
Permalink
[...] looks that he and Jim Mauro completed their work and it appears as it's near to going to print. In DTrace book sample chapter: File Systems he offers a the table of content and the chapter about filesystems as a teaser. Posted by Joerg [...]
on February 25, 2011 at 1:03 am
Permalink
[...] DTrace your file system. From their soon-to-be-published book: DTrace: Dynamic Tracing in Oracle Solaris, Mac OS X and FreeBSD, authors Brendan Gregg and Jim Mauro have posted Chapter 5 on File Systems as a free download. [...]
on February 25, 2011 at 3:29 pm
Permalink
awesome
Looking forward to the book
and learning more about some of the nuances like printing multiple aggregates , regular expression matching in predicates, tricks such as looping if you just have to do it
on February 26, 2011 at 12:46 pm
Permalink
Amazon are saying 18th March is that nailed on?
Also so glad to see it is in paperback :-)
Paul
on March 2, 2011 at 11:17 am
Permalink
Hearty congrats! A great milestone!
on March 3, 2011 at 8:49 pm
Permalink
Looks good. Will this be available in Kindle format?
Keith
on March 6, 2011 at 1:26 pm
Permalink
great news:)
do you plan do deliver a kindle version?
on May 13, 2011 at 11:57 am
Permalink
[...] Hurray! Just received a long awaited DTrace: Dynamic Tracing in Oracle Solaris, Mac OS X and FreeBSD book. From the very begining, even before I had pre-ordered it from Amazon, I knew it would be another great work made by Brendad Gregg and Jim Mauro. And I wasn’t mistaken. If you don’t trust me I strongly encourage everyone to read a sample chapter generously provided by Brendan – DTrace book sample chapter: File Systems. [...]
on May 24, 2011 at 5:57 pm
Permalink
[...] can be modified to include other syscall types, and other file systems. See fsrwtime.d from the DTrace book for a version that matches more syscall types, and prints latency by file system, operation and [...]
on June 16, 2011 at 4:38 pm
Permalink
[...] Jim and I produced many new VFS scripts, covering Solaris, Mac OS X and FreeBSD. These are in the File Systems chapter (which is available as a PDF). While many of these did not report latency statistics, it is not [...]
on July 8, 2011 at 12:14 pm
Permalink
[...] In 2007 I wrote some DTrace MySQL onliners and scripts, including mysql_pid_etime.d, which used the DTrace pid provider. Derek Crudgington (now a fellow Joyeur) took this a little further and compiled a MySQL DTrace Kit containing several pid provider-based scripts, which also traced slow query writes. I never went much further with the pid provider since a better way was in development: the USDT-based DTrace mysql provider. This was much easier to use and has a stable (or more stable) interface. I included some mysql provider one-liners and scripts in the DTrace book. [...]
on November 14, 2011 at 8:29 pm
Permalink
[...] invisible via iostat(1M). I’ve wrestled with this issue before, and have included scripts in the DTrace book to show the SCSI cache flush [...]
on November 30, 2011 at 1:15 pm
Permalink
[...] can be modified to include other syscall types, and other file systems. See fsrwtime.d from the DTrace book for a version that matches more syscall types, and prints latency by file system, operation and [...]
on December 2, 2011 at 1:16 pm
Permalink
[...] be good enough – and a lot simpler. That’s why we put it early in the Strategy section of the File Systems chapter of the DTrace [...]