Sep 12: That Pictures demo in full
With so many potential technical posts in my pile, it was initially difficult to decide where to start again but I figured I should avoid the stats series until I'm back into the swing of things Instead I decided to fulfill a commitment I made to myself (and others, whether they knew about it or not) almost three months ago.
When I gave the evening demo session in the Amis offices I think the 2 hours went pretty well but, as usual with the OEM presentations, I got a little carried away and didn't conclude the demo properly. (This is also the demo I *would* have done at Hotsos last year if the damn thing had worked first time ) It was a shame because as well as showing the neat and useful side of OEM Performance Pages, it also illustrates one of the common pitfalls in interpreting what the graphs are showing you.
I began by running a 4 concurrent user Sales Order Entry (SOE) test using Dominic Giles' Swingbench utility. I won't got into the details of the SOE test because I don't think it's particularly relevant here but you can always download and/or read about Swingbench for yourself at Dominics website.
I ran the test for a fixed period of 5 minutes using no think-time delay.
Using the capability to look at ASH data in the recent past, the OEM Top Activity page looks like this.
- There was a fairly consistent average of 4-5 active sessions over the 5 minutes period and, looking at the Top Sessions panel in the bottom right of the screen, these were four SOE sessions of similar activity levels and the LGWR process.
- The majority of time was spent on User I/O, System I/O and Commit Wait Class activity, with a little CPU.
- Three PL/SQL blocks were responsible for most of the Commit activity.
- The LGWR process was responsible for most of the System I/O activity.
I'll leave it there for now and won't drill down into any more detail.
In terms of optimising the performance of this test, what might I consider doing?
The most important aspect is to optimise the application to reduce the resource consumption to the minimum required to achieve our objectives. There's a whole bunch of User I/O activity that could perhaps be eliminated? But I'm going to ask you to accept the big assumption here that this application has been optimised and that I'm just using a Swingbench test as an illustration of the type of system-wide problem you could see. In that case, my eye is drawn to the Commit activity.
When I'm teaching this stuff, I'm usually deliberately simplistic (at least at the end of the process) and highlight that what I'm interested in 'tuning' is whatever most sessions are waiting on according to the ASH samples this screen uses. I used to explain how I'd look for the biggest areas of colour, drill down into those and identify what's going on. Sadly, I later heard that someone (I think it was JB at Oracle*) had already come up with a nifty acronym for this - COBS. Click on the Big Stuff! One day I will come up with a nifty acronym for something too, but you shouldn't hold your breath waiting.
So, if I click on the big stuff here, I can see that the Commit Class waits are log file sync.
How might I reduce the time that sessions are waiting for log file sync? Here are a few reasons why the test sessions might be waiting on log file sync more often or for longer than I'd like.
- Application design - committing too frequently
- CPU starvation
- Slow I/O to online redo log files
Whether waits are predominantly the result of CPU overload or slow I/O can be determined by looking at the underlying log file parallel write wait times on the LGWR process but that's a bigger subject for another time.
You can look into all of these in more depth - and should - but as this is designed to be a fun demo of the pretty pictures (it used to be 'the USB stick demo'), I'll simply try to eliminate that activity and re-run the same test. Here's how Top Activity looks now.
Oh. Maybe that wasn't what you expected? OK, the LGWR activity has disappeared, but it seems the system is almost as busy as it was before but that the main bottleneck is now User I/O activity. That's often the way, though - you eliminate one bottleneck in a system and it just shows up somewhere else. It must be good to get rid of log file sync waits though, right? User I/O seems like more productive work and I've managed to make the LGWR activity disappear completely.
But then if you were to look at this graph in terms of Average Active Sessions or DB Time or (as it's more likely to be expressed) how big that spike looks, the two tests would look similarly busy from a system-wide perspective. They were but the real question is - busy doing *what*? There's some important information missing here and Swingbench is able to provide it.
Mmmm, so I wonder what that value was for the first run?
Woo-hoo! *That's* what I call tuning a benchmark - processing almost twice the number of transactions in the same 5 minute period.
So it turns out that the sessions in the database *were* just as busy during the second run (not too surprising seeing as the test has no user think time so keeps hammering the database with as many requests as it can handle) but that they were busy doing the more productive work of reading and processing data rather than just waiting for COMMITs to complete.
I raised this issue of DB Time not showing activity details with Graham Wood* at Oracle in relation to a previous blog post. I think he made the point to me that that's why the OEM Performance Home Page is *not* the Top Activity page. If I take a look at that home page, it shows me the same information as the Swingbench results output did, albeit not as clearly
Looking at the Throughput graph, I can see that the second test processesd around double the number of Transactions per second for the same test running on the same system.
To wrap up (and be a little defensive) ...
- Yes, I could have traced one or more sessions and generated a complete and detailed response time profile that should have lead me to the same conclusion.
- Yes, as this is a controlled test environment and I'm the only 'user', AWR/Statspack would have been an even more powerful analysis tool in the right hands.
- The Top Activity page is not the most appropriate tool for this job but it is handy for illustrating concepts.
- Lest I seem a slavish pictures fan, I'm showing how people might misuse or misundersand ASH/Top Activity. In this case, the Home Performance Page is a much better tool because we're looking at system-wide data and not drilling into session or SQL details.
Oh, and what is my Top Secret Magic Silver Bullet Tuning Tip for OLTP-type applications? (only to be used by Advanced Oracle Performance Wizards)
alter system set commit_write='BATCH, NOWAIT';
Done! In fact, why not just use this on all of your systems, just in case people are waiting on log file sync?
(Leaves space below for angry responses and my withering humorous retorts)
* This is not name-dropping, this is giving due credit to the people who really know what they're talking about
Network Events in ASH
Alternative Pictures Demo
Time Matters: Throughput vs. Response Time - Part 2
Diagnosing Locking Problems using ASH/LogMiner – The End
Diagnosing Locking Problems using ASH/LogMiner – Part 9
Diagnosing Locking Problems using ASH/LogMiner – Part 8
Diagnosing Locking Problems using ASH/LogMiner – Part 7
Diagnosing Locking Problems using ASH – Part 6
Diagnosing Locking Problems using ASH – Part 5
Diagnosing Locking Problems using ASH – Part 4
Note - features in this post require the Diagnostics Pack licenseNot long after I'd finished the last post, I realised I could reinforce the points I was making with a quick post showing another one of the example tests supplied with Swingbench - the Call
Tracked: Sep 19, 21:14
Tracked: Sep 22, 05:39
I *love* this demo!
To bad you're not at OOW this year. I'll miss you
Tell me about it! I'm going to miss a lot of people too.
Although I had to make the decision not to go, the next few days will be difficult because I know the fun I'll be missing out on.
But there'll be other opportunities ...
Thanks for the neat little demo. I guess your solution to the log file sync issue depends upon whether you can tolerate the potential loss of 1Mbyte or 3 seconds worth of data.
Yes, it's just a demo and an easy way of getting more throughput but one that people should give extremely careful consideration to before using. It breaks everything we know about Oracle so we'd need to rethink our assumptions.
I investigated this commit batch write in an heavy loaded environment and found it is in fact reporting 7 commit for each one really performed. I suppose this ratio is hardware/performance related and is not fixed. Test : On an Idle system perform 100 time the same insert/commit test without setting commit batch write and count the IO of redolog filesystem, takes histogram to check distribution of counts. Next : set commit batch, re-start test and re-count the IO. I found this ratio of 7 evenly distributed in time. Was running Linux 64 OEL on blade core 2 Xeon 5000 using a SAN Hitachi.