w3wp.exe 每个请求的 CPU 使用率都很高
我正在运行 Windows 2008 服务器(具有 1GB RAM 的 VPS),安装了 SQL Server Express 和 IIS 7。我在上面托管了一个 NopCommerce 1.7 网站,其中包含大约 26,000 个产品的数据库。
现在我是该网站的唯一用户(它正在开发中),并且我从中获得了相当糟糕的性能。更具体地说,每次我发出请求时,工作进程都会在几秒钟内达到 90-100% CPU 使用率。是我的问题还是这对于 1 个用户的 NopCommerce 网站来说已经太多了?有什么想法为什么会发生这种情况以及我可以采取哪些措施来纠正它或进一步调查?
PS:工作进程使用100MB-400MB之间的内存(私有工作集),而SQL Server使用此数据库,大约160MB。除了明显的获得更多内存的建议之外,您还有其他建议吗?我打算再增加 1 GB,但我担心这无法解决 cpu 使用问题。
I'm running a Windows 2008 server (a VPS with 1GB of RAM), with SQL Server Express and IIS 7 installed. On it I'm hosting a NopCommerce 1.7 website, with a database of around 26 000 products.
Right now I'm the only user of the website (it's in development) and I'm getting rather bad performance from it. To be more specific every time I make a request, the worker process goes to 90-100% CPU usage for a few seconds. Is it me or this is a lot for a 1 user NopCommerce website? Any ideas why this happens and what I can do to rectify it or further investigate?
PS: the worker process uses between 100MB-400MB of memory (private working set), and SQL Server with this database, around 160MB. Do you have any suggestions other then the obvious one to get more RAM? I intend to get one more GB but I fear this will not solve the cpu usage problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您已经说过您将获得更多 RAM,但是 RAM 不足会对 CPU 产生多大影响,请不要感到惊讶。如果您的 RAM 由于空间不足而无法有效地容纳大型对象(我认为使用 40% 的可用 RAM 即可),那么 CPU 必须更加努力地将内容分页进出虚拟内存。 90% 对此来说有点矫枉过正,但根据您提供的服务器规格,这并非不可能。
最可能的问题是您的代码中某处存在漏洞。我的猜测是,您要么存在无限循环,要么存在直接内存泄漏(资源在未关闭的请求期间打开?)。最好的选择是获取 IIS 调试诊断工具,安装它并设置报告以直接了解服务器上发生的情况。
You've already stated you're going to get more RAM, but don't be surprised how much a lack of RAM can impact the CPU. If your RAM is not able to hold large objects efficiently because of lack of space (and I'd say using 40% of available RAM qualifies), then the CPU has to work harder to page things in and out of virtual memory. 90% is a little overkill for this, but with the server specs you give it's not impossible.
The most likely problem is that there is a hole in your code somewhere. My guess is that you have either an infinite loop or a direct memory leak (resources open during requests that aren't closed perhaps?). Your best bet would be to get the IIS Debug Diagnostics tool, install it and set up reports to find out what is going on directly on the server.