首页 > 编程语言 >Asp.net: sometimes OutOfMemoryException when many w3wp processes run

Asp.net: sometimes OutOfMemoryException when many w3wp processes run

时间:2023-02-09 23:12:43浏览次数:62  
标签:processes Asp run Windows 2018 memory 2016 GB

Asp.net: sometimes OutOfMemoryException when many w3wp processes run

Ask Question Asked 4 years, 11 months ago Modified 4 years, 11 months ago I have an interesting problem with how Windows and .Net manage memory for Asp.Net applications that I can't explain myself. The problem is that I have a big Asp.Net application that after starts up can take about 1 GB memory according Resource Manager. We tried to test how many instances of the application we can run at the same time on a single machine with 14-16 GB memory.

First test is with an Azure Windows 2016 server with 8 vCPUs, 14 GB RAM, HDD.

After a few instances:

enter image description here

After 30 instances:

enter image description here

As you can see, private byes and working set of some instances reduced a lot. Based on what I read from how memory is managed (aka working set, physical memory, virtual memory, page files...), I can understand how the OS can take physical memory away from some idle processes for the others that are in need. So far so good.

Then we tested the same scenario with another Azure Windows 2016 server with 4 vCPUs, 16 GB RAM, but this one uses SSD.

After about 20 instances, we got OutOfMemoryException:

enter image description here

The key difference I could see is that memory of all those w3wp processes were still high. In other words, they were not reduced as in the test above.

My question is why the behaviors were different? What prevented the second cases from saving memory to page file (my guess!) and thus caused OutOfMemoryException?

  asked Feb 13, 2018 at 10:55 Thuan's user avatar Thuan 1,60811 gold badge1010 silver badges2121 bronze badges
  • 1 Have you verified that the server has a pagefile? Perhaps someone has disabled it.  – sisve  Feb 13, 2018 at 11:43
  •   Thank you, it is a pagefile problem :) It was still enabled, but somehow when SSD is used Windows doesn't page memory to file using that default setting. We had to change it from managed by Windows to a fixed pagefile size, e.g. 20 GB and things started working as we expected.  – Thuan  Feb 15, 2018 at 15:57
Add a comment

1 Answer

Checking pagefile setting showed us that it was stilled enabled in "System managed size" mode but somehow Windows refused to use it for the w3wp processes. We tried to change it to custom size and set it to 20 GB and everything started working again as expected. I must admit that I still don't know why Windows 2016 behaves like that when SSD is used though.

  answered Feb 15, 2018 at 16:03 Thuan's user avatar Thuan 1,60811 gold badge1010 silver badges2121 bronze badges
  •   Thuan, I am running into the same problem on a non-Azure Windows 2016 server (no SSDs) Hyper-V VM. My pagefile is set to "System managed size" with plenty of disk space and memory. The 2016 config seem to be exactly the same as my 2012 R2 web servers, but in the 2016 server the page file is not growing. Either that or the w3wp processes are refusing to use the page file as you described. I solved this temporarily by changing the "Idle timeout action" from suspend to terminate so that low traffic sites don't get paged out to disk. Any chance you made further progress on this?  – John  Mar 23, 2018 at 13:46
  •   @john The only thing I tried and worked for me was to change paged file mode to "Custom size". Other than that, I don't know what else could work :)  – Thuan  Mar 24, 2018 at 10:41

标签:processes,Asp,run,Windows,2018,memory,2016,GB
From: https://www.cnblogs.com/ioriwellings/p/17107443.html

相关文章

  • Troubleshoot Out of Memory issues In ASP.Net
    Learn Troubleshoot WebApps ASP.NET TroubleshootOutofMemoryissues(System.OutOfMemoryException)inASP.NETArticle01/25/20227minutestorea......
  • ASP.NET Core+Element+SQL Server开发校园图书管理系统(完)
    随着技术的进步,跨平台开发已经成为了标配,在此大背景下,ASP.NETCore也应运而生。本文主要基于ASP.NETCore+Element+SqlServer开发一个校园图书管理系统为例,简述基于MVC三......
  • 【Java面试】Runnable和Thread比较
    在线程使用过程中,我们肯定会用到Runnable与Thread,前者的实现方式是实现其接口即可,后者的实现方式是继承其类。两者实现方式带来最明显的区别就是,由于Java不允许多继承,因此......
  • Qt多线程编程之QThreadPool 和 QRunnable使用
     说到线程通常会想到QThread,但其实Qt中创建线程的方式有多种,这里主要介绍其中一种QRunnable,QRunnable和QThread用法有些不同,并且使用场景也有区别。要介绍QRunnable的用......
  • kettle 报错 org.owasp.encoder
    在生成xml时候需要对密码加密处理也可以注释StringtransXml=transMeta.getXML();maven<dependency><groupId>org.owasp.esapi</groupId>......
  • SQLSERVER 的 truncate 和 delete 有区别吗?
    一:背景1.讲故事在面试中我相信有很多朋友会被问到truncate和delete有什么区别,这是一个很有意思的话题,本篇我就试着来回答一下,如果下次大家遇到这类问题,我的答案应......
  • vasp如何设置K点
    转载自:https://blog.shishiruqi.com//2019/04/25/kpoints/VASP的KPOINTS文件在VASP5.1.12以上版本中,KPOINTS文件可以缺省,k点信息写在INCAR里,但是不建议这么做:一是因为I......
  • ASP+VML制作统计图的源程序
    此程序只能用IE浏览器浏览,根据下面的源程序,我们只是略做修改结合数据库就能实际应用到一些系统中。示例:1、直方图    2、饼图   3、曲线图一、统计图--直方图<script......
  • ASP.NET Core — IStartupFilter 与 IHostingStartup
    1.IStartupFilter  上面讲到的方式虽然能够根据不同环境将Startup中的启动逻辑进行分离,但是有些时候我们还会可以根据应用中的功能点将将一系列相关中间件的注册封装到......
  • ASP.NET Core—入口文件
    1.入口文件  一个应用程序总有一个入口文件,是应用启动代码开始执行的地方,这里往往也会涉及到应用的各种配置。当我们接触到一个新框架的时候,可以从入口文件入手,了解入......