sqlschool.gr logo

articles

Articles of SQLschool.gr Team

Setting Cores in Virtual Machine for SQL Server Standard Edition

Antonios Chatzipavlis
Tuesday 03 November 2020

Από τα πράγματα που καλούμαι συχνά να κάνω στην δουλειά μου είναι να διενεργώ SQL Health Checks στους πελάτες με σκοπό να τους βοηθάω να βελτιώσουν την απόδοση του εντοπίζοντας τα σημεία αυτά που χρειάζονται βελτίωση.

Ένα SQL Health Check περιλαμβάνει αρκετούς ελέγχους και γίνεται σε κάθε instance ξεχωριστά.

Αυτό που παρατήρησα στα τελευταία checks είναι κάτι που με οδήγησε στο να γράψω αυτό το άρθρο.

Αρκετοί έχουν τους SQL Servers σε virtual machines, και αρκετοί χρησιμοποιούν την standard edition του προϊόντος.

Κανένα πρόβλημα με αυτό καθώς αυτές είναι ανάγκες τους. Αυτό όμως που βλέπω να γίνεται σχεδόν πάντα λάθος είναι ο αριθμός των cores και ο τρόπος με τον οποίον αυτός ορίζεται στο virtual machine.

Πρόσφατα σε ένα από τους ελέγχους που διενέργησα στο virtual machine είχαν οριστεί 8 cores.


VM CPU
image

Στον SSMS στα server properties βλέπουμε κανονικά τα cores αυτά και μάλιστα έχουμε αφήσει (σωστά) να κάνει αυτόματα affinity.


Server Properties
image

Αυτό όμως είναι παραπλανητικό καθώς στο virtual machine αυτό είναι εγκαταστημένος SQL Server Standard Edition και αν κάνουμε χρήση της sys.dm_os_schedulers DMV θα δούμε ότι τα τέσσερα από αυτά δεν χρησιμοποιούνται (VISSIBLE OFFLINE).

SQL Script-sys.dm_on_schedulers

select parent_node_id,scheduler_id ,cpu_id ,status  ,is_online 
from sys.dm_os_schedulers 

Results
parent_node_id scheduler_id cpu_id status is_online 1
0 0 0 VISIBLE ONLINE 1
0 1 1 VISIBLE ONLINE 1
0 2 2 VISIBLE ONLINE 1
0 3 3 VISIBLE ONLINE 1
0 4 4 VISIBLE OFFLINE 0
0 5 5 VISIBLE OFFLINE 0
0 6 6 VISIBLE OFFLINE 0
0 7 7 VISIBLE OFFLINE 0
... ... ... ... ...

O λόγος για αυτό που συμβαίνει είναι απλός.

ATTENTION
H standard edition μπορεί να δει μέχρι 4 sockets ή μέχρι 24 cores.

Εύλογα κάποιος θα πει "Mα εγώ όρισα 8 cores".

Δεν είναι όμως έτσι καθώς εξαρτάται και από το virtualization product που χρησιμοποιούμε και το πως αυτό ορίζει την CPU στο κάθε virtual machine.

Το συγκεκριμένο virtual machine είναι σε vmware και ο τρόπος με τον οποίο έχουν οριστεί αυτά είναι ο παρακάτω


VM Settings
image

Αυτό που βλέπουμε είναι λάθος καθώς στην ουσία έχουμε ορίσει στο virtual machine 8 sockets με 1 core/socket με αποτέλεσμα να περνάμε το όριο των 4 sockets που μπορεί να δει η standard edition.

Αν θέλουμε να το έχουμε σωστά θα έπρεπε να έχουμε ορίσει 1 CPU / 8 cores per socket ή αν θέλαμε να έχουμε NUMA 2 CPU/ 4 cores per socket.

Δυστυχώς αυτό είναι ένα συχνό λάθος που σε αφήνει να νομίζεις ότι έχεις τα cores που χρειάζεσαι αλλά στην ουσία δεν τα έχεις.


//Antonios Chatzipavlis


Antonios Chatzipavlis

Antonios Chatzipavlis

Antonios is a Data Solutions Consultant and Trainer. He has been working in IT since 1988. In his career, he has worked as senior developer, IT Manager, Solutions Architect and IT Consultant. Since 1995 he has been devoted on new technologies and software development tools, mainly by Microsoft, either by training company staff and colleagues or assisting them in design, development and implementation as a consultant or chief developer. He has focused in Databases and Data Science since 1995. He specialized in Microsoft SQL Server since version 6.0 in areas like SQL Server Internals, Database Design and Development, Business Intelligence and in 2010 he has started working with Azure Data Platform, NoSQL databases, Big Data Technologies and Machine Learning. He is an active member of many IT communities in Greece, answering colleagues' questions and writing articles in his web site. He is the owner of SQLschool.gr which is a community portal with a lot of information about Microsoft SQL Server. He has been a Microsoft Certified Trainer (MCT) since 2000. Microsoft honored him as MVP on Data Platform due to his activities in SQL Server since 2010. He holds a large number of Microsoft Certifications and Microsoft SQL Server Certifications since version 6.5.

Episode

Task Flows in Microsoft Fabric

image

More Episodes...

Tip

What's New in SQL Server 2022 - Episodes

More Tips...

Become a member

If you want to receive updates from us become a member to our community.

Connect

Explore

Learn


sqlschool.gr © 2010-2025 All rights reserved

This site uses cookies for operational and analytics purposes only. By continuing to browse this site, you agree to their use.