{"id":422,"date":"2008-02-06T23:13:08","date_gmt":"2008-02-06T23:13:08","guid":{"rendered":"\/blogs\/conor\/post\/Database-Virtualization-The-Dirty-Little-Secret-Nobody-is-Talking-About.aspx"},"modified":"2008-02-06T23:13:08","modified_gmt":"2008-02-06T23:13:08","slug":"database-virtualization-the-dirty-little-secret-nobody-is-talking-about","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/conor\/database-virtualization-the-dirty-little-secret-nobody-is-talking-about\/","title":{"rendered":"Database Virtualization &#8211; The Dirty Little Secret Nobody is Talking About&#8230;"},"content":{"rendered":"<p>Had I known the number of responses I would have gotten about running SQL Server in virtual environments, I would have spent more time writing a questionnaire!&nbsp; <\/p>\n<p>I guess I&#8217;m also pleasantly surprised that so many of you read this blog &#8211; you must all be smarter and better looking than the average blog reader, for sure ;).<\/p>\n<p>ok, I learned a few things of interest and I will sum them up here.&nbsp; Then I&#8217;ll write something more technical where you might learn a few things from me to help you in your day-to-day.<\/p>\n<p>1. A number of you run SQL in virtualized environments.&nbsp; VMWare more than VirtualPC (to be expected, given the relative state of the two products).&nbsp; Perhaps the mix will change after Windows 2008 becomes available.<\/p>\n<p>2. More than a few of you run production SQL Server systems on virtualized hardware.&nbsp; I&#8217;m still asking a few clarifying questions, but it appears that this is not limited to tiny systems or lower-volume systems.<\/p>\n<p>3. Within these production systems cases, the most common benefits related to manageability.&nbsp; Specifically, moving the VM to a new machine when an old one died or needed to be reconfigured.&nbsp; This makes sense.<\/p>\n<p>4. A number of people run single-user systems to do development, try out some new configuration, etc.&nbsp; Often you don&#8217;t care about the system performance in this case.<\/p>\n<p>5. For the group in between the single-user system and the deployed systems, there is frustration about VM configuration.&nbsp; Typically the overhead is high unless you invest in a beefy storage solution (for example, a RAID-1 or RAID-5 array directly attached ).&nbsp; Configuring storage and memory properly for the VM is critical for good performance.<\/p>\n<p>I may return to this question in the future with a more systematic survey.&nbsp; I didn&#8217;t even ask you if you were running ESX vs. the non-ESX versions of VMWare or whether your CPUs have the VT capability in them!&nbsp; Thanks for all who shared data with me &#8211; I learned a few things and have more to ponder.<\/p>\n<p>I&#8217;ve been playing with VMWare more than average recently, and I&#8217;ve had some fun and some pain.&nbsp; My experiences are not dissimilar &#8211; it can be good for manageability, but it can also be slower.&nbsp; <\/p>\n<p>OK now for the bit where I tell you a few things you might not know ;).<\/p>\n<p>You probably know that MS isn&#8217;t particularly interested in you doing this, and there&#8217;s been press on the licensing (which SKUs you are do virtualization on, etc) around this for a bit.&nbsp; MS is working hard on its own enterprise-class virtualization story, and I&#8217;m sure it will be at least reasonable.&nbsp; <\/p>\n<p>Within the server itself, there is suprisingly little knowledge of a lot of things in this area that are important to performance.&nbsp; SQL Server&#8217;s core engine assumes things like:<\/p>\n<p>1. all CPUs are equally powerful<br \/>2. all CPUs process instructions at about the same rate.<br \/>3. a flush to disk should probably happen in a bounded amount of time.<\/p>\n<p>These are simplifying assumptions that are often completely untrue, but SQL Server doesn&#8217;t want to get into the business of forcing you to configure a bunch of numbers in order to use the product (or pay a high-priced consultant, for that matter &#8211; at least not to get started ;).&nbsp; <\/p>\n<p>Virtualization, from the system implemenation perspective, has a similar impact to processor hyperthreading.&nbsp; Hyperthreading, for those who haven&#8217;t been reading Intel&#8217;s website much lately, allows a superscalar (multi-pipeline) CPU to schedule mutiple threads of work at the same time as long as they don&#8217;t require the same pipelines.&nbsp; This sounds awesome, right?&nbsp; You can increase your instructions per cycle on the same hardware with only minimal extra transitors of scheduling overhead.&nbsp; Well, this works great as long as you build an OS from the ground up that exposes threads as its primary primitive instead of processes.&nbsp; Then you can just have a pile of threads that execute all over the place, usually without much care about how fast they are running, and you end up with everything running faster.&nbsp; When Windows consumed this, it wasn&#8217;t so simple.&nbsp; The scheduler schedules threads to CPUs, and you can&#8217;t have a <i>part <\/i>of a CPU.&nbsp; So, we have logical and physical CPUs.&nbsp; To most applications, they see 1 CPU per allowed thread.&nbsp; this makes everything work but it hides the fact that these things are not in any way the same unit of processing power.&nbsp; So some threads get assigned to fast CPUs and some get assigned to slow CPUs.&nbsp; Sometimes, you get assigned back and forth.&nbsp; ack!<\/p>\n<p>Now let&#8217;s throw SQL Server on top of this.&nbsp; It&#8217;s running lots of threads in one process.&nbsp; They get scheduled essentially randomly across this matrix of real and fake CPUs.&nbsp; Some user applications are one thread per user, and they work fine (OLTP applications).&nbsp; In fact, some of them work a bit faster (10-20%) because there are &#8220;more&#8221; CPUs.&nbsp; This is great, since you pay by the socket for Microsoft software (unlike some of those other guys ;).&nbsp; <\/p>\n<p>Data warehouse applications, however, are a much, much different beast.&nbsp; A good deal of the benefit of buying the top-end SKU is to get parallel queries.&nbsp; This speeds up queries by running one query on multiple threads.&nbsp; It trades CPUs for runtime performance improvements.&nbsp; The QP has lots of smarts to try to split up things into equal chunks of work and to then run each of those chunks on a different thread on a different CPU.&nbsp; Usually the pattern for something like an index build or a hash join would be:<\/p>\n<p>1. get everything onto different threads<br \/>2. do some work<br \/>3. wait for all those threads to complete<br \/>4. do something else in the query<\/p>\n<p>So now I have some threads that finish earlier than others.&nbsp; So they block until the slowest threads finish.&nbsp; Even worse, I don&#8217;t think that the query re-allocates those threads for other queries until the whole query finishes.&nbsp; So, now you have some background as to why hyperthreading was not recommended for at least some SQL Server deployments.<\/p>\n<p>Virtualization has some of the same issues.&nbsp; Things don&#8217;t proceed at the same rate on each CPU, assuming you define more than one CPU for the virtual machine.&nbsp; When your physical machine is under a high load from other VMs, you get less CPU, memory, IO, etc.&nbsp; For occasional applications, all of this is fine &#8211; you can trade this speed for consolodation, managebility, etc.&nbsp; Occasionally things are slower.&nbsp; That&#8217;s fine.&nbsp; For high-volume applications, this is usually not as good.<\/p>\n<p>Other issues with Virtualization &#8211; memory is a big one.&nbsp; SQL Server assumes, at least in the main server SKUs, that it is the only significant memory consumer on the machine.&nbsp; It&#8217;s a *server*.&nbsp; (SQLExpress has different assumptions, but it&#8217;s no memory slouch either).&nbsp; Now, SQL Server will work in a memory constrained environment, but you often don&#8217;t want to do that.&nbsp; You take that away from a lot of different things &#8211; the buffer pool, the compiled plan cache, memory to execute queries (for example, hash join grants).&nbsp; All of these things can add up if you aren&#8217;t careful.<\/p>\n<p>I\/O is the area where I have the least experience in virtualization.&nbsp; This is one of the reasons I asked people about production SQL Servers.&nbsp; Usually they did get some storage array, and this makes sense &#8211; it ramps the I\/O bandwidth and usually isolates it from any other operations on the machine (your OS, your application you are developing on top of SQL Server, etc).&nbsp; I&#8217;m going to spend some more time on this, but I think the core idea is sound &#8211; as you start sharing your I\/O bandwidth over several VMs, you are going to hit limits earlier with big IO consumers like SQL Server.&nbsp; The same basic logic applies &#8211; isolate your database traffic onto different storage paths, especially when building a system to scale.&nbsp; In a VM world, this can let you avoid the sharing penalties vs. the default config of everyone sharing the same hard drive.<\/p>\n<p>Had you asked me while I worked at MS about a query performance problem on virtualized hardware (even from the MS product), the answer would have been &#8220;don&#8217;t do that&#8221;.&nbsp; I think eventually there will be enough push for some other answer than that.&nbsp; (Reminder &#8211; I don&#8217;t work there anymore, and my opinion is purely my own at this point).<\/p>\n<p><\/p>\n<p>I hope that makes this a fair trade \ud83d\ude42<\/p>\n<p>I&#8217;m off to bed.&nbsp; See ya&#8217;ll.<\/p>\n<p>Conor<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Had I known the number of responses I would have gotten about running SQL Server in virtual environments, I would have spent more time writing a questionnaire!&nbsp; I guess I&#8217;m also pleasantly surprised that so many of you read this blog &#8211; you must all be smarter and better looking than the average blog reader, [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-422","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.9.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Database Virtualization - The Dirty Little Secret Nobody is Talking About... - Conor Cunningham<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sqlskills.com\/blogs\/conor\/database-virtualization-the-dirty-little-secret-nobody-is-talking-about\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Database Virtualization - The Dirty Little Secret Nobody is Talking About... - Conor Cunningham\" \/>\n<meta property=\"og:description\" content=\"Had I known the number of responses I would have gotten about running SQL Server in virtual environments, I would have spent more time writing a questionnaire!&nbsp; I guess I&#8217;m also pleasantly surprised that so many of you read this blog &#8211; you must all be smarter and better looking than the average blog reader, [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/conor\/database-virtualization-the-dirty-little-secret-nobody-is-talking-about\/\" \/>\n<meta property=\"og:site_name\" content=\"Conor Cunningham\" \/>\n<meta property=\"article:published_time\" content=\"2008-02-06T23:13:08+00:00\" \/>\n<meta name=\"author\" content=\"Conor Cunningham\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Conor Cunningham\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/conor\/database-virtualization-the-dirty-little-secret-nobody-is-talking-about\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/conor\/database-virtualization-the-dirty-little-secret-nobody-is-talking-about\/\",\"name\":\"Database Virtualization - The Dirty Little Secret Nobody is Talking About... - Conor Cunningham\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/conor\/#website\"},\"datePublished\":\"2008-02-06T23:13:08+00:00\",\"dateModified\":\"2008-02-06T23:13:08+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/conor\/#\/schema\/person\/f9106e03423de6b5157295891b8c3ae3\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/conor\/database-virtualization-the-dirty-little-secret-nobody-is-talking-about\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/conor\/database-virtualization-the-dirty-little-secret-nobody-is-talking-about\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/conor\/database-virtualization-the-dirty-little-secret-nobody-is-talking-about\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/conor\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Database Virtualization &#8211; The Dirty Little Secret Nobody is Talking About&#8230;\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/conor\/#website\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/conor\/\",\"name\":\"Conor Cunningham\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.sqlskills.com\/blogs\/conor\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/conor\/#\/schema\/person\/f9106e03423de6b5157295891b8c3ae3\",\"name\":\"Conor Cunningham\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/conor\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d9c37eff231ec89c1b244347d966860875eea8b55b366911d2694e8cd9913e57?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d9c37eff231ec89c1b244347d966860875eea8b55b366911d2694e8cd9913e57?s=96&d=mm&r=g\",\"caption\":\"Conor Cunningham\"},\"url\":\"https:\/\/www.sqlskills.com\/blogs\/conor\/author\/conor\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Database Virtualization - The Dirty Little Secret Nobody is Talking About... - Conor Cunningham","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sqlskills.com\/blogs\/conor\/database-virtualization-the-dirty-little-secret-nobody-is-talking-about\/","og_locale":"en_US","og_type":"article","og_title":"Database Virtualization - The Dirty Little Secret Nobody is Talking About... - Conor Cunningham","og_description":"Had I known the number of responses I would have gotten about running SQL Server in virtual environments, I would have spent more time writing a questionnaire!&nbsp; I guess I&#8217;m also pleasantly surprised that so many of you read this blog &#8211; you must all be smarter and better looking than the average blog reader, [&hellip;]","og_url":"https:\/\/www.sqlskills.com\/blogs\/conor\/database-virtualization-the-dirty-little-secret-nobody-is-talking-about\/","og_site_name":"Conor Cunningham","article_published_time":"2008-02-06T23:13:08+00:00","author":"Conor Cunningham","twitter_misc":{"Written by":"Conor Cunningham","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/conor\/database-virtualization-the-dirty-little-secret-nobody-is-talking-about\/","url":"https:\/\/www.sqlskills.com\/blogs\/conor\/database-virtualization-the-dirty-little-secret-nobody-is-talking-about\/","name":"Database Virtualization - The Dirty Little Secret Nobody is Talking About... - Conor Cunningham","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/conor\/#website"},"datePublished":"2008-02-06T23:13:08+00:00","dateModified":"2008-02-06T23:13:08+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/conor\/#\/schema\/person\/f9106e03423de6b5157295891b8c3ae3"},"breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/conor\/database-virtualization-the-dirty-little-secret-nobody-is-talking-about\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/conor\/database-virtualization-the-dirty-little-secret-nobody-is-talking-about\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/conor\/database-virtualization-the-dirty-little-secret-nobody-is-talking-about\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/conor\/"},{"@type":"ListItem","position":2,"name":"Database Virtualization &#8211; The Dirty Little Secret Nobody is Talking About&#8230;"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlskills.com\/blogs\/conor\/#website","url":"https:\/\/www.sqlskills.com\/blogs\/conor\/","name":"Conor Cunningham","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlskills.com\/blogs\/conor\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.sqlskills.com\/blogs\/conor\/#\/schema\/person\/f9106e03423de6b5157295891b8c3ae3","name":"Conor Cunningham","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlskills.com\/blogs\/conor\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d9c37eff231ec89c1b244347d966860875eea8b55b366911d2694e8cd9913e57?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d9c37eff231ec89c1b244347d966860875eea8b55b366911d2694e8cd9913e57?s=96&d=mm&r=g","caption":"Conor Cunningham"},"url":"https:\/\/www.sqlskills.com\/blogs\/conor\/author\/conor\/"}]}},"_links":{"self":[{"href":"https:\/\/www.sqlskills.com\/blogs\/conor\/wp-json\/wp\/v2\/posts\/422","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlskills.com\/blogs\/conor\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlskills.com\/blogs\/conor\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/conor\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/conor\/wp-json\/wp\/v2\/comments?post=422"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/conor\/wp-json\/wp\/v2\/posts\/422\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/conor\/wp-json\/wp\/v2\/media?parent=422"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/conor\/wp-json\/wp\/v2\/categories?post=422"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/conor\/wp-json\/wp\/v2\/tags?post=422"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}