恒定的 SQL Server 80% CPU 利用率 [英] Constant SQL Server 80% CPU Utilization

查看:39
本文介绍了恒定的 SQL Server 80% CPU 利用率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在专用 VPS 上有一个小型(目前)Asp.Net MVC 5 网站.当我转到服务器并启动任务管理器时,我看到SQL Server Windows NT - 64 位"使用了大约 80% 的 CPU 和 170MB 的 RAM,而 IIS 使用了 6% 的 CPU 和 400MB 的 RAM.服务器规格是:

We have a small (for now) Asp.Net MVC 5 website on a dedicated VPS. When I go to the server and fire-up task manager, I see that "SQL Server Windows NT - 64 bit" is using around 80% of CPU and 170MB of RAM and IIS is using 6% CPU and 400MB of RAM. Server Specs are:

  • CPU 1.90Ghz 双核
  • 内存 2GB
  • Windows Server 2012
  • SQL Server Express 2012
  • 磁盘空间:25GB,2.35 免费.

数据库不是很大.它的备份小于10MB.

The database is not very big. Its backup is less than 10MB.

我已尽力优化网站.我为很多控制器添加了缓存,并为相当多的控制器实现了甜甜圈缓存.但是今天,即使只有 5 个用户在线,我们的搜索也不起作用.我在服务器上重新启动了 Windows 并开始工作,但是在服务器启动的那一刻我的 CPU 使用率很高.有趣的是,当我打开 SQL Server Management Studio 并尝试获取 CPU 消耗最高的查询的报告时,它说当前没有任何查询消耗任何 CPU !!!但同时我可以看到 SQL 服务器正在消耗大量 CPU.如何检查占用所有 CPU 的资源?下面是来自服务器的图片:

I have tried to optimize the website as much as I could. I added caching to a lot of controllers and implemented donut caching for quite a lot of controllers. But today, even though there were only 5 users online, our search wouldn't work. I restarted the Windows on the server and it started working but I got the high CPU usage the minute server started. Interestingly when I open the SQL Server Management Studio and try to get the report for top CPU-consuming queries it says that there are no queries currently consuming any CPU!!! But at the same time I can see that SQL server is consuming a lot of CPU. How can I examine what is taking all the CPU? Below is a picture from the server:

我在设计和实施网站时非常小心.所有数据库访问都是通过最新版本的实体框架.我只是想知道服务器的规格是否很低.任何帮助将不胜感激.

I was/am very careful with designing and implementing the website. All the database access is through latest version of Entity Framework. I just wonder if the server's specs are low. Any help would be very much appreciated.

这是 sp_who2 存储过程的结果.

Here's the result of the sp_who2 stored procedure.

推荐答案

我同意运行 SQL Profiler 来发现大查询持续时间和大写操作.尝试运行 perfmon 并发现任何潜在的连接泄漏(回收连接).

I would agree running SQL Profiler to spot large query durations and large write operations. Try running perfmon and spotting any potential connection leaks (reclaimed connections).

这篇关于恒定的 SQL Server 80% CPU 利用率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆