简体   繁体   English

重新启动或群集故障转移后SQL Server Extreme缓慢

[英]SQL Server Extreme slowness after reboot or fail-over of cluster

I have a SQL Server 2008 R2 SP1 cluster with 2008 OS. 我有一个带有2008 OS的SQL Server 2008 R2 SP1集群。 Any time a reboot happens or a failover happens the next several days any processing is extremely slow; 任何时候发生重新启动或发生故障转移,接下来的几天任何处理都非常缓慢; however if we leave them running they run much better. 但是如果我们让它们继续运行它们会跑得更好。 I have been researching the possibility when the procedure cache is flushed then with all the plans needing to be rebuilt this is causing the slowness instead of being able to go to memory for the existing plan. 我一直在研究过程缓存被刷新然后需要重建的所有计划的可能性,这导致缓慢而不是能够为现有计划进入内存。 Has anyone else experience this and what did you do to resolve so a reboot would not affect the system so negatively? 有没有其他人经历过这个以及你做了什么来解决所以重启不会对系统造成负面影响?

One thing you can do is monitor your most resource intensive queries after the procedure cache is flushed. 您可以做的一件事是在刷新过程高速缓存后监视资源最密集的查询。 Once you ID what queries are taking a long time reading from disk to get put back into the buffer pool, you can schedule a job to spin up those queries immediately after the reboot so when the first user goes to execute it, it is already in the buffer pool and will read from memory instead of disk. 一旦你识别了什么查询需要花费很长时间从磁盘读取以放回缓冲池,你可以安排一个作业在重新启动后立即启动那些查询,所以当第一个用户去执行它时,它已经在缓冲池,将从内存而不是磁盘读取。 Here is a query to find I/O intensive queries after your reboot: 以下是重新启动后查找I / O密集型查询的查询:

SELECT TOP 25 cp.usecounts AS [execution_count]
      ,qs.total_worker_time AS CPU
      ,qs.total_elapsed_time AS ELAPSED_TIME
      ,qs.total_logical_reads AS LOGICAL_READS
      ,qs.total_logical_writes AS LOGICAL_WRITES
      ,qs.total_physical_reads AS PHYSICAL_READS 
      ,SUBSTRING(text, 
                   CASE WHEN statement_start_offset = 0 
                          OR statement_start_offset IS NULL  
                           THEN 1  
                           ELSE statement_start_offset/2 + 1 END, 
                   CASE WHEN statement_end_offset = 0 
                          OR statement_end_offset = -1  
                          OR statement_end_offset IS NULL  
                           THEN LEN(text)  
                           ELSE statement_end_offset/2 END - 
                     CASE WHEN statement_start_offset = 0 
                            OR statement_start_offset IS NULL 
                             THEN 1  
                             ELSE statement_start_offset/2  END + 1 
                  )  AS [Statement]        
FROM sys.dm_exec_query_stats qs  
   join sys.dm_exec_cached_plans cp on qs.plan_handle = cp.plan_handle 
   CROSS APPLY sys.dm_exec_sql_text(cp.plan_handle) st
ORDER BY qs.total_physical_reads DESC;

Rebuilding plan most probably would not be the problem. 重建计划最有可能不是问题。 I see simmilar behaviour on our system, problem is HDD array. 我看到我们系统上的simmilar行为,问题是HDD阵列。 I tested if we could move to SSD it would speed up cold start queries more than 10x. 我测试过,如果我们可以转移到SSD,它将加速冷启动查询超过10倍。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM