Why does my .NET application generate so many page errors?

I have a 64-bit .NET console application that basically reads messages from MSMQ and then processes them, communicating with the SQL server through .NET SqlClient. Most of the time it works fine, but from time to time it goes into a state where everything, even the simplest operations, such as creating an array of SqlCommand parameters, does not work correctly. In the worst case, the application does nothing for 30 minutes at a time (nothing is written to the logs, and it is rather talkative with a detailed mode), then it will start writing again, without indicating what caused the delay. This seriously affects the usability of our product.

I spent the last few hours looking at each performance counter, etc., and everything indicates excessive reading of pages - because of this, it maximizes on disk I / O, I see that my process is constantly being heavily read from the swap file. sys etc. But I have no idea why, since the total memory usage for the application is much lower than the available RAM: the working set is 60 M, the total fixing size is 300 M (high and corresponding peak working set - not sure why this is), but this peanut is compared with the existing 12 GB of RAM, of which very little is used.

I read every MS document on monitoring application performance, etc., but everything just indicates that "my application needs more memory." Well ... since it gives him more memory - he doesn't use anything else! Now there is a separate problem, which, given what the application does, does not really need so much memory, but the efforts that would be required for this are probably not worth the cost of additional equipment.

One more note: if I run a second instance of the same application, it seems to be working fine. Thus, this is clearly not a system-wide problem.

I saw several similar posts here on stackoverflow, but not very useful answers yet ... hoping for more luck than previous posters.

+4
source share
2 answers

Page errors in the task manager mean accessing the page file on the disk, which by default is 1.5 times the amount of RAM installed by you. This is not necessarily bad, it just tells you where the data is. You can disable the swap file to see this number at 0.

Have you looked at the performance and counters of the products you depend on, such as SQL Server or MSMQ? Have you tried memtest86 to check your ram?

0
source

I had the same problem. In my experience, when you have intense applications that are β€œalways on”; they should be placed in a Windows service, not in a console application.

This suggests that this could be a problem with the Garbage Collection.

Add this to your configuration file:

<runtime> <gcServer enabled="True"/> </runtime> 

You need to put it in the node configuration.

In my experience, this will result in the application having fewer PageFault files and a larger working set.

There is no silver bullet. Without code, there is no way to know if your code is leaking in memory; which could be another reason for existential swapping.

0
source

All Articles