This document discusses virtual CPUs and CPU architecture. It begins by explaining how hypervisor resource queues work and how requests for CPU, memory, storage and networking are placed in queues. It then covers physical CPU architecture including cores, sockets, NUMA and memory locality. It discusses how virtual CPUs are scheduled by the hypervisor and ways to measure scheduling pressure. Finally, it provides recommendations for right-sizing virtual machines and balancing workloads to reduce scheduling delays.
24 Hours of PASS, Summit Preview Session: Virtual SQL Server CPUs
1. Virtual CPUs: Right to Ludicrous
Speed
David Klee, Founder & Chief Architect, Heraflux Technologies
2. If you require assistance
during the session, type
your inquiry into the
question pane on the right
side.
Maximize your screen with
the zoom button on the
top of the presentation
window.
Please fill in the short
evaluation following the
session. It will appear in
your web browser.
Technical Assistance
3. Thank You to Our Sponsors
Quest helps our customers reduce tedious
administration tasks so they can focus on the
innovation necessary for their businesses to
grow. Quest® solutions are scalable,
affordable and simple-to-use, and they deliver
unmatched efficiency and productivity.
Combined with Quest’s invitation to the global
community to be a part of its innovation, as
well as our firm commitment to ensuring
customer satisfaction, Quest will continue to
accelerate the delivery of the most
comprehensive solutions for Azure cloud
management, SaaS, security, workforce
mobility and data-driven insight.
Melissa Global Intelligence provides data
quality and identity resolution tools for SQL
Server and .NET to perform the tasks of
ensuring new incoming data is in good
condition and maintaining data quality over
time. Utilizing comprehensive reference
datasets, Melissa solutions verify, standardize,
dedupe, enrich, geocode and update global
contact data including address, name, email
and phone data. Since 1985, Melissa has
helped businesses of any size improve data
management, data governance and business
analytics with clean, reliable and actionable
data. Melissa is a Registered Microsoft Partner
with international offices in the U.K, Germany
and India.
Nutanix makes IT infrastructure invisible with
an enterprise cloud platform that delivers the
agility and economics of the public cloud,
without sacrificing the security and control of
on-premises infrastructure. Whether
upgrading existing infrastructure or deploying
new environments, Nutanix is the ideal
solution for virtualized SQL Server
deployments.
• Consolidate SQL Server databases and VMs onto a single
converged platform
• Run Microsoft SQL Server with other critical workloads,
without sacrificing performance or reliability
• Remove the complexity and reduce the costs of traditional
storage
• Eliminate planned downtime and protect against
unplanned issues to deliver continuous availability
• Keep pace with rapidly growing business needs
4. Access to online
training and
content
Enjoy discounted
event rates
Join Local Groups
and Virtual Groups
Get advance notice
of member
exclusives
PASS is a not-for-profit organization which offers year-round learning opportunities
to data professionals.
Check Out Your Member Benefits Today.
www.pass.org
Make the Most Out of your PASS Membership
6. Virtual CPUs: Right to Ludicrous
Speed
David, Klee, Founder & Chief Architect, Heraflux Technologies
7. HEALTH, CAPACITY, & EFFICENCY
Focused on understanding system health, capacity and operations
management, and overall efficiency of all things IT.
David Klee
FOUNDER – HERAFLUX TECHNOLOGIES
Enterprise consulting centered on the convergence of infrastructure,
data, and cloud
DATA INFRASTRUCTURE ARCHITECT
Seventeen years of enterprise SQL Server virtualization experience.
Virtualized some of the largest SQL Servers in the world./davidaklee
/kleegeek
/in/davidaklee
8. DBA Knowledge Gaps
VIRTUALIZATION & HARDWARE
• What is it?
• How do they work together?
MODERN CPU ARCHITECTURE
• Cores & sockets
• NUMA & memory locality
HYPERVISOR RESOURCE SCHEDULING
• Hypervisor queues, resource overcommit, queue balancing
• “Right-sizing”
• SQL Server balancing
9. Virtualization Basics
RESOURCES QUEUES
• Compute resources in datacenter
• CPU
• Memory
• Network
• Storage
• Every resource request placed in queue
• Queue time variable
• Queues not FIFO
• Imbalances & overcommitment
10. Four Main Food Groups
CPU
Our primary balancing act
Memory
Mostly non-oversubscribed, so less important
Storage
Flash storage shifts bottleneck back up the stack
Networking
Verify throughput but usually not bottleneck to normal operations
11. Hypervisor Resource Queues
Hypervisor
CPU Scheduler
CPU
Execution
CPU Scheduling Queue
Memory Allocator
Mem
R / W
Mem Allocation Queue
Disk Scheduler
Disk
R / W
Disk Scheduling Queue
Network Scheduler
Network
Tran / Rec
Network Scheduling Queue
VM TASK
VM TASK
VM TASK
VM TASK
VM TASK
16. CPU UMA Architecture
CPU 0 CPU 1 CPU 2 CPU 3 CPU 4 CPU 5 CPU 6 CPU 7
Memory Controller
(northbridge)
I/O Controller
RAM DIMM RAM DIMM
RAM DIMM RAM DIMM
RAM DIMM RAM DIMM
RAM DIMM RAM DIMM
21. Why Does This Matter?
SQL Server is NUMA Aware
• All layers must be properly aligned to maintain performance
• Mis-alignment causes substantial performance impact
Hypervisor Can Obfuscate pNUMA
• Can create an immediate out-of-balance situation
• Degrades performance silently
Maximum Performance is Critical
• SQL Server is extremely latency sensitive with these layers
25. Determine vCPU Count
How Many Do You Need?
• “Right-sizing” analysis
• Ongoing performance baseline
• Size for now, not future
• Want target CPU utilization 40-60% during
routine business operations
• Leave headroom for short-term growth
• Resize VM as necessary
33. Scheduling Trouble Measurement
Hyper-V – Wait Time Per Dispatch
• Measured in nanoseconds
• Average value or individual core values
• Sample interval (one second)
• Avg. over collection interval (X seconds )
• (Metric value / sample interval total
nanoseconds) * 100%
• = Avg. percent perf loss
34. Scheduling Trouble Measurement
VMware – CPU Ready Time
• Measured in milliseconds
• Sum total value or individual core values
• Fixed 20-second sample interval
• (Sum total / # cores / 20000ms) * 100%
• = Avg. percent perf loss
35. SMP vCPU Schedule Balancing
vCPUTASKEXECUTIONONpCPUS
vCPUTASKSUBMISSIONTOQUEUES
VM
(1x8)
VM Host (2x8)
READY TO RUN QUEUE
READY TO RUN QUEUE
READY TO RUN QUEUE
READY TO RUN QUEUE
READY TO RUN QUEUE
READY TO RUN QUEUE
READY TO RUN QUEUE
READY TO RUN QUEUE
MaxDOP=4
36. Scheduling Trouble Measurement
VMware – Co-Stop
• Measured in milliseconds
• Sum total value or individual core values
• Fixed 20-second sample interval
• Look for sustained stretches
• No known equivalent on MS Hyper-V
38. Balanced Harmony
1x12 CPU / 128GB Socket
1x12 CPU / 128GB Socket
VM 2x8 / 128GB
vCPUs vCPUs
MaxDOP = 8
DB
BIG
QUERY
39. Remediation Tasks
RIGHT-SIZE ALL THE VMs REDUCE VM WORKLOAD
• Reduce vCPU allocations (when applicable)
• Align vNUMA boundaries
• Reduce vCPU queue scheduling
• Smaller footprint easier to schedule
• Less host CPU scheduling delays
• Load balance VM cluster
• Remove VM workloads from your host
• Resource pools to prioritize workloads
Welcome to 24 Hours of PASS: Data Security and Data Quality.
We’re excited you could join us today for David Klee’s session, Virtual CPUs: Right to Ludicrous Speed.
This 24 Hours of PASS event consists of 24 consecutive live webinars, delivered by expert speakers from the PASS community.
The sessions will be recorded and posted online after the event. To access any on-demand sessions, please visit http://www.pass.org/24hours/2017/security/Schedule.aspx for all session links.
My name is [MODERATOR] [you can say a bit about yourself here if you’d like]
I have a few introductory slides before I hand over the reins to David.
[move to next slide]
If you require technical assistance please type your question into the question pane located on the right side of your screen and someone will assist you. This question pane is also where you may ask any questions throughout the presentation. Feel free to enter your questions at any time and once we get to the Q&A portion of the session, I’ll read your questions aloud to the speaker.
You are able to zoom in on the presentation content by using the zoom button located on the top of the presentation window.
Please note that there will be a short evaluation at the end of the session. Your feedback is important to us so please take a moment to complete it. It will appear in your web browser.
[Note to moderators: You need to determine which questions are the most relevant and ask them out loud to the presenter].
I’d like to take a moment to thank our presenting sponsors, Quest, Melissa and Nutanix.
The staging of 24 Hours of PASS would not be possible without their generous support, and they are the reason this event is available free of charge.
[move to next slide]
Make sure you explore everything else PASS has on offer for data professionals! You can join local user groups around the world, special interest groups, find free online resources through our learning center and read up on the latest community news in the Connector Newsletter.
[move to next slide]
[moderator slide]
Next, I’d like to bring your attention to the upcoming PASS Summit.
Taking place in Seattle, Washington, from October 31st to November 3rd , PASS Summit 2017 features over 200 sessions with world-class data experts.
It’s the perfect place to Connect, Share and Learn from Industry Experts from around the world!
To find out more, visit www.passsummit.com
[move to next slide]
[next slide]
And without further ado, here is David with Virtual CPUs: Right to Ludicrous Speed.
{speaker begins}
Let’s come to an understanding. The hypervisor and the way it manages the CPUs in the physical server must be properly understood before we go any further.
Resources & queues
Cpu architecture
Uncore is a collection of components of a CPU that do not carry out core computational tasks but are essential for core performance, such as power management, interface to I/O devices, and memory controller.
L3 cache, or last level cache, is shared between all of the active cores.
Cpu architecture
Cpu architecture
Cpu architecture
Cpu architecture
Cpu architecture
The VM admins see this when they look at a host, and only if they expand a VM’s advanced CPU configuration do they see the cores and socket count. Otherwise, they just see the CPU total count.
How many vCPUs do you NEED?
How many vCPUs do you NEED?
Final right sizing on this one, if this represents every normal day, should be to cut the core count in half and start your testing there.
Cpu architecture
Lots of these things all together, either on prem through virtualization, or in the cloud, extends the system on a massive scale
I’ve seen 19 to 1 overcommit. It’s not pretty.
VM is too big & all resources not getting used
Too much background activity (cpu overcommit)
VM mis-alignment with pNUMA
VM is too big & all resources not getting used
Too much background activity (cpu overcommit)
VM mis-alignment with pNUMA
VM is too big & all resources not getting used
Too much background activity (cpu overcommit)
VM mis-alignment with pNUMA
Make sure to stay tuned for our next session, Azure SQL VM - Implementing Basic AG in SQL 2016 STD with Kenneth Urena.
[move to next slide]