MAXDOP Settings for SQL Server 2014MAXDOP setting algorithm for SQL ServerSQL Server recommended MAXDOP settings for NUMAMAXDOP setting algorithm for SQL ServerOracle GoldenGate add trandata errorsIdeal MAXDOP & CPUs - how to trace for parallel queries?MAXDOP query for SQL Server 2012Multi-instance SQL Server Standard Editon MaxDop settingsSQL Server MAXDOP , microsoft reommendationResource semaphore query compile waitsInvestigating errors from strange querySQL Server MAXDOP on VMWare Virtual Servers

Why don’t airliners have temporary liveries?

Will TSA allow me to carry a Continuous Positive Airway Pressure (CPAP)/sleep apnea device?

SF novella separating the dumb majority from the intelligent part of mankind

How to translate “Me doing X” like in online posts?

Cause of continuous spectral lines

How hard would it be to convert a glider into an powered electric aircraft?

How to make a setting relevant?

Do any instruments not produce overtones?

What happened to all the nuclear material being smuggled after the fall of the USSR?

PostgreSQL - Array of overlapping Polygon Ids

Segmentation fault and huge SRAM need for Serial.println

Can characters escape from Death House through this method?

What LISP compilers and interpreters were available for 8-bit machines?

How can drunken, homicidal elves successfully conduct a wild hunt?

When writing an error prompt, should we end the sentence with a exclamation mark or a dot?

Movie where a boy is transported into the future by an alien spaceship

Should I "tell" my exposition or give it through dialogue?

Select items in a list that contain criteria

How to make thick Asian sauces?

Why does the Schrödinger equation work so well for the Hydrogen atom despite the relativistic boundary at the nucleus?

Does Lightning Network has concept of continuous stream of value?

Payment instructions from HomeAway look fishy to me

Implement Homestuck's Catenative Doomsday Dice Cascader

Does an ice chest packed full of frozen food need ice?



MAXDOP Settings for SQL Server 2014


MAXDOP setting algorithm for SQL ServerSQL Server recommended MAXDOP settings for NUMAMAXDOP setting algorithm for SQL ServerOracle GoldenGate add trandata errorsIdeal MAXDOP & CPUs - how to trace for parallel queries?MAXDOP query for SQL Server 2012Multi-instance SQL Server Standard Editon MaxDop settingsSQL Server MAXDOP , microsoft reommendationResource semaphore query compile waitsInvestigating errors from strange querySQL Server MAXDOP on VMWare Virtual Servers






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








8















I know this question has been asked number of times and also has answers to it but, I still need a bit more guidance on this subject.



Below is the details of my CPU from SSMS:



CPU



Below is CPU tab from task manager of the DB Server:



CPU Tab



I have kept the setting of MAXDOP at 2 by following below formula:



declare @hyperthreadingRatio bit
declare @logicalCPUs int
declare @HTEnabled int
declare @physicalCPU int
declare @SOCKET int
declare @logicalCPUPerNuma int
declare @NoOfNUMA int
declare @MaxDOP int

select @logicalCPUs = cpu_count -- [Logical CPU Count]
,@hyperthreadingRatio = hyperthread_ratio -- [Hyperthread Ratio]
,@physicalCPU = cpu_count / hyperthread_ratio -- [Physical CPU Count]
,@HTEnabled = case
when cpu_count > hyperthread_ratio
then 1
else 0
end -- HTEnabled
from sys.dm_os_sys_info
option (recompile);

select @logicalCPUPerNuma = COUNT(parent_node_id) -- [NumberOfLogicalProcessorsPerNuma]
from sys.dm_os_schedulers
where [status] = 'VISIBLE ONLINE'
and parent_node_id < 64
group by parent_node_id
option (recompile);

select @NoOfNUMA = count(distinct parent_node_id)
from sys.dm_os_schedulers -- find NO OF NUMA Nodes
where [status] = 'VISIBLE ONLINE'
and parent_node_id < 64

IF @NoofNUMA > 1 AND @HTEnabled = 0
SET @MaxDOP= @logicalCPUPerNuma
ELSE IF @NoofNUMA > 1 AND @HTEnabled = 1
SET @MaxDOP=round( @NoofNUMA / @physicalCPU *1.0,0)
ELSE IF @HTEnabled = 0
SET @MaxDOP=@logicalCPUs
ELSE IF @HTEnabled = 1
SET @MaxDOP=@physicalCPU

IF @MaxDOP > 10
SET @MaxDOP=10
IF @MaxDOP = 0
SET @MaxDOP=1

PRINT 'logicalCPUs : ' + CONVERT(VARCHAR, @logicalCPUs)
PRINT 'hyperthreadingRatio : ' + CONVERT(VARCHAR, @hyperthreadingRatio)
PRINT 'physicalCPU : ' + CONVERT(VARCHAR, @physicalCPU)
PRINT 'HTEnabled : ' + CONVERT(VARCHAR, @HTEnabled)
PRINT 'logicalCPUPerNuma : ' + CONVERT(VARCHAR, @logicalCPUPerNuma)
PRINT 'NoOfNUMA : ' + CONVERT(VARCHAR, @NoOfNUMA)
PRINT '---------------------------'
Print 'MAXDOP setting should be : ' + CONVERT(VARCHAR, @MaxDOP)


I am still seeing high wait times related to CXPACKET. I am using below query to get that:



WITH [Waits] AS
(SELECT
[wait_type],
[wait_time_ms] / 1000.0 AS [WaitS],
([wait_time_ms] - [signal_wait_time_ms]) / 1000.0 AS [ResourceS],
[signal_wait_time_ms] / 1000.0 AS [SignalS],
[waiting_tasks_count] AS [WaitCount],
100.0 * [wait_time_ms] / SUM ([wait_time_ms]) OVER() AS [Percentage],
ROW_NUMBER() OVER(ORDER BY [wait_time_ms] DESC) AS [RowNum]
FROM sys.dm_os_wait_stats
WHERE [wait_type] NOT IN (
N'BROKER_EVENTHANDLER', N'BROKER_RECEIVE_WAITFOR',
N'BROKER_TASK_STOP', N'BROKER_TO_FLUSH',
N'BROKER_TRANSMITTER', N'CHECKPOINT_QUEUE',
N'CHKPT', N'CLR_AUTO_EVENT',
N'CLR_MANUAL_EVENT', N'CLR_SEMAPHORE',
N'DBMIRROR_DBM_EVENT', N'DBMIRROR_EVENTS_QUEUE',
N'DBMIRROR_WORKER_QUEUE', N'DBMIRRORING_CMD',
N'DIRTY_PAGE_POLL', N'DISPATCHER_QUEUE_SEMAPHORE',
N'EXECSYNC', N'FSAGENT',
N'FT_IFTS_SCHEDULER_IDLE_WAIT', N'FT_IFTSHC_MUTEX',
N'HADR_CLUSAPI_CALL', N'HADR_FILESTREAM_IOMGR_IOCOMPLETION',
N'HADR_LOGCAPTURE_WAIT', N'HADR_NOTIFICATION_DEQUEUE',
N'HADR_TIMER_TASK', N'HADR_WORK_QUEUE',
N'KSOURCE_WAKEUP', N'LAZYWRITER_SLEEP',
N'LOGMGR_QUEUE', N'ONDEMAND_TASK_QUEUE',
N'PWAIT_ALL_COMPONENTS_INITIALIZED',
N'QDS_PERSIST_TASK_MAIN_LOOP_SLEEP',
N'QDS_CLEANUP_STALE_QUERIES_TASK_MAIN_LOOP_SLEEP',
N'REQUEST_FOR_DEADLOCK_SEARCH', N'RESOURCE_QUEUE',
N'SERVER_IDLE_CHECK', N'SLEEP_BPOOL_FLUSH',
N'SLEEP_DBSTARTUP', N'SLEEP_DCOMSTARTUP',
N'SLEEP_MASTERDBREADY', N'SLEEP_MASTERMDREADY',
N'SLEEP_MASTERUPGRADED', N'SLEEP_MSDBSTARTUP',
N'SLEEP_SYSTEMTASK', N'SLEEP_TASK',
N'SLEEP_TEMPDBSTARTUP', N'SNI_HTTP_ACCEPT',
N'SP_SERVER_DIAGNOSTICS_SLEEP', N'SQLTRACE_BUFFER_FLUSH',
N'SQLTRACE_INCREMENTAL_FLUSH_SLEEP',
N'SQLTRACE_WAIT_ENTRIES', N'WAIT_FOR_RESULTS',
N'WAITFOR', N'WAITFOR_TASKSHUTDOWN',
N'WAIT_XTP_HOST_WAIT', N'WAIT_XTP_OFFLINE_CKPT_NEW_LOG',
N'WAIT_XTP_CKPT_CLOSE', N'XE_DISPATCHER_JOIN',
N'XE_DISPATCHER_WAIT', N'XE_TIMER_EVENT')
AND [waiting_tasks_count] > 0
)
SELECT
MAX ([W1].[wait_type]) AS [WaitType],
CAST (MAX ([W1].[WaitS]) AS DECIMAL (16,2)) AS [Wait_S],
CAST (MAX ([W1].[ResourceS]) AS DECIMAL (16,2)) AS [Resource_S],
CAST (MAX ([W1].[SignalS]) AS DECIMAL (16,2)) AS [Signal_S],
MAX ([W1].[WaitCount]) AS [WaitCount],
CAST (MAX ([W1].[Percentage]) AS DECIMAL (5,2)) AS [Percentage],
CAST ((MAX ([W1].[WaitS]) / MAX ([W1].[WaitCount])) AS DECIMAL (16,4)) AS [AvgWait_S],
CAST ((MAX ([W1].[ResourceS]) / MAX ([W1].[WaitCount])) AS DECIMAL (16,4)) AS [AvgRes_S],
CAST ((MAX ([W1].[SignalS]) / MAX ([W1].[WaitCount])) AS DECIMAL (16,4)) AS [AvgSig_S]
FROM [Waits] AS [W1]
INNER JOIN [Waits] AS [W2]
ON [W2].[RowNum] <= [W1].[RowNum]
GROUP BY [W1].[RowNum]
HAVING SUM ([W2].[Percentage]) - MAX ([W1].[Percentage]) < 95; -- percentage threshold
GO


Currently CXPACKET wait stands at 63% for my server:



Wait Statistics



I referred to multiple articles on the recommendation from experts and also looked at MAXDOP suggestions by Microsoft; however, I am not really sure what should be the optimum value for this one.



I found one question on the same topic here however if I go with that suggestion by Kin then, MAXDOP should be 4. In the same question, if we go with Max Vernon, it should be 3.



Kindly provide your valuable suggestion.




Version: Microsoft SQL Server 2014 (SP3) (KB4022619) - 12.0.6024.0
(X64) Sep 7 2018 01:37:51 Enterprise Edition: Core-based Licensing
(64-bit) on Windows NT 6.3 (Build 9600: ) (Hypervisor)




Cost Threshold for Parallelism is set at 70. CTfP has been set to 70 after testing the same for values ranging from default to 25 and 50 respectively. When it was default(5) and MAXDOP was 0, wait time was close to 70% for CXPACKET.



I executed sp_blitzfirst for 60 seconds in the expert mode and below is the output for findings and wait stats:



sp_blitzfirst










share|improve this question
























  • I agree with @JaredKarney 's comment in his answer: What are you trying to fix/solve? Are you encountering bad performance? Why do you believe that a high CXPACKET wait is bad? Could you please elaborate on why your situation is different than all the other questions and answers regarding this issue?

    – hot2use
    Mar 25 at 15:42











  • @hot2use Yes, I am having performance issue and trying to see all possible aspects which could deteriorate performance. I am not expert on CXPACKET wait stats and hence wanted to have some guidance from experts.

    – Learning_DBAdmin
    Mar 25 at 17:23

















8















I know this question has been asked number of times and also has answers to it but, I still need a bit more guidance on this subject.



Below is the details of my CPU from SSMS:



CPU



Below is CPU tab from task manager of the DB Server:



CPU Tab



I have kept the setting of MAXDOP at 2 by following below formula:



declare @hyperthreadingRatio bit
declare @logicalCPUs int
declare @HTEnabled int
declare @physicalCPU int
declare @SOCKET int
declare @logicalCPUPerNuma int
declare @NoOfNUMA int
declare @MaxDOP int

select @logicalCPUs = cpu_count -- [Logical CPU Count]
,@hyperthreadingRatio = hyperthread_ratio -- [Hyperthread Ratio]
,@physicalCPU = cpu_count / hyperthread_ratio -- [Physical CPU Count]
,@HTEnabled = case
when cpu_count > hyperthread_ratio
then 1
else 0
end -- HTEnabled
from sys.dm_os_sys_info
option (recompile);

select @logicalCPUPerNuma = COUNT(parent_node_id) -- [NumberOfLogicalProcessorsPerNuma]
from sys.dm_os_schedulers
where [status] = 'VISIBLE ONLINE'
and parent_node_id < 64
group by parent_node_id
option (recompile);

select @NoOfNUMA = count(distinct parent_node_id)
from sys.dm_os_schedulers -- find NO OF NUMA Nodes
where [status] = 'VISIBLE ONLINE'
and parent_node_id < 64

IF @NoofNUMA > 1 AND @HTEnabled = 0
SET @MaxDOP= @logicalCPUPerNuma
ELSE IF @NoofNUMA > 1 AND @HTEnabled = 1
SET @MaxDOP=round( @NoofNUMA / @physicalCPU *1.0,0)
ELSE IF @HTEnabled = 0
SET @MaxDOP=@logicalCPUs
ELSE IF @HTEnabled = 1
SET @MaxDOP=@physicalCPU

IF @MaxDOP > 10
SET @MaxDOP=10
IF @MaxDOP = 0
SET @MaxDOP=1

PRINT 'logicalCPUs : ' + CONVERT(VARCHAR, @logicalCPUs)
PRINT 'hyperthreadingRatio : ' + CONVERT(VARCHAR, @hyperthreadingRatio)
PRINT 'physicalCPU : ' + CONVERT(VARCHAR, @physicalCPU)
PRINT 'HTEnabled : ' + CONVERT(VARCHAR, @HTEnabled)
PRINT 'logicalCPUPerNuma : ' + CONVERT(VARCHAR, @logicalCPUPerNuma)
PRINT 'NoOfNUMA : ' + CONVERT(VARCHAR, @NoOfNUMA)
PRINT '---------------------------'
Print 'MAXDOP setting should be : ' + CONVERT(VARCHAR, @MaxDOP)


I am still seeing high wait times related to CXPACKET. I am using below query to get that:



WITH [Waits] AS
(SELECT
[wait_type],
[wait_time_ms] / 1000.0 AS [WaitS],
([wait_time_ms] - [signal_wait_time_ms]) / 1000.0 AS [ResourceS],
[signal_wait_time_ms] / 1000.0 AS [SignalS],
[waiting_tasks_count] AS [WaitCount],
100.0 * [wait_time_ms] / SUM ([wait_time_ms]) OVER() AS [Percentage],
ROW_NUMBER() OVER(ORDER BY [wait_time_ms] DESC) AS [RowNum]
FROM sys.dm_os_wait_stats
WHERE [wait_type] NOT IN (
N'BROKER_EVENTHANDLER', N'BROKER_RECEIVE_WAITFOR',
N'BROKER_TASK_STOP', N'BROKER_TO_FLUSH',
N'BROKER_TRANSMITTER', N'CHECKPOINT_QUEUE',
N'CHKPT', N'CLR_AUTO_EVENT',
N'CLR_MANUAL_EVENT', N'CLR_SEMAPHORE',
N'DBMIRROR_DBM_EVENT', N'DBMIRROR_EVENTS_QUEUE',
N'DBMIRROR_WORKER_QUEUE', N'DBMIRRORING_CMD',
N'DIRTY_PAGE_POLL', N'DISPATCHER_QUEUE_SEMAPHORE',
N'EXECSYNC', N'FSAGENT',
N'FT_IFTS_SCHEDULER_IDLE_WAIT', N'FT_IFTSHC_MUTEX',
N'HADR_CLUSAPI_CALL', N'HADR_FILESTREAM_IOMGR_IOCOMPLETION',
N'HADR_LOGCAPTURE_WAIT', N'HADR_NOTIFICATION_DEQUEUE',
N'HADR_TIMER_TASK', N'HADR_WORK_QUEUE',
N'KSOURCE_WAKEUP', N'LAZYWRITER_SLEEP',
N'LOGMGR_QUEUE', N'ONDEMAND_TASK_QUEUE',
N'PWAIT_ALL_COMPONENTS_INITIALIZED',
N'QDS_PERSIST_TASK_MAIN_LOOP_SLEEP',
N'QDS_CLEANUP_STALE_QUERIES_TASK_MAIN_LOOP_SLEEP',
N'REQUEST_FOR_DEADLOCK_SEARCH', N'RESOURCE_QUEUE',
N'SERVER_IDLE_CHECK', N'SLEEP_BPOOL_FLUSH',
N'SLEEP_DBSTARTUP', N'SLEEP_DCOMSTARTUP',
N'SLEEP_MASTERDBREADY', N'SLEEP_MASTERMDREADY',
N'SLEEP_MASTERUPGRADED', N'SLEEP_MSDBSTARTUP',
N'SLEEP_SYSTEMTASK', N'SLEEP_TASK',
N'SLEEP_TEMPDBSTARTUP', N'SNI_HTTP_ACCEPT',
N'SP_SERVER_DIAGNOSTICS_SLEEP', N'SQLTRACE_BUFFER_FLUSH',
N'SQLTRACE_INCREMENTAL_FLUSH_SLEEP',
N'SQLTRACE_WAIT_ENTRIES', N'WAIT_FOR_RESULTS',
N'WAITFOR', N'WAITFOR_TASKSHUTDOWN',
N'WAIT_XTP_HOST_WAIT', N'WAIT_XTP_OFFLINE_CKPT_NEW_LOG',
N'WAIT_XTP_CKPT_CLOSE', N'XE_DISPATCHER_JOIN',
N'XE_DISPATCHER_WAIT', N'XE_TIMER_EVENT')
AND [waiting_tasks_count] > 0
)
SELECT
MAX ([W1].[wait_type]) AS [WaitType],
CAST (MAX ([W1].[WaitS]) AS DECIMAL (16,2)) AS [Wait_S],
CAST (MAX ([W1].[ResourceS]) AS DECIMAL (16,2)) AS [Resource_S],
CAST (MAX ([W1].[SignalS]) AS DECIMAL (16,2)) AS [Signal_S],
MAX ([W1].[WaitCount]) AS [WaitCount],
CAST (MAX ([W1].[Percentage]) AS DECIMAL (5,2)) AS [Percentage],
CAST ((MAX ([W1].[WaitS]) / MAX ([W1].[WaitCount])) AS DECIMAL (16,4)) AS [AvgWait_S],
CAST ((MAX ([W1].[ResourceS]) / MAX ([W1].[WaitCount])) AS DECIMAL (16,4)) AS [AvgRes_S],
CAST ((MAX ([W1].[SignalS]) / MAX ([W1].[WaitCount])) AS DECIMAL (16,4)) AS [AvgSig_S]
FROM [Waits] AS [W1]
INNER JOIN [Waits] AS [W2]
ON [W2].[RowNum] <= [W1].[RowNum]
GROUP BY [W1].[RowNum]
HAVING SUM ([W2].[Percentage]) - MAX ([W1].[Percentage]) < 95; -- percentage threshold
GO


Currently CXPACKET wait stands at 63% for my server:



Wait Statistics



I referred to multiple articles on the recommendation from experts and also looked at MAXDOP suggestions by Microsoft; however, I am not really sure what should be the optimum value for this one.



I found one question on the same topic here however if I go with that suggestion by Kin then, MAXDOP should be 4. In the same question, if we go with Max Vernon, it should be 3.



Kindly provide your valuable suggestion.




Version: Microsoft SQL Server 2014 (SP3) (KB4022619) - 12.0.6024.0
(X64) Sep 7 2018 01:37:51 Enterprise Edition: Core-based Licensing
(64-bit) on Windows NT 6.3 (Build 9600: ) (Hypervisor)




Cost Threshold for Parallelism is set at 70. CTfP has been set to 70 after testing the same for values ranging from default to 25 and 50 respectively. When it was default(5) and MAXDOP was 0, wait time was close to 70% for CXPACKET.



I executed sp_blitzfirst for 60 seconds in the expert mode and below is the output for findings and wait stats:



sp_blitzfirst










share|improve this question
























  • I agree with @JaredKarney 's comment in his answer: What are you trying to fix/solve? Are you encountering bad performance? Why do you believe that a high CXPACKET wait is bad? Could you please elaborate on why your situation is different than all the other questions and answers regarding this issue?

    – hot2use
    Mar 25 at 15:42











  • @hot2use Yes, I am having performance issue and trying to see all possible aspects which could deteriorate performance. I am not expert on CXPACKET wait stats and hence wanted to have some guidance from experts.

    – Learning_DBAdmin
    Mar 25 at 17:23













8












8








8


5






I know this question has been asked number of times and also has answers to it but, I still need a bit more guidance on this subject.



Below is the details of my CPU from SSMS:



CPU



Below is CPU tab from task manager of the DB Server:



CPU Tab



I have kept the setting of MAXDOP at 2 by following below formula:



declare @hyperthreadingRatio bit
declare @logicalCPUs int
declare @HTEnabled int
declare @physicalCPU int
declare @SOCKET int
declare @logicalCPUPerNuma int
declare @NoOfNUMA int
declare @MaxDOP int

select @logicalCPUs = cpu_count -- [Logical CPU Count]
,@hyperthreadingRatio = hyperthread_ratio -- [Hyperthread Ratio]
,@physicalCPU = cpu_count / hyperthread_ratio -- [Physical CPU Count]
,@HTEnabled = case
when cpu_count > hyperthread_ratio
then 1
else 0
end -- HTEnabled
from sys.dm_os_sys_info
option (recompile);

select @logicalCPUPerNuma = COUNT(parent_node_id) -- [NumberOfLogicalProcessorsPerNuma]
from sys.dm_os_schedulers
where [status] = 'VISIBLE ONLINE'
and parent_node_id < 64
group by parent_node_id
option (recompile);

select @NoOfNUMA = count(distinct parent_node_id)
from sys.dm_os_schedulers -- find NO OF NUMA Nodes
where [status] = 'VISIBLE ONLINE'
and parent_node_id < 64

IF @NoofNUMA > 1 AND @HTEnabled = 0
SET @MaxDOP= @logicalCPUPerNuma
ELSE IF @NoofNUMA > 1 AND @HTEnabled = 1
SET @MaxDOP=round( @NoofNUMA / @physicalCPU *1.0,0)
ELSE IF @HTEnabled = 0
SET @MaxDOP=@logicalCPUs
ELSE IF @HTEnabled = 1
SET @MaxDOP=@physicalCPU

IF @MaxDOP > 10
SET @MaxDOP=10
IF @MaxDOP = 0
SET @MaxDOP=1

PRINT 'logicalCPUs : ' + CONVERT(VARCHAR, @logicalCPUs)
PRINT 'hyperthreadingRatio : ' + CONVERT(VARCHAR, @hyperthreadingRatio)
PRINT 'physicalCPU : ' + CONVERT(VARCHAR, @physicalCPU)
PRINT 'HTEnabled : ' + CONVERT(VARCHAR, @HTEnabled)
PRINT 'logicalCPUPerNuma : ' + CONVERT(VARCHAR, @logicalCPUPerNuma)
PRINT 'NoOfNUMA : ' + CONVERT(VARCHAR, @NoOfNUMA)
PRINT '---------------------------'
Print 'MAXDOP setting should be : ' + CONVERT(VARCHAR, @MaxDOP)


I am still seeing high wait times related to CXPACKET. I am using below query to get that:



WITH [Waits] AS
(SELECT
[wait_type],
[wait_time_ms] / 1000.0 AS [WaitS],
([wait_time_ms] - [signal_wait_time_ms]) / 1000.0 AS [ResourceS],
[signal_wait_time_ms] / 1000.0 AS [SignalS],
[waiting_tasks_count] AS [WaitCount],
100.0 * [wait_time_ms] / SUM ([wait_time_ms]) OVER() AS [Percentage],
ROW_NUMBER() OVER(ORDER BY [wait_time_ms] DESC) AS [RowNum]
FROM sys.dm_os_wait_stats
WHERE [wait_type] NOT IN (
N'BROKER_EVENTHANDLER', N'BROKER_RECEIVE_WAITFOR',
N'BROKER_TASK_STOP', N'BROKER_TO_FLUSH',
N'BROKER_TRANSMITTER', N'CHECKPOINT_QUEUE',
N'CHKPT', N'CLR_AUTO_EVENT',
N'CLR_MANUAL_EVENT', N'CLR_SEMAPHORE',
N'DBMIRROR_DBM_EVENT', N'DBMIRROR_EVENTS_QUEUE',
N'DBMIRROR_WORKER_QUEUE', N'DBMIRRORING_CMD',
N'DIRTY_PAGE_POLL', N'DISPATCHER_QUEUE_SEMAPHORE',
N'EXECSYNC', N'FSAGENT',
N'FT_IFTS_SCHEDULER_IDLE_WAIT', N'FT_IFTSHC_MUTEX',
N'HADR_CLUSAPI_CALL', N'HADR_FILESTREAM_IOMGR_IOCOMPLETION',
N'HADR_LOGCAPTURE_WAIT', N'HADR_NOTIFICATION_DEQUEUE',
N'HADR_TIMER_TASK', N'HADR_WORK_QUEUE',
N'KSOURCE_WAKEUP', N'LAZYWRITER_SLEEP',
N'LOGMGR_QUEUE', N'ONDEMAND_TASK_QUEUE',
N'PWAIT_ALL_COMPONENTS_INITIALIZED',
N'QDS_PERSIST_TASK_MAIN_LOOP_SLEEP',
N'QDS_CLEANUP_STALE_QUERIES_TASK_MAIN_LOOP_SLEEP',
N'REQUEST_FOR_DEADLOCK_SEARCH', N'RESOURCE_QUEUE',
N'SERVER_IDLE_CHECK', N'SLEEP_BPOOL_FLUSH',
N'SLEEP_DBSTARTUP', N'SLEEP_DCOMSTARTUP',
N'SLEEP_MASTERDBREADY', N'SLEEP_MASTERMDREADY',
N'SLEEP_MASTERUPGRADED', N'SLEEP_MSDBSTARTUP',
N'SLEEP_SYSTEMTASK', N'SLEEP_TASK',
N'SLEEP_TEMPDBSTARTUP', N'SNI_HTTP_ACCEPT',
N'SP_SERVER_DIAGNOSTICS_SLEEP', N'SQLTRACE_BUFFER_FLUSH',
N'SQLTRACE_INCREMENTAL_FLUSH_SLEEP',
N'SQLTRACE_WAIT_ENTRIES', N'WAIT_FOR_RESULTS',
N'WAITFOR', N'WAITFOR_TASKSHUTDOWN',
N'WAIT_XTP_HOST_WAIT', N'WAIT_XTP_OFFLINE_CKPT_NEW_LOG',
N'WAIT_XTP_CKPT_CLOSE', N'XE_DISPATCHER_JOIN',
N'XE_DISPATCHER_WAIT', N'XE_TIMER_EVENT')
AND [waiting_tasks_count] > 0
)
SELECT
MAX ([W1].[wait_type]) AS [WaitType],
CAST (MAX ([W1].[WaitS]) AS DECIMAL (16,2)) AS [Wait_S],
CAST (MAX ([W1].[ResourceS]) AS DECIMAL (16,2)) AS [Resource_S],
CAST (MAX ([W1].[SignalS]) AS DECIMAL (16,2)) AS [Signal_S],
MAX ([W1].[WaitCount]) AS [WaitCount],
CAST (MAX ([W1].[Percentage]) AS DECIMAL (5,2)) AS [Percentage],
CAST ((MAX ([W1].[WaitS]) / MAX ([W1].[WaitCount])) AS DECIMAL (16,4)) AS [AvgWait_S],
CAST ((MAX ([W1].[ResourceS]) / MAX ([W1].[WaitCount])) AS DECIMAL (16,4)) AS [AvgRes_S],
CAST ((MAX ([W1].[SignalS]) / MAX ([W1].[WaitCount])) AS DECIMAL (16,4)) AS [AvgSig_S]
FROM [Waits] AS [W1]
INNER JOIN [Waits] AS [W2]
ON [W2].[RowNum] <= [W1].[RowNum]
GROUP BY [W1].[RowNum]
HAVING SUM ([W2].[Percentage]) - MAX ([W1].[Percentage]) < 95; -- percentage threshold
GO


Currently CXPACKET wait stands at 63% for my server:



Wait Statistics



I referred to multiple articles on the recommendation from experts and also looked at MAXDOP suggestions by Microsoft; however, I am not really sure what should be the optimum value for this one.



I found one question on the same topic here however if I go with that suggestion by Kin then, MAXDOP should be 4. In the same question, if we go with Max Vernon, it should be 3.



Kindly provide your valuable suggestion.




Version: Microsoft SQL Server 2014 (SP3) (KB4022619) - 12.0.6024.0
(X64) Sep 7 2018 01:37:51 Enterprise Edition: Core-based Licensing
(64-bit) on Windows NT 6.3 (Build 9600: ) (Hypervisor)




Cost Threshold for Parallelism is set at 70. CTfP has been set to 70 after testing the same for values ranging from default to 25 and 50 respectively. When it was default(5) and MAXDOP was 0, wait time was close to 70% for CXPACKET.



I executed sp_blitzfirst for 60 seconds in the expert mode and below is the output for findings and wait stats:



sp_blitzfirst










share|improve this question
















I know this question has been asked number of times and also has answers to it but, I still need a bit more guidance on this subject.



Below is the details of my CPU from SSMS:



CPU



Below is CPU tab from task manager of the DB Server:



CPU Tab



I have kept the setting of MAXDOP at 2 by following below formula:



declare @hyperthreadingRatio bit
declare @logicalCPUs int
declare @HTEnabled int
declare @physicalCPU int
declare @SOCKET int
declare @logicalCPUPerNuma int
declare @NoOfNUMA int
declare @MaxDOP int

select @logicalCPUs = cpu_count -- [Logical CPU Count]
,@hyperthreadingRatio = hyperthread_ratio -- [Hyperthread Ratio]
,@physicalCPU = cpu_count / hyperthread_ratio -- [Physical CPU Count]
,@HTEnabled = case
when cpu_count > hyperthread_ratio
then 1
else 0
end -- HTEnabled
from sys.dm_os_sys_info
option (recompile);

select @logicalCPUPerNuma = COUNT(parent_node_id) -- [NumberOfLogicalProcessorsPerNuma]
from sys.dm_os_schedulers
where [status] = 'VISIBLE ONLINE'
and parent_node_id < 64
group by parent_node_id
option (recompile);

select @NoOfNUMA = count(distinct parent_node_id)
from sys.dm_os_schedulers -- find NO OF NUMA Nodes
where [status] = 'VISIBLE ONLINE'
and parent_node_id < 64

IF @NoofNUMA > 1 AND @HTEnabled = 0
SET @MaxDOP= @logicalCPUPerNuma
ELSE IF @NoofNUMA > 1 AND @HTEnabled = 1
SET @MaxDOP=round( @NoofNUMA / @physicalCPU *1.0,0)
ELSE IF @HTEnabled = 0
SET @MaxDOP=@logicalCPUs
ELSE IF @HTEnabled = 1
SET @MaxDOP=@physicalCPU

IF @MaxDOP > 10
SET @MaxDOP=10
IF @MaxDOP = 0
SET @MaxDOP=1

PRINT 'logicalCPUs : ' + CONVERT(VARCHAR, @logicalCPUs)
PRINT 'hyperthreadingRatio : ' + CONVERT(VARCHAR, @hyperthreadingRatio)
PRINT 'physicalCPU : ' + CONVERT(VARCHAR, @physicalCPU)
PRINT 'HTEnabled : ' + CONVERT(VARCHAR, @HTEnabled)
PRINT 'logicalCPUPerNuma : ' + CONVERT(VARCHAR, @logicalCPUPerNuma)
PRINT 'NoOfNUMA : ' + CONVERT(VARCHAR, @NoOfNUMA)
PRINT '---------------------------'
Print 'MAXDOP setting should be : ' + CONVERT(VARCHAR, @MaxDOP)


I am still seeing high wait times related to CXPACKET. I am using below query to get that:



WITH [Waits] AS
(SELECT
[wait_type],
[wait_time_ms] / 1000.0 AS [WaitS],
([wait_time_ms] - [signal_wait_time_ms]) / 1000.0 AS [ResourceS],
[signal_wait_time_ms] / 1000.0 AS [SignalS],
[waiting_tasks_count] AS [WaitCount],
100.0 * [wait_time_ms] / SUM ([wait_time_ms]) OVER() AS [Percentage],
ROW_NUMBER() OVER(ORDER BY [wait_time_ms] DESC) AS [RowNum]
FROM sys.dm_os_wait_stats
WHERE [wait_type] NOT IN (
N'BROKER_EVENTHANDLER', N'BROKER_RECEIVE_WAITFOR',
N'BROKER_TASK_STOP', N'BROKER_TO_FLUSH',
N'BROKER_TRANSMITTER', N'CHECKPOINT_QUEUE',
N'CHKPT', N'CLR_AUTO_EVENT',
N'CLR_MANUAL_EVENT', N'CLR_SEMAPHORE',
N'DBMIRROR_DBM_EVENT', N'DBMIRROR_EVENTS_QUEUE',
N'DBMIRROR_WORKER_QUEUE', N'DBMIRRORING_CMD',
N'DIRTY_PAGE_POLL', N'DISPATCHER_QUEUE_SEMAPHORE',
N'EXECSYNC', N'FSAGENT',
N'FT_IFTS_SCHEDULER_IDLE_WAIT', N'FT_IFTSHC_MUTEX',
N'HADR_CLUSAPI_CALL', N'HADR_FILESTREAM_IOMGR_IOCOMPLETION',
N'HADR_LOGCAPTURE_WAIT', N'HADR_NOTIFICATION_DEQUEUE',
N'HADR_TIMER_TASK', N'HADR_WORK_QUEUE',
N'KSOURCE_WAKEUP', N'LAZYWRITER_SLEEP',
N'LOGMGR_QUEUE', N'ONDEMAND_TASK_QUEUE',
N'PWAIT_ALL_COMPONENTS_INITIALIZED',
N'QDS_PERSIST_TASK_MAIN_LOOP_SLEEP',
N'QDS_CLEANUP_STALE_QUERIES_TASK_MAIN_LOOP_SLEEP',
N'REQUEST_FOR_DEADLOCK_SEARCH', N'RESOURCE_QUEUE',
N'SERVER_IDLE_CHECK', N'SLEEP_BPOOL_FLUSH',
N'SLEEP_DBSTARTUP', N'SLEEP_DCOMSTARTUP',
N'SLEEP_MASTERDBREADY', N'SLEEP_MASTERMDREADY',
N'SLEEP_MASTERUPGRADED', N'SLEEP_MSDBSTARTUP',
N'SLEEP_SYSTEMTASK', N'SLEEP_TASK',
N'SLEEP_TEMPDBSTARTUP', N'SNI_HTTP_ACCEPT',
N'SP_SERVER_DIAGNOSTICS_SLEEP', N'SQLTRACE_BUFFER_FLUSH',
N'SQLTRACE_INCREMENTAL_FLUSH_SLEEP',
N'SQLTRACE_WAIT_ENTRIES', N'WAIT_FOR_RESULTS',
N'WAITFOR', N'WAITFOR_TASKSHUTDOWN',
N'WAIT_XTP_HOST_WAIT', N'WAIT_XTP_OFFLINE_CKPT_NEW_LOG',
N'WAIT_XTP_CKPT_CLOSE', N'XE_DISPATCHER_JOIN',
N'XE_DISPATCHER_WAIT', N'XE_TIMER_EVENT')
AND [waiting_tasks_count] > 0
)
SELECT
MAX ([W1].[wait_type]) AS [WaitType],
CAST (MAX ([W1].[WaitS]) AS DECIMAL (16,2)) AS [Wait_S],
CAST (MAX ([W1].[ResourceS]) AS DECIMAL (16,2)) AS [Resource_S],
CAST (MAX ([W1].[SignalS]) AS DECIMAL (16,2)) AS [Signal_S],
MAX ([W1].[WaitCount]) AS [WaitCount],
CAST (MAX ([W1].[Percentage]) AS DECIMAL (5,2)) AS [Percentage],
CAST ((MAX ([W1].[WaitS]) / MAX ([W1].[WaitCount])) AS DECIMAL (16,4)) AS [AvgWait_S],
CAST ((MAX ([W1].[ResourceS]) / MAX ([W1].[WaitCount])) AS DECIMAL (16,4)) AS [AvgRes_S],
CAST ((MAX ([W1].[SignalS]) / MAX ([W1].[WaitCount])) AS DECIMAL (16,4)) AS [AvgSig_S]
FROM [Waits] AS [W1]
INNER JOIN [Waits] AS [W2]
ON [W2].[RowNum] <= [W1].[RowNum]
GROUP BY [W1].[RowNum]
HAVING SUM ([W2].[Percentage]) - MAX ([W1].[Percentage]) < 95; -- percentage threshold
GO


Currently CXPACKET wait stands at 63% for my server:



Wait Statistics



I referred to multiple articles on the recommendation from experts and also looked at MAXDOP suggestions by Microsoft; however, I am not really sure what should be the optimum value for this one.



I found one question on the same topic here however if I go with that suggestion by Kin then, MAXDOP should be 4. In the same question, if we go with Max Vernon, it should be 3.



Kindly provide your valuable suggestion.




Version: Microsoft SQL Server 2014 (SP3) (KB4022619) - 12.0.6024.0
(X64) Sep 7 2018 01:37:51 Enterprise Edition: Core-based Licensing
(64-bit) on Windows NT 6.3 (Build 9600: ) (Hypervisor)




Cost Threshold for Parallelism is set at 70. CTfP has been set to 70 after testing the same for values ranging from default to 25 and 50 respectively. When it was default(5) and MAXDOP was 0, wait time was close to 70% for CXPACKET.



I executed sp_blitzfirst for 60 seconds in the expert mode and below is the output for findings and wait stats:



sp_blitzfirst







sql-server sql-server-2014 configuration maxdop






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 25 at 14:22









Paul White

55.6k14292465




55.6k14292465










asked Mar 24 at 11:59









Learning_DBAdminLearning_DBAdmin

1,055219




1,055219












  • I agree with @JaredKarney 's comment in his answer: What are you trying to fix/solve? Are you encountering bad performance? Why do you believe that a high CXPACKET wait is bad? Could you please elaborate on why your situation is different than all the other questions and answers regarding this issue?

    – hot2use
    Mar 25 at 15:42











  • @hot2use Yes, I am having performance issue and trying to see all possible aspects which could deteriorate performance. I am not expert on CXPACKET wait stats and hence wanted to have some guidance from experts.

    – Learning_DBAdmin
    Mar 25 at 17:23

















  • I agree with @JaredKarney 's comment in his answer: What are you trying to fix/solve? Are you encountering bad performance? Why do you believe that a high CXPACKET wait is bad? Could you please elaborate on why your situation is different than all the other questions and answers regarding this issue?

    – hot2use
    Mar 25 at 15:42











  • @hot2use Yes, I am having performance issue and trying to see all possible aspects which could deteriorate performance. I am not expert on CXPACKET wait stats and hence wanted to have some guidance from experts.

    – Learning_DBAdmin
    Mar 25 at 17:23
















I agree with @JaredKarney 's comment in his answer: What are you trying to fix/solve? Are you encountering bad performance? Why do you believe that a high CXPACKET wait is bad? Could you please elaborate on why your situation is different than all the other questions and answers regarding this issue?

– hot2use
Mar 25 at 15:42





I agree with @JaredKarney 's comment in his answer: What are you trying to fix/solve? Are you encountering bad performance? Why do you believe that a high CXPACKET wait is bad? Could you please elaborate on why your situation is different than all the other questions and answers regarding this issue?

– hot2use
Mar 25 at 15:42













@hot2use Yes, I am having performance issue and trying to see all possible aspects which could deteriorate performance. I am not expert on CXPACKET wait stats and hence wanted to have some guidance from experts.

– Learning_DBAdmin
Mar 25 at 17:23





@hot2use Yes, I am having performance issue and trying to see all possible aspects which could deteriorate performance. I am not expert on CXPACKET wait stats and hence wanted to have some guidance from experts.

– Learning_DBAdmin
Mar 25 at 17:23










4 Answers
4






active

oldest

votes


















13














Bogus



Here's why that wait stats report stinks: It doesn't tell you how long the server has been up.



I can see it in your screenshot of CPU time: 55 days!



Alright, so let's do some math.



Math



There are 86,400 seconds in day.



SELECT (86400 * 55) seconds_in_55_days


The answer there? 4,752,000



You have a total of 452,488 seconds of CXPACKET.



SELECT 4752000 / 452488 AS oh_yeah_that_axis


Which gives you... 10 (it's closer to 9.5 if you do actual math, here).



So while CXPACKET might be 62% of your server's waits, it's only happening about 10% of the time.



Leave It Alone



You've made the right adjustments to settings, it's time to do actual query and index tuning if you want to change the numbers in a meaningful way.



Other considerations



CXPACKET may arise from skewed parallelism:




  • More on CXPACKET Waits: Skewed Parallelism

On newer versions, it may surface as CXCONSUMER:



  • CXCONSUMER Is Harmless? Not So Fast, Tiger.

Absent a third party monitoring tool, it may be worth capturing wait stats on your own:



  • Capturing wait statistics for a period of time

  • How to Capture Baselines with sp_BlitzFirst





share|improve this answer
































    10














    Wait stats are just numbers. If your server is doing anything at all then you'll likely to have some kind of waits appear. Also, by definition there must be one wait which will have the highest percent. That doesn't mean anything without some kind of normalization. Your server has been up for 55 days if I'm reading the output of task manager correctly. That means that you only have 452000/(55*86400) = 0.095 wait seconds of CXPACKET per second overall. In addition, since you're on SQL Server 2014 your CXPACKET waits include both benign parallel waits and actionable waits. See Making parallelism waits actionable for more details. I would not jump to a conclusion that MAXDOP is set incorrectly based on what you have presented here.



    I would first measure throughput. Is there actually a problem here? We can't tell you how to do that because it depends on your workload. For an OLTP system you might measure transactions per second. For an ETL, you might measure rows loaded per second, and so on.



    If you do have a problem and system performance needs to be improved I would then check CPU during times when you experience that problem. If CPU is too high then you probably need to tune your queries, increase server resources, or reduce the total number of active queries. If CPU is too low then you may again need to tune your queries, increase the total number of active queries, or there might be some wait type that's responsible.



    If you do elect to look at wait stats, you should look at them only during the period in which you're experiencing a performance problem. Looking at global wait stats over the past 55 days simply is not actionable in almost all cases. It adds unnecessary noise to the data that makes your job harder.



    Once you've completed a proper investigation it is possible that changing MAXDOP will help you. For a server of your size I would stick to MAXDOP 1, 2, 4, or 8. We cannot tell you which of those will be best for your workload. You need to monitor your throughput before and after changing MAXDOP to make a conclusion.






    share|improve this answer
































      0














      1. Your 'starting' maxdop should be 4; smallest number of cores per numa node up to 8. Your formula is incorrect.


      2. High percentage of waits for a particular type means nothing. Everything in SQL waits, so something is always the highest. The ONLY thing high cxpacket waits means is that you have a high percentage of parallelism going on. CPU doesn't look high overall (at least for the snapshot provided), so probably not a problem.


      3. Before ever trying to solve a problem, define the problem. What problem are you trying to solve? In this case, it seems you've defined the problem as high percentage of cxpacket waits, but that in and of itself is not a problem.






      share|improve this answer























      • Virtual NUMA could easily have 2 cores per numa node. Why do you claim 4 is the smallest number of cores per numa node? Can you explain what you mean?

        – Max Vernon
        Mar 25 at 15:00


















      -2














      I think the most pertinent question is...are you actually experiencing any performance issues? If the answer is no, then why are you looking for a problem when there isn't one?



      Like the other answers have said, everything waits, and all CX waits indicate is if you have queries going parallel, something I will mention is maybe you should look at what your cost threshold for parallelism is set at IF you are having issues with the queries that are going parallel ie small queries that aren't performing a lot of work going parallel and that is possibly making them run worse, not better, and large queries that should be going parallel are being delayed because of all the smaller ones that are running poorly.



      If not then, you don't have a problem stop trying to create one.






      share|improve this answer























      • Please read the question completely, cost threshold for parallelism is provided.

        – Learning_DBAdmin
        Mar 31 at 3:41











      Your Answer








      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "182"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f232943%2fmaxdop-settings-for-sql-server-2014%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      13














      Bogus



      Here's why that wait stats report stinks: It doesn't tell you how long the server has been up.



      I can see it in your screenshot of CPU time: 55 days!



      Alright, so let's do some math.



      Math



      There are 86,400 seconds in day.



      SELECT (86400 * 55) seconds_in_55_days


      The answer there? 4,752,000



      You have a total of 452,488 seconds of CXPACKET.



      SELECT 4752000 / 452488 AS oh_yeah_that_axis


      Which gives you... 10 (it's closer to 9.5 if you do actual math, here).



      So while CXPACKET might be 62% of your server's waits, it's only happening about 10% of the time.



      Leave It Alone



      You've made the right adjustments to settings, it's time to do actual query and index tuning if you want to change the numbers in a meaningful way.



      Other considerations



      CXPACKET may arise from skewed parallelism:




      • More on CXPACKET Waits: Skewed Parallelism

      On newer versions, it may surface as CXCONSUMER:



      • CXCONSUMER Is Harmless? Not So Fast, Tiger.

      Absent a third party monitoring tool, it may be worth capturing wait stats on your own:



      • Capturing wait statistics for a period of time

      • How to Capture Baselines with sp_BlitzFirst





      share|improve this answer





























        13














        Bogus



        Here's why that wait stats report stinks: It doesn't tell you how long the server has been up.



        I can see it in your screenshot of CPU time: 55 days!



        Alright, so let's do some math.



        Math



        There are 86,400 seconds in day.



        SELECT (86400 * 55) seconds_in_55_days


        The answer there? 4,752,000



        You have a total of 452,488 seconds of CXPACKET.



        SELECT 4752000 / 452488 AS oh_yeah_that_axis


        Which gives you... 10 (it's closer to 9.5 if you do actual math, here).



        So while CXPACKET might be 62% of your server's waits, it's only happening about 10% of the time.



        Leave It Alone



        You've made the right adjustments to settings, it's time to do actual query and index tuning if you want to change the numbers in a meaningful way.



        Other considerations



        CXPACKET may arise from skewed parallelism:




        • More on CXPACKET Waits: Skewed Parallelism

        On newer versions, it may surface as CXCONSUMER:



        • CXCONSUMER Is Harmless? Not So Fast, Tiger.

        Absent a third party monitoring tool, it may be worth capturing wait stats on your own:



        • Capturing wait statistics for a period of time

        • How to Capture Baselines with sp_BlitzFirst





        share|improve this answer



























          13












          13








          13







          Bogus



          Here's why that wait stats report stinks: It doesn't tell you how long the server has been up.



          I can see it in your screenshot of CPU time: 55 days!



          Alright, so let's do some math.



          Math



          There are 86,400 seconds in day.



          SELECT (86400 * 55) seconds_in_55_days


          The answer there? 4,752,000



          You have a total of 452,488 seconds of CXPACKET.



          SELECT 4752000 / 452488 AS oh_yeah_that_axis


          Which gives you... 10 (it's closer to 9.5 if you do actual math, here).



          So while CXPACKET might be 62% of your server's waits, it's only happening about 10% of the time.



          Leave It Alone



          You've made the right adjustments to settings, it's time to do actual query and index tuning if you want to change the numbers in a meaningful way.



          Other considerations



          CXPACKET may arise from skewed parallelism:




          • More on CXPACKET Waits: Skewed Parallelism

          On newer versions, it may surface as CXCONSUMER:



          • CXCONSUMER Is Harmless? Not So Fast, Tiger.

          Absent a third party monitoring tool, it may be worth capturing wait stats on your own:



          • Capturing wait statistics for a period of time

          • How to Capture Baselines with sp_BlitzFirst





          share|improve this answer















          Bogus



          Here's why that wait stats report stinks: It doesn't tell you how long the server has been up.



          I can see it in your screenshot of CPU time: 55 days!



          Alright, so let's do some math.



          Math



          There are 86,400 seconds in day.



          SELECT (86400 * 55) seconds_in_55_days


          The answer there? 4,752,000



          You have a total of 452,488 seconds of CXPACKET.



          SELECT 4752000 / 452488 AS oh_yeah_that_axis


          Which gives you... 10 (it's closer to 9.5 if you do actual math, here).



          So while CXPACKET might be 62% of your server's waits, it's only happening about 10% of the time.



          Leave It Alone



          You've made the right adjustments to settings, it's time to do actual query and index tuning if you want to change the numbers in a meaningful way.



          Other considerations



          CXPACKET may arise from skewed parallelism:




          • More on CXPACKET Waits: Skewed Parallelism

          On newer versions, it may surface as CXCONSUMER:



          • CXCONSUMER Is Harmless? Not So Fast, Tiger.

          Absent a third party monitoring tool, it may be worth capturing wait stats on your own:



          • Capturing wait statistics for a period of time

          • How to Capture Baselines with sp_BlitzFirst






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 24 at 23:43

























          answered Mar 24 at 14:24









          Erik DarlingErik Darling

          23.8k1375120




          23.8k1375120























              10














              Wait stats are just numbers. If your server is doing anything at all then you'll likely to have some kind of waits appear. Also, by definition there must be one wait which will have the highest percent. That doesn't mean anything without some kind of normalization. Your server has been up for 55 days if I'm reading the output of task manager correctly. That means that you only have 452000/(55*86400) = 0.095 wait seconds of CXPACKET per second overall. In addition, since you're on SQL Server 2014 your CXPACKET waits include both benign parallel waits and actionable waits. See Making parallelism waits actionable for more details. I would not jump to a conclusion that MAXDOP is set incorrectly based on what you have presented here.



              I would first measure throughput. Is there actually a problem here? We can't tell you how to do that because it depends on your workload. For an OLTP system you might measure transactions per second. For an ETL, you might measure rows loaded per second, and so on.



              If you do have a problem and system performance needs to be improved I would then check CPU during times when you experience that problem. If CPU is too high then you probably need to tune your queries, increase server resources, or reduce the total number of active queries. If CPU is too low then you may again need to tune your queries, increase the total number of active queries, or there might be some wait type that's responsible.



              If you do elect to look at wait stats, you should look at them only during the period in which you're experiencing a performance problem. Looking at global wait stats over the past 55 days simply is not actionable in almost all cases. It adds unnecessary noise to the data that makes your job harder.



              Once you've completed a proper investigation it is possible that changing MAXDOP will help you. For a server of your size I would stick to MAXDOP 1, 2, 4, or 8. We cannot tell you which of those will be best for your workload. You need to monitor your throughput before and after changing MAXDOP to make a conclusion.






              share|improve this answer





























                10














                Wait stats are just numbers. If your server is doing anything at all then you'll likely to have some kind of waits appear. Also, by definition there must be one wait which will have the highest percent. That doesn't mean anything without some kind of normalization. Your server has been up for 55 days if I'm reading the output of task manager correctly. That means that you only have 452000/(55*86400) = 0.095 wait seconds of CXPACKET per second overall. In addition, since you're on SQL Server 2014 your CXPACKET waits include both benign parallel waits and actionable waits. See Making parallelism waits actionable for more details. I would not jump to a conclusion that MAXDOP is set incorrectly based on what you have presented here.



                I would first measure throughput. Is there actually a problem here? We can't tell you how to do that because it depends on your workload. For an OLTP system you might measure transactions per second. For an ETL, you might measure rows loaded per second, and so on.



                If you do have a problem and system performance needs to be improved I would then check CPU during times when you experience that problem. If CPU is too high then you probably need to tune your queries, increase server resources, or reduce the total number of active queries. If CPU is too low then you may again need to tune your queries, increase the total number of active queries, or there might be some wait type that's responsible.



                If you do elect to look at wait stats, you should look at them only during the period in which you're experiencing a performance problem. Looking at global wait stats over the past 55 days simply is not actionable in almost all cases. It adds unnecessary noise to the data that makes your job harder.



                Once you've completed a proper investigation it is possible that changing MAXDOP will help you. For a server of your size I would stick to MAXDOP 1, 2, 4, or 8. We cannot tell you which of those will be best for your workload. You need to monitor your throughput before and after changing MAXDOP to make a conclusion.






                share|improve this answer



























                  10












                  10








                  10







                  Wait stats are just numbers. If your server is doing anything at all then you'll likely to have some kind of waits appear. Also, by definition there must be one wait which will have the highest percent. That doesn't mean anything without some kind of normalization. Your server has been up for 55 days if I'm reading the output of task manager correctly. That means that you only have 452000/(55*86400) = 0.095 wait seconds of CXPACKET per second overall. In addition, since you're on SQL Server 2014 your CXPACKET waits include both benign parallel waits and actionable waits. See Making parallelism waits actionable for more details. I would not jump to a conclusion that MAXDOP is set incorrectly based on what you have presented here.



                  I would first measure throughput. Is there actually a problem here? We can't tell you how to do that because it depends on your workload. For an OLTP system you might measure transactions per second. For an ETL, you might measure rows loaded per second, and so on.



                  If you do have a problem and system performance needs to be improved I would then check CPU during times when you experience that problem. If CPU is too high then you probably need to tune your queries, increase server resources, or reduce the total number of active queries. If CPU is too low then you may again need to tune your queries, increase the total number of active queries, or there might be some wait type that's responsible.



                  If you do elect to look at wait stats, you should look at them only during the period in which you're experiencing a performance problem. Looking at global wait stats over the past 55 days simply is not actionable in almost all cases. It adds unnecessary noise to the data that makes your job harder.



                  Once you've completed a proper investigation it is possible that changing MAXDOP will help you. For a server of your size I would stick to MAXDOP 1, 2, 4, or 8. We cannot tell you which of those will be best for your workload. You need to monitor your throughput before and after changing MAXDOP to make a conclusion.






                  share|improve this answer















                  Wait stats are just numbers. If your server is doing anything at all then you'll likely to have some kind of waits appear. Also, by definition there must be one wait which will have the highest percent. That doesn't mean anything without some kind of normalization. Your server has been up for 55 days if I'm reading the output of task manager correctly. That means that you only have 452000/(55*86400) = 0.095 wait seconds of CXPACKET per second overall. In addition, since you're on SQL Server 2014 your CXPACKET waits include both benign parallel waits and actionable waits. See Making parallelism waits actionable for more details. I would not jump to a conclusion that MAXDOP is set incorrectly based on what you have presented here.



                  I would first measure throughput. Is there actually a problem here? We can't tell you how to do that because it depends on your workload. For an OLTP system you might measure transactions per second. For an ETL, you might measure rows loaded per second, and so on.



                  If you do have a problem and system performance needs to be improved I would then check CPU during times when you experience that problem. If CPU is too high then you probably need to tune your queries, increase server resources, or reduce the total number of active queries. If CPU is too low then you may again need to tune your queries, increase the total number of active queries, or there might be some wait type that's responsible.



                  If you do elect to look at wait stats, you should look at them only during the period in which you're experiencing a performance problem. Looking at global wait stats over the past 55 days simply is not actionable in almost all cases. It adds unnecessary noise to the data that makes your job harder.



                  Once you've completed a proper investigation it is possible that changing MAXDOP will help you. For a server of your size I would stick to MAXDOP 1, 2, 4, or 8. We cannot tell you which of those will be best for your workload. You need to monitor your throughput before and after changing MAXDOP to make a conclusion.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Mar 24 at 15:09









                  Learning_DBAdmin

                  1,055219




                  1,055219










                  answered Mar 24 at 14:26









                  Joe ObbishJoe Obbish

                  23k43498




                  23k43498





















                      0














                      1. Your 'starting' maxdop should be 4; smallest number of cores per numa node up to 8. Your formula is incorrect.


                      2. High percentage of waits for a particular type means nothing. Everything in SQL waits, so something is always the highest. The ONLY thing high cxpacket waits means is that you have a high percentage of parallelism going on. CPU doesn't look high overall (at least for the snapshot provided), so probably not a problem.


                      3. Before ever trying to solve a problem, define the problem. What problem are you trying to solve? In this case, it seems you've defined the problem as high percentage of cxpacket waits, but that in and of itself is not a problem.






                      share|improve this answer























                      • Virtual NUMA could easily have 2 cores per numa node. Why do you claim 4 is the smallest number of cores per numa node? Can you explain what you mean?

                        – Max Vernon
                        Mar 25 at 15:00















                      0














                      1. Your 'starting' maxdop should be 4; smallest number of cores per numa node up to 8. Your formula is incorrect.


                      2. High percentage of waits for a particular type means nothing. Everything in SQL waits, so something is always the highest. The ONLY thing high cxpacket waits means is that you have a high percentage of parallelism going on. CPU doesn't look high overall (at least for the snapshot provided), so probably not a problem.


                      3. Before ever trying to solve a problem, define the problem. What problem are you trying to solve? In this case, it seems you've defined the problem as high percentage of cxpacket waits, but that in and of itself is not a problem.






                      share|improve this answer























                      • Virtual NUMA could easily have 2 cores per numa node. Why do you claim 4 is the smallest number of cores per numa node? Can you explain what you mean?

                        – Max Vernon
                        Mar 25 at 15:00













                      0












                      0








                      0







                      1. Your 'starting' maxdop should be 4; smallest number of cores per numa node up to 8. Your formula is incorrect.


                      2. High percentage of waits for a particular type means nothing. Everything in SQL waits, so something is always the highest. The ONLY thing high cxpacket waits means is that you have a high percentage of parallelism going on. CPU doesn't look high overall (at least for the snapshot provided), so probably not a problem.


                      3. Before ever trying to solve a problem, define the problem. What problem are you trying to solve? In this case, it seems you've defined the problem as high percentage of cxpacket waits, but that in and of itself is not a problem.






                      share|improve this answer













                      1. Your 'starting' maxdop should be 4; smallest number of cores per numa node up to 8. Your formula is incorrect.


                      2. High percentage of waits for a particular type means nothing. Everything in SQL waits, so something is always the highest. The ONLY thing high cxpacket waits means is that you have a high percentage of parallelism going on. CPU doesn't look high overall (at least for the snapshot provided), so probably not a problem.


                      3. Before ever trying to solve a problem, define the problem. What problem are you trying to solve? In this case, it seems you've defined the problem as high percentage of cxpacket waits, but that in and of itself is not a problem.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Mar 25 at 11:24









                      Jared KarneyJared Karney

                      952




                      952












                      • Virtual NUMA could easily have 2 cores per numa node. Why do you claim 4 is the smallest number of cores per numa node? Can you explain what you mean?

                        – Max Vernon
                        Mar 25 at 15:00

















                      • Virtual NUMA could easily have 2 cores per numa node. Why do you claim 4 is the smallest number of cores per numa node? Can you explain what you mean?

                        – Max Vernon
                        Mar 25 at 15:00
















                      Virtual NUMA could easily have 2 cores per numa node. Why do you claim 4 is the smallest number of cores per numa node? Can you explain what you mean?

                      – Max Vernon
                      Mar 25 at 15:00





                      Virtual NUMA could easily have 2 cores per numa node. Why do you claim 4 is the smallest number of cores per numa node? Can you explain what you mean?

                      – Max Vernon
                      Mar 25 at 15:00











                      -2














                      I think the most pertinent question is...are you actually experiencing any performance issues? If the answer is no, then why are you looking for a problem when there isn't one?



                      Like the other answers have said, everything waits, and all CX waits indicate is if you have queries going parallel, something I will mention is maybe you should look at what your cost threshold for parallelism is set at IF you are having issues with the queries that are going parallel ie small queries that aren't performing a lot of work going parallel and that is possibly making them run worse, not better, and large queries that should be going parallel are being delayed because of all the smaller ones that are running poorly.



                      If not then, you don't have a problem stop trying to create one.






                      share|improve this answer























                      • Please read the question completely, cost threshold for parallelism is provided.

                        – Learning_DBAdmin
                        Mar 31 at 3:41















                      -2














                      I think the most pertinent question is...are you actually experiencing any performance issues? If the answer is no, then why are you looking for a problem when there isn't one?



                      Like the other answers have said, everything waits, and all CX waits indicate is if you have queries going parallel, something I will mention is maybe you should look at what your cost threshold for parallelism is set at IF you are having issues with the queries that are going parallel ie small queries that aren't performing a lot of work going parallel and that is possibly making them run worse, not better, and large queries that should be going parallel are being delayed because of all the smaller ones that are running poorly.



                      If not then, you don't have a problem stop trying to create one.






                      share|improve this answer























                      • Please read the question completely, cost threshold for parallelism is provided.

                        – Learning_DBAdmin
                        Mar 31 at 3:41













                      -2












                      -2








                      -2







                      I think the most pertinent question is...are you actually experiencing any performance issues? If the answer is no, then why are you looking for a problem when there isn't one?



                      Like the other answers have said, everything waits, and all CX waits indicate is if you have queries going parallel, something I will mention is maybe you should look at what your cost threshold for parallelism is set at IF you are having issues with the queries that are going parallel ie small queries that aren't performing a lot of work going parallel and that is possibly making them run worse, not better, and large queries that should be going parallel are being delayed because of all the smaller ones that are running poorly.



                      If not then, you don't have a problem stop trying to create one.






                      share|improve this answer













                      I think the most pertinent question is...are you actually experiencing any performance issues? If the answer is no, then why are you looking for a problem when there isn't one?



                      Like the other answers have said, everything waits, and all CX waits indicate is if you have queries going parallel, something I will mention is maybe you should look at what your cost threshold for parallelism is set at IF you are having issues with the queries that are going parallel ie small queries that aren't performing a lot of work going parallel and that is possibly making them run worse, not better, and large queries that should be going parallel are being delayed because of all the smaller ones that are running poorly.



                      If not then, you don't have a problem stop trying to create one.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Mar 30 at 20:42









                      TheDwindlingDbaTheDwindlingDba

                      71




                      71












                      • Please read the question completely, cost threshold for parallelism is provided.

                        – Learning_DBAdmin
                        Mar 31 at 3:41

















                      • Please read the question completely, cost threshold for parallelism is provided.

                        – Learning_DBAdmin
                        Mar 31 at 3:41
















                      Please read the question completely, cost threshold for parallelism is provided.

                      – Learning_DBAdmin
                      Mar 31 at 3:41





                      Please read the question completely, cost threshold for parallelism is provided.

                      – Learning_DBAdmin
                      Mar 31 at 3:41

















                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Database Administrators Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f232943%2fmaxdop-settings-for-sql-server-2014%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                      SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                      은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현