{"id":1470,"date":"2009-02-08T12:00:00","date_gmt":"2009-02-08T12:00:00","guid":{"rendered":"http:\/\/orcldoug.com\/blog\/?p=1470"},"modified":"2009-02-08T12:00:00","modified_gmt":"2009-02-08T12:00:00","slug":"time-matters-throughput-vs-response-time","status":"publish","type":"post","link":"http:\/\/orcldoug.com\/blog\/2009\/02\/08\/time-matters-throughput-vs-response-time\/","title":{"rendered":"Time Matters: Throughput vs. Response Time"},"content":{"rendered":"<p><a href=\"http:\/\/www.orawin.info\/services\/\">Niall Litchfield<\/a> made an interesting comment in an email thread that prompted this post. <\/p>\n<blockquote><p><em>&#8220;&#8230; I can see that once you start to define workload, or transactions, in business terms (I need to get all these things done, what works best overall?) then workload response time<sup>*<\/sup> does make sense, both as a metric, and more pertinently as a tuning target. I think, and have done for a while, that for much of the last 10 years the tuning dialog has been around query or session optimization with either an explicit or implicit assumption that optimization of particular queries will result in workload optimisation from a business perspective. In many cases this is true, I suspect though that for many cases it isn&#8217;t. Response time will still be the core metric, but perhaps some of the tuning methods will vary. It may be as simple as redefining stage 1 of the tuning process from <\/p>\n<p>&#8216;<\/em><em>define the task of interest to the business&#8217;<br \/>to<br \/>&#8216;<\/em><em>define the workload of interest to the business'&#8221;<\/em><\/p><\/blockquote>\n<p>I agree with Niall, particularly with regard to the current emphasis on optimising individual sessions or queries, rather than the overall workload.<\/p>\n<p>I&#8217;ll state this another way. Maybe &#8230;<\/p>\n<p>1) the fastest <em>individual session response time<\/em> <\/p>\n<p>&#8230; isn&#8217;t always the most important optimisation goal if you&#8217;re trying to achieve &#8230;<\/p>\n<p>2) the highest <em>workload throughput<\/em>? <\/p>\n<p>(That&#8217;s why I have a few slides early on in the course I wrote for<br \/>\nOracle that define a few ways of looking at system performance,<br \/>\nincluding response time, throughput and scalability.) <\/p>\n<p>I&#8217;ll try to illustrate these two different tuning goals using Dominic Giles&#8217; <a href=\"http:\/\/www.dominicgiles.com\/swingbench.html\">Swingbench<\/a> utility. I executed the Sales Order Entry (SOE) benchmark with different numbers of concurrent users for a period of 3 minutes. The Oracle instance, hardware configuration (dual-core laptop with the usual lousy hard drive) and application code were identical for all of the tests. The only significant variable was the number of concurrent sessions. Here are the results (which Swingbench helpfully displays in the Output tab after each test run).<\/p>\n<table border=\"1\" cellpadding=\"1\" cellspacing=\"1\" style=\"width: 282px; height: 320px\">\n<tbody>\n<tr>\n<td align=\"left\" style=\"width: 20%\"><strong>Concurrent Sessions<\/strong><\/td>\n<td align=\"left\" style=\"width: 40%\"><strong>Avg. Response Time (ms)<\/strong><\/td>\n<td style=\"width: 40%\"><strong>Transactions Completed<\/strong><\/td>\n<\/tr>\n<tr>\n<td align=\"left\" style=\"width: 20%\">1<\/td>\n<td align=\"right\" style=\"width: 40%\">79<\/td>\n<td align=\"right\" style=\"width: 33%\">4,203<\/td>\n<\/tr>\n<tr>\n<td align=\"left\" style=\"width: 33%\">2<\/td>\n<td align=\"right\" style=\"width: 33%\">108<\/td>\n<td align=\"right\" style=\"width: 33%\">6,772<\/td>\n<\/tr>\n<tr>\n<td align=\"left\" style=\"width: 33%\">4<\/td>\n<td align=\"right\" style=\"width: 33%\">133<\/td>\n<td align=\"right\" style=\"width: 33%\">10,481<\/td>\n<\/tr>\n<tr>\n<td align=\"left\" style=\"width: 33%\">8<\/td>\n<td align=\"right\" style=\"width: 33%\">198<\/td>\n<td align=\"right\" style=\"width: 33%\">13,346<\/td>\n<\/tr>\n<tr>\n<td align=\"left\" style=\"width: 33%\">12<\/td>\n<td align=\"right\" style=\"width: 33%\">244<\/td>\n<td align=\"right\" style=\"width: 33%\">13,639<\/td>\n<\/tr>\n<tr>\n<td align=\"left\" style=\"width: 33%\">16<\/td>\n<td align=\"right\" style=\"width: 33%\">310<\/td>\n<td align=\"right\" style=\"width: 33%\">14,798<\/td>\n<\/tr>\n<tr>\n<td align=\"left\" style=\"width: 33%\">20<\/td>\n<td align=\"right\" style=\"width: 33%\">337<\/td>\n<td align=\"right\" style=\"width: 33%\">14,749<\/td>\n<\/tr>\n<tr>\n<td align=\"left\" style=\"width: 33%\">24<\/td>\n<td align=\"right\" style=\"width: 33%\">369<\/td>\n<td align=\"right\" style=\"width: 33%\">14,176<\/td>\n<\/tr>\n<tr>\n<td align=\"left\" style=\"width: 33%\">28<\/td>\n<td align=\"right\" style=\"width: 33%\">428<\/td>\n<td align=\"right\" style=\"width: 33%\">15,181<\/td>\n<\/tr>\n<tr>\n<td align=\"left\" style=\"width: 33%\">32<\/td>\n<td align=\"right\" style=\"width: 33%\">563<\/td>\n<td align=\"right\" style=\"width: 33%\">13,278<\/td>\n<\/tr>\n<tr>\n<td align=\"left\" style=\"width: 33%\">36<\/td>\n<td align=\"right\" style=\"width: 33%\">533<\/td>\n<td align=\"right\" style=\"width: 33%\">14,151<\/td>\n<\/tr>\n<tr>\n<td align=\"left\" style=\"width: 33%\">40<\/td>\n<td align=\"right\" style=\"width: 33%\">587<\/td>\n<td align=\"right\" style=\"width: 33%\">13,302<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Without question, the average response time is best when only one user is running the test, and gets worse steadily as the number of active sessions grows. However, having only one active session also delivers the worst number of completed transactions during the test. If we want to process as many transactions as possible in those 3 minutes, then it looks like we should have around 28 concurrent execution streams.<\/p>\n<p>Do we care that the average transaction completion time has increased to 587 milliseconds? Well, if the transaction is part of a user interaction, then the answer is undoubtedly yes. I&#8217;m sure your users like the fastest possible response and if we have 28 active sessions, then an individual user is going to experience performance 5 times slower than if they were the only user. Oh, and that&#8217;s just the average response time &#8211; the maximum will be much worse!<\/p>\n<p>If, however, this is all part of an overnight batch process and the tuning goal is to get through all of the workload as quickly as possible, then the number of transactions completed is our focus and who cares if each transaction takes a little longer? In this case, it&#8217;s better to load the system more heavily and <em>increase<\/em> the response time of individual transactions. Scheduling the workload such that the transaction response time increases might seem counter-intuitive. For example, if I were to trace one of the sessions at random during each of the test runs and I analysed the trace files, wouldn&#8217;t &#8216;performance&#8217; look much &#8216;better&#8217; in the first test than the last, because I&#8217;m only focussing on one session?<\/p>\n<p><em>Is<\/em> performance better in the first test than the last? It all depends on what you mean by performance.<\/p>\n<p>Now, let me address what I might appear to be implying here, that tracing and tuning individual sessions is flawed. In fact, all of these tests would have yielded even more impressive results if I had tuned the SOE application at the session level *first* so that each transaction uses less resources and completes more quickly. That&#8217;s a good thing. I do understand that analysis and tuning at the session scope is vital but, if each individual session&#8217;s work has been optimised already, there are other aspects we need to consider and looking at a single session trace will not give me all of the information I need. (Gosh, I&#8217;d better be careful because I&#8217;m getting close to suggesting that Statspack and AWR might be useful tools for some situations after all!)<\/p>\n<p>However, when looking at this useful improvement in throughput on my laptop by increasing the load during a basic test, be very careful.<\/p>\n<p>&#8211; Whilst this particular &#8216;batch process&#8217; processed more work in the same period of time with more concurrent sessions, it also slowed response time for *everything else* on my laptop (server). That&#8217;s why it&#8217;s not sensible to mix batch and interactive workloads.<\/p>\n<p>&#8211; As the number of sessions increases past a certain point, the number of completed transactions goes *down* as the system starts to suffer contention so we get further away from our goal whilst using more resources. Achieving the correct balance is the key.<\/p>\n<p>&#8211; Looking at the results again, is the best balance to run 28 concurrent sessions when we can deliver almost the same throughput from 16? Well, I&#8217;d plump for 16 for this job on this configuration every time, if it meets the system requirements. Squeezing every last ounce of performance from a system is likely to lead to a serious performance problem one day because we&#8217;re reducing the breathing room to cope with unplanned events.<\/p>\n<p>All I&#8217;m really saying in this post is that performance analysis, response time tuning, workload management (call it what you will) can&#8217;t and shouldn&#8217;t be limited to looking at the performance of an individual session in isolation.<\/p>\n<p>* Is it just me, or does &#8216;Workload Response Time&#8217; sound weird? It&#8217;s the same idea as session response time &#8211; how quickly do we get from the beginning to the end &#8211; but it seems different to me. That might be my lack of understanding, reading, or rigour, but I find the idea of a system, workload or multiple users having an aggregated response time a strange idea to get my head around. I understand start &#8211; do lots of work &#8211; stop. But is the time that that takes a response time or throughput? Have I just got too used to Response Time being directly related to a user sitting, waiting for a response?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Niall Litchfield made an interesting comment in an email thread that prompted this post. &#8220;&#8230; I can see that once you start to define workload, or transactions, in business terms (I need to get all these things done, what works best overall?) then workload response time* does make sense, both as a metric, and more&hellip; <a class=\"more-link\" href=\"http:\/\/orcldoug.com\/blog\/2009\/02\/08\/time-matters-throughput-vs-response-time\/\">Continue reading <span class=\"screen-reader-text\">Time Matters: Throughput vs. Response Time<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1470","post","type-post","status-publish","format-standard","hentry","category-uncategorized","entry"],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":1429,"url":"http:\/\/orcldoug.com\/blog\/2008\/08\/20\/time-matters-db-time\/","url_meta":{"origin":1470,"position":0},"title":"Time Matters &#8211; DB Time","date":"August 20, 2008","format":false,"excerpt":"[In retrospect, the title of that first blog post might have suited the subject, but doesn't translate too well for subsequent related blog posts. That was a lack of planning or foresight on my part. These blog posts are tumbling out of my head in a fairly incoherent way. Maybe\u2026","rel":"","context":"With 13 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1496,"url":"http:\/\/orcldoug.com\/blog\/2009\/05\/07\/adaptive-thresholds-in-10g-part-1-metric-baselines\/","url_meta":{"origin":1470,"position":1},"title":"Adaptive Thresholds in 10g &#8211; Part 1 (Metric Baselines)","date":"May 7, 2009","format":false,"excerpt":"Some features in this post require a Diagnostics Pack license.[I really didn't want to get into another multi-part blog post, but this has grown longer than I hoped, so I'll split it up ...]One of the more interesting components of the 10gR2 instrumentation improvements is the use of Metric Baselines\u2026","rel":"","context":"With 7 comments","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/18.133.199.212\/wp-content\/uploads\/recovered\/oem1.JPG?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1497,"url":"http:\/\/orcldoug.com\/blog\/2009\/05\/07\/adaptive-thresholds-in-10g-part-2-time-grouping\/","url_meta":{"origin":1470,"position":2},"title":"Adaptive Thresholds in 10g &#8211; Part 2 (Time Grouping)","date":"May 7, 2009","format":false,"excerpt":"Some features in this post require a Diagnostics Pack license.Metric Baselines were designed to be easy to implement. There are only two options :-1) Pick how much recent\u00a0activity you want to use and let Oracle recompute the statistics based on the most recent metric values over time. (Moving Window) 2)\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"\/serendipity\/uploads\/640x377xoem3.jpg.pagespeed.ic.P-CkJpYqsK.jpg","width":350,"height":200},"classes":[]},{"id":1582,"url":"http:\/\/orcldoug.com\/blog\/2010\/03\/10\/hotsos-2010-day-3-an-excellent-one-part-1\/","url_meta":{"origin":1470,"position":3},"title":"Hotsos 2010 &#8211; Day 3 &#8211; An excellent one (part 1)","date":"March 10, 2010","format":false,"excerpt":"Well, that was a nice start to the day! Someone came up to me just before Wolfgang Breitling's presentation to point out that something from my presentation had helped him fix a problem at work last night. It was the OEM Raw Data drill-down that shows you the underlying ASH\u2026","rel":"","context":"With 2 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1050,"url":"http:\/\/orcldoug.com\/blog\/2006\/08\/10\/historical-perspective-part-2\/","url_meta":{"origin":1470,"position":4},"title":"Historical Perspective (Part 2)","date":"August 10, 2006","format":false,"excerpt":"Let's look at items 2 and 3 from the list in my previous blog1) You know you have a performance problem and can re-create it by running a specific part of the application, be it a user interaction or batch job.2) You have an intermittent but recurring performance problem which\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1498,"url":"http:\/\/orcldoug.com\/blog\/2009\/05\/10\/adaptive-thresholds-in-10g-part-3-setting-thresholds\/","url_meta":{"origin":1470,"position":5},"title":"Adaptive Thresholds in 10g &#8211; Part 3 (Setting Thresholds)","date":"May 10, 2009","format":false,"excerpt":"Some features in this post require a Diagnostics Pack license.One of my favourite aspects of blogging is that if I were to write a proper article or conference paper, I'd be likely to fix any problems with it as I go (well, the ones I notice!). With blogging, it's more\u2026","rel":"","context":"With 7 comments","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/18.133.199.212\/wp-content\/uploads\/recovered\/oem7.jpg?resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/posts\/1470","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/comments?post=1470"}],"version-history":[{"count":0,"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/posts\/1470\/revisions"}],"wp:attachment":[{"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/media?parent=1470"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/categories?post=1470"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/tags?post=1470"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}