Categories
Blog Posts Release Announcements Release Announcements: Workbench

Method R Workbench 9.4

Yesterday, we released Method R Workbench 9.4.1.0. This article is a tour of some of the 50 new application behavior changes.

Command history scrolling

In Workbench 9.3, it was a pain to try to find a given report in the output pane. For example, do this:

  1. Run the “Time by line range” action upon a 1,000-line trace file, with 1- as the range. The output will be 1,000 lines.
  2. Run the “Duration by call name” action upon the same file. The output will be about 15 lines.
  3. Run the “Time by line range” action again. Another 1,000 lines.
  4. Now, find the “Duration by call name” report, which now is buried between two 1,000-line reports.

This was a fun design problem. My initial idea was a “table of contents” dialog. It would list the actions that had been run, and then clicking on one would scroll the output pane back to the first line of that action’s output. But I hate dialogs.

It sucks when you hate your own best idea. But that’s what teams are for. Jeff proposed a far better idea: simply link the command history feature with the output pane. So now, finding that “Duration by call name” report is as easy as:

  1. Arrow up and down through the command text field until you get to the action you want to the report for. Then, presto!, there’s its report in the output pane.

We want our software to feel like “PFM” (pure magic). This design element is one of the opportunities you seek to fit that description. It wasn’t easy to implement, given that the size of the output pane is variable (View › Zoom), but that’s our problem to worry about, not yours.

CSV for importing into Excel

One of the stories I like to tell was when we helped a big company fix an overnight batch job duration problem by exporting our files panel content into CSV that you can copy and paste into Excel. As a result of that engagement, we added a new runnable action called “Details by file, for importing into Excel”. It used our mrls utility. The problem is, mrls is slower and less accurate than mrprofk, which creates the information for the files pane.

There’s no need to be slow and wrong when you can be fast and right. So we eliminated the action in the actions pane, and we added a shift-click feature to the existing “Copy selected file rows to output” button. Now it’s the “Copy selected file rows to output (shift-click for CSV)” button. It’s both accurate and blazing fast.

Sounds

Clearly, most of the information transfer from the Workbench application to your brain occurs through your visual channel. But one day in July 2020, one of our customers said this:

Running mrskew is so fast and the resulting display update so fluid I often cannot even tell if it ran…

After studying the problem a little bit, we decided to begin to use sound as an additional channel for transmitting information from our Workbench application to your brain. Now, when you run a command that might take a while, you’ll get a little thumbs-up or thumbs-down sound when it’s finished. Now you can look away from the screen and still know definitively that your action has finished. We added that feature in August 2020, in Workbench 9.1.

One thing had been bugging me, though: the sounds didn’t really fit in with the other sounds my system makes. On macOS and Windows, there’s actually a system settings option that allows you to specify an alert sound for your system. You get to choose which sound you want, how loud it should play, and which device it should play on. Prior to 9.4, our Workbench application didn’t respect those settings. In 9.4, we do.

It’s nice to fit in.

Undo and redo

We worked long and hard on undo and redo in this release. Prior to 9.4, undo was restricted to the files pane. You could undo box-checking, and you could undo load and unload operations. We found the feature confusing to use, though, for a variety of reasons. At the same time, we didn’t offer any undo features in the command text field (the text field at the top of the output pane).

So, in 9.4.1, we’ve added good old-fashioned undo and redo with ⌘Z and ⇧⌘Z (Ctrl-Z and Shift-Ctrl-Z on Windows) in the command text field and both the filter fields.

Move to trash

Sometimes in our Workbench workflow, we come across files that we know we’re never going to want to load again. Those are the files with zero durations, or files with trace level 0 (see our new “Level” column, which reveals each file’s Oracle tracing level). Going to the filesystem browser to delete those files is tedious and dangerous—I hate look-here, but click-there workflows. It’s just easier to select the files you don’t want and delete them, with File › Move to Trash (it’s Move to Recycle Bin on Windows), right in the Workbench application.

It may sound dangerous, but don’t worry, Move to Trash just moves items to your trash can. If you make a mistake, you can still retrieve them.

If you don’t see the Move to Trash (or …Recycle Bin) option in your File menu, then you should update your JDK version to 9+. You can see the version you’re using by clicking Help › Diagnostics.

Label expressions

In my August 2023 article called “A Design Decision,” I talked about an enhancement that lets you use expressions in --group-label and --select-label values. What we didn’t realize at the time was that, in those expressions, mrskew wouldn’t let you refer to functions you’d defined yourself in the mrskew --init block. In 9.4.1, we’ve fixed that problem.

It’s a neat feature. We use it now in our three histogram RC files (disk.rc, p10.rc, ssd.rc) to make our code more elegant. The ability to use --group-label='label(0)' is the trick. I expect our users to push the feature even harder. See, for example, Jared Still’s amazing --init blocks on Slack.

And more

In the past few years, we’ve been increasingly required to carve through hundreds or thousands of trace files. We’re talking so many files that referring to “*” on the command line overfills the command line buffer. So each release in 2023 and 2024 has had some features to make managing lots of trace files easier. You can see all about what we’ve done at our Workbench Release Notes page.

I hope you enjoy!

Categories
Blog Posts

The Origins of Method R

This thing called “Method R” is a method for optimizing the performance of a system. The reason Method R is special is that it is itself optimized—it is designed to keep you from wasting your time. This article is about where Method R came from.

In the Beginning…

In the 1990s, the world was a boomtown for Oracle. A new age of relatively inexpensive minicomputers democratized IT all over the world. Instead of having to buy time on another department’s computer, you could just buy one of these new “open systems” from a vendor like DEC, Sun, Sequent, or Pyramid and run your accounting system on it yourself. No more chargebacks and scheduling and boring 1980s-era accounting packages.

People all over the world were doing it. But all the exciting new hardware and software had—guess what—a lot of growing pains. There were all kinds of problems, of course, but the ones that interested me in particular were the performance ones. There were a lot of performance problems. And there was a lot of money available for fixing those problems. This of course attracted consultants like moths to a flame.

Or flies to a trash can.

It was great being a consultant, though.

One perverse feature of the era was that being incompetent could actually increase your earnings. Through the magic of a time and materials (T&M) contract, the longer you took to solve a problem, the more you could get paid.

Normally, you would expect that healthy competition would shut down this particular perversion, but two important cogs in the gear-train weren’t ready yet:

  • The supply of expertise couldn’t match demand. This provided no incentive for consultants to improve, or for prices to fall.
  • Not many businesspeople were capable of understanding whether their consultants were doing a good job or not. This, also, provided no incentive for consultants to improve, or for prices to fall.

My motive was different. I wasn’t trying to camp out at a customer and pump revenue out of them. I was trying to make as many customers happy with my employer’s software (Oracle‘s software) as I could. The folks who were exploiting my employer’s customers on the more-revenue-for-incompetence plan were my enemy.

We Need a Method

By the late 1990s, I was in charge of nearly a hundred people at Oracle Corporation, solving performance problems at customers. I had good, smart people working for me, and we waged war against the poachers. My problem was, I couldn’t train people fast enough. It wasn’t for a lack of good teachers. It was for the lack of a good method to teach.

We did teach tips and tricks, but actually improving a system still required a fully tipped and tricked consultant to use a lot of un-distilled intuition and experience. My measurements at the time indicated that it took about 7 years for a smart college graduate to become a great performance optimizer. But by then, a consultant would be burned out from too much travel.

It was a treadmill. It led nowhere.

So We Made a Method

In late 1999, I left Oracle to start a business. Our mission was to create whatever it would take to make two things happen:

  1. Create a repeatable, teachable, optimized method—one that doesn’t waste anyone’s time—for optimizing a system.
  2. Create the software tools required to make that method actually usable in Real Life.
  3. Teach our customers everything we know, so that they can make well-informed decisions about performance.
Optimizing Oracle Performance book

Method-building was my focus from 1999 until 2003 when we published our first O’Reilly book, Optimizing Oracle Performance by Cary Millsap with Jeff Holt. The whole time we were developing it, we were consulting and teaching, exposing everything we knew to whatever audiences we could attract.

Our Influences

All the time we were developing Method R, we were reading the works of other scientists, trying to learn how people in non-Oracle domains had solved problems like the ones we were facing. Here are some of our major influences.

Dave Pelz

Dave Pelz's Putting Bible book

Dave Pelz is a former NASA scientist who became a golf researcher and coach. He teaches using the scientific method and real data. A single sentence from this book about golf perfectly describes the problem that many companies with performance problems faced throughout the 1990s:

There’s nothing worse than working hard on the wrong thing, expecting improvement from it, then ending up with nothing.

Dave Pelz, Dave Pelz’s Putting Bible, p215

The structure of his work—measuring the right thing, to ensure that you’re always focused on the right problem—inspired us and helped us explain our mission to others.

Jon Bentley

More Programming Pearls book

The very first paragraph of Jon Bentley’s More Programming Pearls says:

The stethoscope is a simple tool that revolutionized the practice of medicine: it gave physicians an effective way to monitor the human body. A profiler can do the same thing for your programs.

Jon Bentley, More Programming Pearls, p3

He then goes on to show the output of a profiler: a simple table that explains the response time—as a user would experience it!—of a computer program. That table profoundly changed my expectation for what kind of performance data I insist upon seeing. It was the genesis of the Method R receipt for response time™ idea.

Anjo Kolk

YAPP paper

So, can you create a profile for an Oracle program in the form that Jon Bentley describes? It turns out that the answer is yes. Our friend Anjo Kolk, an Oracle employee at the time, taught Jeff and me that we could create precise, accurate profiles using Oracle trace data.

This opened the door to creating software that could provide performance information in the format that a business needs to make well-informed decisions.

Eli Goldratt

The Goal book

Eli Goldratt’s The Goal transformed me. It was one huge, continuous a-ha. It solidified in my mind how to define the relationship between business and technology. It identified our real goal in a fog of millions of things we could designate as our goal:

Your goal is to simultaneously increase these metrics for the business: net profit, return on investment, and cash flow.

Eli Goldratt, The Goal, p48

Goldratt’s goal is our goal. His problems are our problems, just with different nouns. For example, Goldratt asserts that cost accounting motivates behavior that is contradictory to manufacturing optimization. Change just two nouns, and you arrive at our assertion that hit-rate accounting motivates behavior that is contradictory to Oracle optimization. The beauty of this awareness is that Goldratt’s analysis of his assertion informs the analysis of our assertion, all the way into the details.

Kent Beck

Extreme Programming Explained book

I loved Kent Beck’s Extreme Programming Explained every bit as much as I loved Goldratt’s The Goal. Beck’s book—harmonious with Goldratt’s—is about setting the right targets and using the right measurements to get there.

Make sure what you are doing has business value, meets business goals, and serves business needs. For example, solving the highest priority business need first maximizes the value of the project.

Kent Beck, Extreme Programming Explained, p25

Wrap-Up

We stand on the shoulders of giants.

If you’re interested in how all these thoughts hang together, you might enjoy my second O’Reilly project, called How to Make Things Faster.

Categories
Blog Posts

Make It Automatic

Over the holidays, my colleague Jeff Holt and I usually use the peaceful, interruption-free time to buff up our software. One of our design journeys last week was particularly interesting.

The application we were working on is an application that eats Oracle trace files for a living. You drag files into a pane in the app, or you can select them with our File › Load… menu option. It parses the files you load and displays information about them.

Since our application is complex and the files can be big (gigabytes), it saves information about the files you load in a little embedded SQLite database. That way, if you unload and reload a file (like when you switch your attention from one project to another and back), then the product will just show the cached data for the file without having to reprocess it. This trick makes you feel like our application is processing huge files instantaneously.

To do this, we need to store only about 500 bytes per file. It’s not much, but if you process thousands of files per year, then after a few years, the little database can end up consuming a few megabytes. In 2018, we decided not to worry about it yet. This year (2023), my little SQLite database had grown to 10 MB, and we decided it would be good now to add a feature to delete rows that aren’t helpful anymore.

Our first implementation was to add a new menu option called File › Clean Database… It’s a scary name. Sounds obviously Not Read-Only. It evokes questions: “What exactly, will clicking this option do? Could it result in a regrettable situation?” Somehow, we’d have to explain that to the user.

But how? We don’t make a User Manual for the application. That’s intentional. If a user has to read a manual to understand how to use our product, then our product doesn’t have a good enough user interface.

Jeff noted, “Cary, do you see the three dots on the menu option?” Yes I did. And I know what that means. It’s a convention that means there’s a dialog behind the click. So, I clicked it. The dialog, helpfully, said:

Your 10 MB Workbench database contains 27,356 unloaded files. Delete them? (You cannot roll this back.)

[ Cancel ] [ OK ]

Except it actually said this in an awkwardly wide dialog with no line wrapping. The no-wrapping problem bothered me, because I felt like the user deserved more information, like this:

  1. We use a SQLite database to cache the Workbench application’s files panel information.
  2. Each row consumes about 500 bytes.
  3. If you process a lot of files, you may want to clean up the database.
  4. This feature will delete rows for files that are not presently loaded.
  5. This feature will not delete a row if it has a tag applied to it.
  6. You cannot roll back this delete.
  7. But the risk of deleting too much data is low, because it can all be regenerated, simply by reloading the files.

I felt like a user deserved to know all these things before being comfortable clicking the button. But to change the dialog to one that could display seven steps like these would take more time than I wanted to invest.

Then I remembered: Whenever I find myself thinking about designing a popup dialog, I’m probably thinking about the wrong thing. Over the years, a rule about them has evolved:

The optimal number of popup dialogs for an application is zero. The justification process for creating a new popup dialog should be at least as difficult as the process for amending the Constitution of the United States.

—Cary Millsap

At the same time as I was revolted by the thought of a popup dialog, Jeff was revolted by the idea that a user would have to learn seven simple steps to be fully informed about using the feature properly. He said he’d rather delete the feature than have to explain seven steps about when to use it.

He was right.

Jeff’s revulsion was our turning point.

You see, someone who’s using our software has a job to be done. That job to be done is the whole reason that person is using our software in the first place. And that job to be done is never, “Hey, let’s take 15 minutes off to read this seven-step document about how and why this tool I’m using manages its own internal cache.”

The job to be done will …Not. Ever. Be that.

This idea illuminated our path to the solution: We would eliminate the menu option. No menu option, no user manual, no popup dialog. Instead of a new user affordance, we would execute the feature automatically. Like this:

  1. Every time the application starts up, delete any recomputable cache information that hasn’t been used for a long time.
  2. Print information about the delete operation in the application’s log file. (Making our own software highly observable is vitally important to us.)

The result is a product that does more without asking more from the user.

That is what we want.

Categories
Blog Posts

Method R Workbench 2023-12-01 Party Notes

If you had a chance to join my Workbench Party today, thank you for your time with us. If not, then I hope to see you next time.

Here are a few links that should help fortify what we covered:

  1. “Solving the Unsolvable Performance Problem” white paper (2 pages)
  2. Method R Software workflow (1:54)
  3. Method R software
  4. Introduction to Method R Trace (2:26)
  5. Video introduction to Method R Workbench (5:34)
  6. Demo: airport OS with five timeouts per hour (4:58)
  7. Method R Workbench video tips
  8. Installation instructions for Method R Trace extension for SQL Developer
  9. Installation instructions for Method R Workbench
  10. Documentation pages for all Method R software tools
  11. Method R on Slack
Categories
Blog Posts

How did you make mrskew 20× faster?

A couple of years ago (June 30, 2020), we released Method R Workbench version 9.0.0.66. It had 113 new features and bug fixes. One of those features was case 7800: “mrskew is now 10–20× faster than before.”

We’re prone to sneaking in performance improvements like that. It’s because we, too, use the software we sell, and we don’t like waiting around for answers any more than you do.

mrskew, in case you don’t know, creates flexible, variable-dimension profiles. It’s a skew analyzer for Oracle trace files.

…A what?

It’s a tool that can query across trace files (thousands of them, if that’s how many you have) and answer questions like these:

  1. What kinds of calls dominated the response time of your user’s experience? Imagine for the sake of this example that the answer is “read calls.” How much time did read calls take? How many read calls did your program make?
  2. Were all your read calls the same duration? Or did some take longer than the others? How much time could you save if you eliminated the slowest 10,000 read calls?
  3. How many blocks did the longest read calls read?
  4. What are the file and block IDs of the longest read calls?
  5. Are the slowest read calls associated with a particular file?
  6. Are they associated with a particular SQL statement?
  7. On what line of what trace file can you find information about your longest read call?

Our mrskew tool can answer questions like these and more.

Here are the commands to do it. Don’t let these scare you. You can summon any one of them (or any of 30+ others) with just a click, in our Method R Workbench:

  1. mrskew *.trc
  2. mrskew --name='read' --rc=p10.rc *.trc
  3. mrskew --name='read' --group='"$p3"' --gl='"BLKS/READ"' *.trc
  4. mrskew --name='read' --group='"$p1:$p2"' --gl='"FILE#:BLOCK#"' *.trc
  5. mrskew --name='read' --group='"$p1"' --gl='"FILE"' *.trc
  6. mrskew --name='read' --group='"$sqlid"' --gl='"SQLID"' *.trc
  7. mrskew --name='read' --group='"$base:$line"' --gl='"FILE:LINE"' *.trc

Now, imagine trying to ask 2GB of trace data all these questions. Without mrskew, it would probably take you a day or more to fish the answers out of your trace files (don’t bother looking in AWR or ASH; they’re not there).

A Workbench 8 mrskew execution on 2GB of input takes about 4 minutes. That’s about half an hour to run all seven commands. That’s pretty good compared to a day or two of fishing.

A Workbench 9 mrskew execution on the same input takes only about 12 seconds. That’s less than 2 minutes to answer all the questions I’ve posed here. That’s remarkable.

2019 MacBook Pro (Intel)mrskew *.trc (2GB)
Method R Workbench 8240 seconds (4 minutes)
Method R Workbench 912 seconds
mrskew execution times before and after the Method R Workbench 9 upgrade.

So, an interesting question, then, might be, “How did you do that?”

Well, that’s easy: a long time ago, I hired Jeff Holt.

How did Jeff do it?

“Simple.” He rewrote mrskew in C.

In Workbench 8, mrskew was a Perl program that I had written in 2009. Perl is admittedly slow, but I was interested in having a program that users could interact with using Perl’s full expression syntax.

mrskew worked really well, and we used it a lot. But it always felt weird that it was so much slower than our other utilities that do even more work (like mrprof). So Jeff, in his spare time, investigated whether he could rewrite mrskew in C. It was no small feat, given that I insisted upon keeping the full Perl expression interface.

One day he surprised me. The new C version of mrskew was passing all our automated tests and we could probably ship it now. I asked him how much faster it was. He said about 20×.

I’m used to this kind of thing with Jeff by now. But still.

The result of Jeff’s investigation is that now we have a skew analysis tool that works just as fast as our other outrageously fast tools, even when you’re battling data by the gigabyte. Today, mrskew is a standard feature of pretty much every performance improvement project we hook into, and we’re grateful that it doesn’t make us wait a long time for the answers we need.

To get a better understanding of what skew is and why it’s important, see chapter 38 of How to Make Things Faster. If you’re interested in more detail about mrskew, visit our mrskew manual page.

Categories
Blog Posts

Coherency Delay

Today, a reader of How to Make Things Faster asked a question about coherency delay (chapter 47): How does coherency delay manifest itself in trace files?

My own awareness of the concept of coherency delay came from studying Neil Gunther’s work, where he defines it mathematically as the strength β that’s required to make your scalability curve fit the Universal Scalability Law (USL) model.

Such a definition can be correct without being especially helpful. It doesn’t answer the question of what kind of Oracle behaviors cause the value of β to change.

I think that one answer may be “the gc stuff.” But I’m not sure. One way to find out would be to do the following:

  1. Find a workload that motivates a lot of gc events on a multi-node RAC system.
  2. Fit that configuration’s behavior to Gunther’s USL model.
  3. Run the same workload on a single node.
  4. Fit that configuration’s behavior to USL.
  5. If the value of β decreases significantly from the first workload to the second, then there’s been a reduction in coherency delay, and there is a strong possibility that the gc events were the cause of it.

That may not feel like a particularly practical proof (it would require a lot of assets to conduct), but it’s the best proposal I can think of here at the moment.

The biggest problem with executing this “proof” (whether it really is a proof or not is subject to debate) is that there’s probably not much payout at the end of it. Because what does it really matter if you know how to categorize a particular response time contributor? If a type of event (like “gc calls”) dominates your response time, then who cares what its name or its category is, your job is to reduce its call count and call durations.

(Lots of people have already discovered this peril of categorization when they realized that—oops!—an event that contributes to response time is important, even if the experts have all agreed to categorize it using a disparaging name, such as “idle event.”)

Whether the gc events are aptly categorizable as “coherency delays” or not, my teammates and I have certainly seen RAC configurations where the important user experience durations are dominated by gc events. In fact, our very first Profiler product customer back in roughly the year 2000 was having ~20% of their response times consumed by gc stuff on a two-node cluster back when RAC was called Oracle Parallel Server (OPS).

We solved their problem by helping them optimize their application (indexes, SQL rewrites, etc.), so that their workload ended up fitting comfortably on a single node. When they decommissioned the second node of their 2-node cluster, their gc event counts and response time contributions dropped to 0. And another department got a new computer the company didn’t have to pay for.

The way you’d fix that problem if you could not run single-instance is to make all your buffer cache accesses as local as possible. It’s usually not easy, but that’s the goal. And of course, RAC does a much better job of minimizing gc event durations than OPS did 23 years ago, so globally it’s not as big of a problem as it used to be.

Bottom line, it might be an interesting beer-time conversation to wonder whether gc events are coherency delays or not, but the categorization exercise is only a curiosity. It’s not something you have to do in order to fix real problems.

Categories
Blog Posts

Protected: Method R

This content is password-protected. To view it, please enter the password below.

Categories
Blog Posts

How slow programs are like Christmas

Method R makes systems faster. And we make people who make systems faster, faster. We train people to become performance optimization heroes.

Here is my story about why you should be interested in our training.


Slow programs remind me of Christmas when I was a kid. In early December, my parents would put a present for me under our Christmas tree. It would be wrapped up so I couldn’t see what was inside it. The unwrapping would not happen until Christmas morning, December 25. (That was the best-case scenario. If my Dad couldn’t be home because of work, then Christmas morning would come a day or two late.)

So, every day, for nearly a month, I would see that present under the tree and wonder what was in it. 

I’d take any clue I could find. What shape is it? What does it weigh? What does it sound like when I shake it? (Sometimes, my Mom and Dad would prohibit me from shaking it.) No matter how desperate the curiosity, all I could do was guess.

When Christmas came, I’d finally get to tear the paper off, and I would now see, plain as day, what had been in that box the whole time. All the clues and possibilities would collapse into a single reality. Finally, there was no more mystery, no more guessing.

Slow programs are like that. The clues aren’t enough. You guess a lot. But with slow programs, there’s no specially designated morning when your programs reveal their mysteries to you. They just keep irritating you, with no end in sight. You need somebody who knows how to tear the wrapping paper off those programs so you can see what they’re doing wrong. 

That’s the somebody I like being. The role scares a lot of people, but it doesn’t scare me. That’s because I trust my preparation. I know that I have three particular assets that tilt the game in my favor. 

Those assets are knowledge, tools, and community. With the knowledge and tools I have, I don’t get stumped very often. But when I do, I have a network of friends who’ll help me out. My friends and I can solve just about anything. These three assets are huge for both my effectiveness and my confidence.

These three assets aren’t just for me. They’re for you, too. 

That’s the aim of my online course called “Mastering Oracle Trace Data.” In this course, I’ve bundled everything you need to claim those three assets for your own:

  1. You’ll learn the details about Oracle traces and the stories they’re trying to tell you. This is your knowledge asset.
  2. You’ll have, for the duration of your choosing, full-feature access to Method R Workbench, the most comprehensive software in the world for mining, managing, and manipulating Oracle traces. This is your tools asset.
  3. You’ll have access to our Slack channel, a global community of Oracle trace enthusiasts that can help you whenever you get stumped. You won’t be alone. You’ll have people who are there for you. This is your community asset. 

You can also fortify all three of your new assets by purchasing office hours for the course. Office hours are Zoom sessions, where you can spend time with my friends and me, discussing your questions about the material.

If you’re interested in becoming a more effective and confident optimizer, you can get started now. Just visit our course page for details.


That’s my story. I hope you’ll contact us if you’re interested.

And if you like stories like this, you’ll find a lot more in my How To Make Things Faster book, available wherever books are sold.

Categories
Blog Posts

A Design Decision

This week, my team at Method R devoted some time to an enhancement request that required an interesting design decision. This post is about the analysis behind that decision.

The enhancement request was for our flagship product called Method R Workbench. It’s an application that people use to mine, manage, and manipulate Oracle trace files.

One of its features, called mrskew, is a tool that allows a Workbench user to filter, group, and sort the raw dbcall and syscall data that Oracle Database processes write to their trace files. You can use mrskew from within the Workbench application, or from a *nix command line.

Here’s an example of a mrskew command. It’s what you would use to find out how long your program spent reading Oracle blocks from secondary storage. It will show you which blocks it read, how long they took, and how many times each block was read:

mrskew --name='db.*read' 
   --group='sprintf("%8d %8d", $p1, $p2)' 
   x_ora_1492.trc

Here’s the output:

sprintf("%8d %8d", $p1, $p2) DURATION      % CALLS     MEAN ... 
---------------------------- -------- ------ ----- --------
                  2        2 0.072918   1.0%    26 0.002805 ...
                 33   698186 0.051940   0.7%     1 0.051940 ...
                 50   339841 0.049261   0.7%     1 0.049261 ...
...

The important thing in this report is the meaning of the $p1 and $p2 variables. The combination of these two variables happens to represent the data block address (the file number and block number) of an Oracle block that was read by some kind of an Oracle read call. It would be nice for the report to tell you that instead of just telling you that the first two columns of numbers are the output of an sprintf function call.

We have a command-line option for that. The ‑‑group-label option lets you assign your own title for the group column. So, with some careful character counting, you could use…

‑‑group-label='    FILE    BLOCK'

…to get exactly the heading you want:

    FILE    BLOCK DURATION      % CALLS     MEAN ... 
----------------- -------- ------ ----- -------- 
       2        2 0.072918   1.0%    26  0.002805 ...
      33   698186 0.051940   0.7%     1  0.051940 ...
      50   339841 0.049261   0.7%     1  0.049261 ... 
...

That makes sense. Now it’s easy to see that Oracle has read one block (file #2, block #2) 26 times, consuming a total of 0.072918 seconds reading it.

The group label fits the output, only because of the careful character counting. The enhancement request was to allow the ‑‑group-label option to take an expression, not just a string. Like this:

--group-label='sprintf("%8s %8s", "FILE", "BLOCK")'

That way, he could print out the header he wanted, perfectly aligned, by just syncing his ‑‑group‑label expression to his ‑‑group expression, without having to count space characters that are literally invisible.

It’s a smart idea. The group label option should have been designed that way from the beginning. We eagerly approved the enhancement request and began thinking about the design.

When we thought it through, we ended up with two different ideas about how we could implement this new idea:

  1. Redefine ‑‑group‑label to take an expression instead of a string. mrskew will calculate the value of the expression before printing the column label.
  2. Create a new option, say, ‑‑new‑group‑label, that takes an expression as its argument. And leave ‑‑group‑label as it is.

The first idea is how the enhancement request was worded. The second idea entered our minds because the first idea creates a compatibility problem: if we change the spec of the existing ‑‑group‑label option, it will break some existing mrskew scripts. For example, these will work in Workbench 9.2.5:

--group-label=FILE
--group-label="FILE BLOCK"

But if we redefine ‑‑group‑label to take an expression instead of a string, then these won’t work anymore. People will need to quote their string expressions like this:

--group-label='"FILE"' 
--group-label='"FILE BLOCK"'

In the end, we decided to redefine the existing option and live with the compatibility breach.

The way we make decisions like this is that we create strenuous arguments for each idea. Here are some of the arguments we considered en route to our decision.

First, the customer experience (cognitive expenditure).

Everyone who participated in the debate had the customer experience foremost in mind. But how can we objectively measure “customer experience”? How do you structure a scientific debate about the superiority of one experience over another?

One way to do it is to measure cognitive expenditure—the amount of mental effort that a user has to invest to get the desired outcome from our software. We want to minimize cognitive expenditure, to maximize a customer’s return on investment of effort.

We began by realizing that responding to this enhancement request with one of our two ideas would necessarily force the user into one of two new regimes:

  1. The syntax of ‑‑group-label has changed.
  2. There’s a new ‑‑new-group-label option.

In regime 1, our users would have to learn the new syntax. That’s a cognitive expenditure. But it’s a one-time expenditure, which is good. The new syntax would be consistent with the existing ‑‑group syntax, which is actually a cognitive savings for our users over what we have now. However, if a customer had saved any scripts that used the old syntax, then the customer would have to convert those scripts. That’s a cognitive expenditure in a loop (one for each script), which is bad.

In regime 2, our users would have to learn about ‑‑new-group‑label, which is a cognitive expenditure. They’d still have to remember (or relearn) about ‑‑group‑label, too, which is a similar cognitive expenditure as the one in regime 1. They wouldn’t have to modify any old scripts, but they would have to make the choice of whether to use ‑‑group‑label or ‑‑new-group‑label, every time they wrote a script in the future. That’s another cognitive expenditure in a loop (one for each script), which is bad.

Second, the developer experience (technical debt).

We also need to consider the developer’s experience. We don’t want to create code that increases technical debt that makes the product unnecessarily difficult to support.

If we redefine ‑‑group-label, there’s no long-term effect to worry about. But if we add ‑‑new‑group‑label to the story, I would expect for people to wonder, why are there two such similar group label options, when one (the one that takes an expression) is clearly superior? And why does the inferior one have the better name?

At some point in the future, I envision wanting to clean up the cruft and have just the one group label feature. Naturally, the right name for it would be ‑‑group‑label. But of course, changing the spec that way would introduce a compatibility problem. To make things worse, this would occur in the future when—one would hope, if our business is growing—such a decision would impact even more customers than it would today. So then, why create the cruft in the first place? It’ll be a worse problem later than it is now.

The question that really seals the deal, is who will the change really affect? It’s really a probability question about customer experiences.

Most users who use the Workbench application will never experience our group label option directly. It’s there for everybody to use, but our Workbench has so many predefined reports built into it, most users never need to touch the group label option for themselves. When they do need to modify it, they’re usually tweaking a report that we’ve predefined for them, which is a low–cognitive-expenditure experience.

In the end, Method R bears almost the entire cost of the ‑‑group‑label redefinition. It required us to revise:

Most users will experience the benefit of the ‑‑group‑label change, without ever knowing that, once upon a time, it changed. And that’s the way we want it. We want the product to be as smart as possible so that our customers get the most out of their investment, both cognitive and financial.

Categories
Books

Tracing Oracle

Become the first to know definitively how your system is spending your users’ time

Cary Millsap and Jeff Holt’s new book, Tracing Oracle, will elevate your tracing game. This book is 100% focused on helping you get the most detailed and reliable performance data that Oracle offers. It has a companion GitHub project designed to make tracing safe and convenient.

The book covers Oracle Databases both on-premises and in the cloud, including Oracle XE, SE, EE, Exadata, OCI and AWS as-a-service offerings, Oracle Autonomous Database deployments, and even 23c Free.

Tracing Oracle will teach you why, when, and how to trace Oracle application programs with surgical precision, so that you can be the first to know what’s really going on.

Tracing Oracle is a companion of the authors’ 291-page Mastering Oracle Trace Data book. The red book is about obtaining ing the perfect trace file. The blue book is about what to do with that file once you’ve retrieved it.

Your authors

Cary Millsap and Jeff Holt have been helping people optimize complex systems since the 1980s. They’ve helped improve performance for many of the world’s favorite brands.

In the early 2000s, Cary and Jeff invented the optimization method called “Method R.” In 2003 they published their revolutionary O’Reilly book, Optimizing Oracle Performance.

In the years since, they have taught thousands of people how to be better system optimizers. The software they’ve created helps people extract meaning from huge volumes of detailed Oracle traces.

Table of contents

  1. Getting Started
    1. Hello, World
    2. What Is a Trace?
    3. Why Trace?
  2. Preliminaries
    1. Privileges
    2. Parameters
    3. MAX_DUMP_FILE_SIZE
    4. Trace File Hygiene
    5. Be Kind, Please Rewind
  3. Tracing
    1. How to Trace a SQL Script
    2. How to Trace Someone Else’s Session
    3. How to Clean Up Your Enabled Traces
  4. Access
    1. Trace Directory Names
    2. Trace File Names
    3. Accessing Your Trace without Filesystem Access
    4. Identifying Your Trace Files
  5. Scoping
    1. What Is Scoping?
    2. How Should You Trace?
    3. How Application Developers Can Make Tracing Easier
    4. trcsess
    5. APPINFO
    6. Tracing with Triggers
    7. Tracing a Whole Database
  6. Levels
    1. Trace Levels
    2. Which Level Should You Use?
    3. Why We Recommend Not Tracing BINDS
    4. Why We Recommend Not Tracing ALL_EXECUTIONS
  7. Specific Technologies
    1. Oracle APEX
    2. Oracle E-Business Suite
    3. Oracle Connection Pooling
    4. Oracle Parallel Execution
    5. Oracle Scheduler
    6. Oracle Cloud Infrastructure
    7. Amazon RDS for Oracle
    8. Oracle Database 23c
  8. Objections
    1. Will Tracing Slow Everything Down?
    2. What If Tracing Does Slow Something Down?
    3. Trace rates and Sizes
    4. Data Security
    5. Safeguards
  9. Proscriptions
    1. Don’t Use TRACEFILE_IDENTIFIER
    2. Don’t Trace with ALTER Statements
    3. Don’t Trace with the DBMS_SESSION Package
    4. Don’t Trace with the SQL_TRACE Parameter
    5. Don’t Trace with the DBMS_SYSTEM Package
    6. Don’t Trace with the DBMS_SUPPORT Package
  10. Autonomous Database
    1. ADB Deployments
    2. Why Would You Ever Trace an ADB System?
    3. Hello, World (ADB-D Remix)
    4. Hello, World (ADB-S Remix)
    5. Accessing ADB-S Traces
    6. Does ADB Offer the Trace Features You Need?
  11. Method R Commercial Software
    1. Method R Workbench
    2. Method R Trace Extension for Oracle SQL Developer