PS> Get-CimInstance Win32_BIOS SMBIOSBIOSVersion : 11018100 Manufacturer : American Megatrends Inc. Name : Default System BIOS SerialNumber : 1207FMA00C Version : SUN - 20151001 PS> Get-CimInstance Win32_ComputerSystem | FL * Status : OK Name : HEL01 Roles : {LM_Workstation, LM_Server, NT, Server_NT} AutomaticManagedPagefile : False DomainRole : 3 HypervisorPresent : False Manufacturer : Oracle Corporation Model : Sun Fire X4800 NetworkServerModeEnabled : True NumberOfLogicalProcessors : 96 NumberOfProcessors : 8 PartOfDomain : True SystemType : x64-based PC TotalPhysicalMemory : 549746266112 PS> Get-CimInstance Win32_ComputerSystemProcessor | FL * GroupComponent : Win32_ComputerSystem (Name = "HEL01") PartComponent : Win32_Processor (DeviceID = "CPU0") CimClass : root/cimv2:Win32_ComputerSystemProcessor CimInstanceProperties : {GroupComponent, PartComponent} ... PartComponent : Win32_Processor (DeviceID = "CPU1") PartComponent : Win32_Processor (DeviceID = "CPU2") PartComponent : Win32_Processor (DeviceID = "CPU3") PartComponent : Win32_Processor (DeviceID = "CPU4") PartComponent : Win32_Processor (DeviceID = "CPU5") PartComponent : Win32_Processor (DeviceID = "CPU6") PartComponent : Win32_Processor (DeviceID = "CPU7") PS> Get-CimInstance Win32_PerfFormattedData_PerfOS_NUMANodeMemory Name : 0 AvailableMBytes : 64530 FreeAndZeroPageListMBytes : 63989 StandbyListMBytes : 541 TotalMBytes : 65526 ... Name : 7 AvailableMBytes : 64600 FreeAndZeroPageListMBytes : 64387 StandbyListMBytes : 213 TotalMBytes : 65536 PS> Get-CimInstance Win32_SystemSlot SlotDesignation : EM00 PCIExp Tag : System Slot 0 SupportsHotPlug : True Status : OK Shared : True PMESignal : True MaxDataWidth : 8 ... SlotDesignation : EM01 PCIExp Tag : System Slot 1 SlotDesignation : EM30 PCIExp Tag : System Slot 2 SlotDesignation : EM31 PCIExp Tag : System Slot 3 SlotDesignation : EM10 PCIExp Tag : System Slot 4 SlotDesignation : EM11 PCIExp Tag : System Slot 5 SlotDesignation : EM20 PCIExp Tag : System Slot 6 SlotDesignation : EM21 PCIExp Tag : System Slot 7 PS> Get-CimInstance Win32_PerfFormattedData_Counters_ProcessorInformation Name : 0,0 PercentofMaximumFrequency : 100 PercentPerformanceLimit : 100 PercentProcessorPerformance : 69 ProcessorFrequency : 2001 ... Name : 0,11 --- Name : 7,0 PercentofMaximumFrequency : 100 PercentPerformanceLimit : 100 PercentProcessorPerformance : 72 ProcessorFrequency : 2001 ... Name : 7,11
Intel(R) Xeon(R) CPU E7540 @ 2.00GHz Intel64 Family 6 Model 46 Stepping 6, GenuineIntel Microcode signature: 00000009 HTT * Hyperthreading enabled HYPERVISOR - Hypervisor is present VMX * Supports Intel hardware-assisted virtualization SVM - Supports AMD hardware-assisted virtualization X64 * Supports 64-bit mode SMX - Supports Intel trusted execution SKINIT - Supports AMD SKINIT ...
Logical Processor to Socket Map: Logical Processor to NUMA Node Map: Socket 0: NUMA Node 0: ************------------------------------------ ************------------------------------------ ------------------------------------------------ ------------------------------------------------ Socket 1: NUMA Node 1: ------------------------------------------------ ------------------------------------------------ ************------------------------------------ ************------------------------------------ Socket 2: NUMA Node 2: ------------************------------------------ ------------************------------------------ ------------------------------------------------ ------------------------------------------------ Socket 3: NUMA Node 3: ------------------------------------------------ ------------------------------------------------ ------------************------------------------ ------------************------------------------ Socket 4: NUMA Node 4: ------------------------************------------ ------------------------************------------ ------------------------------------------------ ------------------------------------------------ Socket 5: NUMA Node 5: ------------------------------------------------ ------------------------------------------------ ------------------------************------------ ------------------------************------------ Socket 6: NUMA Node 6: ------------------------------------************ ------------------------------------************ ------------------------------------------------ ------------------------------------------------ Socket 7: NUMA Node 7: ------------------------------------------------ ------------------------------------------------ ------------------------------------************ ------------------------------------************
Logical Processor to Group Map: Group 0: Group 1: ************************************************ ------------------------------------------------ ------------------------------------------------ ************************************************
Approximate Cross-NUMA Node Access Cost (relative to fastest): 00 01 02 03 04 05 06 07 00: 1.4 1.7 2.1 1.7 1.7 2.1 2.2 2.1 01: 1.7 1.4 1.7 2.1 2.1 1.7 2.0 1.3 02: 2.1 1.7 1.4 1.7 2.1 2.1 1.6 1.2 03: 1.8 2.1 1.7 1.4 2.1 2.1 2.0 1.1 04: 1.7 2.1 2.1 2.1 1.4 1.7 1.7 1.4 05: 2.1 1.7 2.1 2.1 1.7 1.4 2.0 1.0 06: 2.1 2.1 1.7 2.1 1.7 2.1 1.4 1.3 07: 2.1 2.1 2.1 1.7 2.1 1.7 1.6 1.0
PS:518 [HEL01]> Get-CimInstance Win32_OperatingSystem | FL * Status : OK Name : Microsoft Windows Server 2012 R2 Standard FreePhysicalMemory : 528660256 FreeSpaceInPagingFiles : 8388608 FreeVirtualMemory : 537242324 Distributed : False MaxNumberOfProcesses : 4294967295 MaxProcessMemorySize : 137438953344 OSType : 18 SizeStoredInPagingFiles : 8388608 TotalSwapSpaceSize : TotalVirtualMemorySize : 545250196 TotalVisibleMemorySize : 536861588 Version : 6.3.9600 BootDevice : \Device\HarddiskVolume1 BuildNumber : 9600 BuildType : Multiprocessor Free CodeSet : 1252 DataExecutionPrevention_32BitApplications : True DataExecutionPrevention_Available : True DataExecutionPrevention_Drivers : True DataExecutionPrevention_SupportPolicy : 3 Debug : False ForegroundApplicationBoost : 2 LargeSystemCache : Manufacturer : Microsoft Corporation OperatingSystemSKU : 7 OSArchitecture : 64-bit PAEEnabled : ServicePackMajorVersion : 0 ServicePackMinorVersion : 0
"ProcessA" is pinned, by scheduler, to Processor group 0 with ability to run on all CPUs within that group. "ProcessB" is pinned, by scheduler, to Processor group 1 with ability to run on all CPUs within that group. ProcessorAffinity member of System.Diagnostics.Process class is the same in both cases! $procA = Get-Process -Name ProcessA $procA.ProcessorAffinity 281474976710655 #For my 48 CPUs in each Processor group. $procB = Get-Process -Name ProcessB $procB.ProcessorAffinity 281474976710655 #For my 48 CPUs in each Processor group.
$sb_psi = New-object System.Diagnostics.ProcessStartInfo $sb_psi.CreateNoWindow = $true $sb_psi.UseShellExecute = $false $sb_psi.RedirectStandardOutput = $true $sb_psi.RedirectStandardError = $true $sb_psi.FileName = "$PathToSB" + '\sysbench.exe ' $sb_psi.Arguments = @("$sbArgList") $sb_process = $null $sb_process = New-Object System.Diagnostics.Process $sb_process.StartInfo = $sb_psi [void]$sb_process.Start() <<<< #Now you can set the Affinity mask: $sb_process.ProcessorAffinity = $SCRIPT:SP_BENCHMARK_CPU $sb_process.WaitForExit()
Settings: sysbench.conf: BENCHMARK_NODE=5 BENCHMARK_CPU="111100000000" # Xeon E7540 has 12 CPUs per socket so I'm running on LAST 4 (9,10,11 and 12). These options allow user to run Sysbench on certain NUMA node as well as certain CPUs within that NUMA node. autobench.conf: SERVER_NUMA_NODE=3 SERVER_CPU="111111111" #(Or, 000111111111) Running on first 9 CPUs. It is not necessary to set CPUs to run on if you're running on entire dedicated NUMA node. Pros: Works. Cons: The process you're starting is not the expected one (say, benchmark) but rather cmd.exe START. Cumbersome. Not really "Powershell-way". Process is bound to just one NUMA node which is fine if it's not hungry for more CPU power.
$process = Start-Process E:\test\mysql-cluster-7.5.0-winx64\bin\mysqld.exe -ArgumentList "--standalone --console --initialize-insecure" -WindowStyle Hidden -PassThru -Wait -RedirectStandardOutput e:\test\stdout.txt -RedirectStandardError e:\test\stderr.txt $process.ProcessorAffinity = 70368739983360 Affinity mask means mysqld runs on NUMA node 7, 5 and part of 3 (0-based index) IF ProcessorGroup is set to 1 by Kernel scheduler: 001111111111111111111111110000000000000000000000 = 70368739983360 |___________________48 CPUs____________________| |__________||__________||__________||__________| NUMA #7 NUMA #5 NUMA #3 NUMA #1 Settings: Autobench.conf: SP_SERVER_CPU=70368739983360 Sysbench.conf: SP_BENCHMARK_CPU=211106232532992 #Run on NUMA node 7, last 2 CPUs, 110000000000000000000000000000000000000000000000b Pros: Real "Powershell-way" of doing things. Process can span over more than 1 NUMA node. Good control of the process (HasExited, ExitTime, Kill, ID (PID) ...). Cons: Late binding; i.e. process has to be up and running for you to pin it to CPUs. This presents a problem with processes that start running immediately. No way to control Processor group meaning there is no way to guarantee the kernel scheduler will start all of your processes inside the desired Processor group.
config.ini ---------- NoOfFragmentLogParts=10 ThreadConfig=ldm={count=10,cpubind=88-91,100-105},tc={count=4,cpubind=94-95,106-107},send={count=2,cpubind=92-93}, recv={count=2,cpubind=98,99},main={count=1,cpubind=109},rep={count=1,cpubind=109} sysbench.conf ------------- #NUMA node to run sysbench on. BENCHMARK_NODE=0 #Zero based index. #CPUs inside selected NUMA node to run sysbench on. BENCHMARK_CPU="111100000000" 000000001111 |__________| |_12 CPUs__| NUMA #0 CPU0 CPU11 autobench.conf -------------- SP_SERVER_CPU=1048575 Affinity mask means mysqld runs on NUMA node 7, 5 and part of 3 (0-based index) IF ProcessorGroup is 1: 001111111111111111111111110000000000000000000000 = 70368739983360d |___________________48 CPUs____________________| |__________||__________||__________||__________| NUMA #7 NUMA #5 NUMA #3 NUMA #1 Test image shows 000000000000000000000000000011111111111111111111 = 1048575d |___________________48 CPUs____________________| |__________||__________||__________||__________| NUMA #7 NUMA #5 NUMA #3 NUMA #1
BENCHMARK_CPU="111100000000" 000000001111 |__________| |_12 CPUs__| NUMA #0 CPU0 CPU11
000000000000000000000000000011111111111111111111 = 1048575d |___________________48 CPUs____________________| |__________||__________||__________||__________| NUMA #7 NUMA #5 NUMA #3 NUMA #1 or, should the scheduler pick Processor group 0: NUMA #6 NUMA #4 NUMA #2 NUMA #0
ThreadConfig=ldm={count=10,cpubind=88-91,100-105},tc={count=4,cpubind=94-95,106-107},send={count=2,cpubind=92-93},recv={count=2,cpubind=98,99},main={count=1,cpubind=109},rep={count=1,cpubind=109}
Processor group 0 |Processor group 1 CPU#0 CPU#47 CPU#63CPU#64 CPU#110 CPU#127 | AVAILABLE | RESERV || AVAILABLE | RESERV | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXRRRRRRRRRRRRRRRRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXRRRRRRRRRRRRRRRR
评论已关闭