A significant part of sql server process memory has been paged out. This may result in performance degradation

If you are using SQL Sever Server standard edition 64 bit on a Windows 2003 64bit, you will frequently encounter this problem where SQL Server says:

A significant part of sql server process memory has been paged out. This may result in performance degradation. Duration 0 seconds. Working set (KB) 25432, committed (KB) 11296912, memory utilization 0%

The number in working set and duration will vary. What happens here is SQL Server is forced to release memory to operating system because some other application or OS itself needs to allocate RAM.

We went through many support articles like:

  • 918483: How to reduce paging of buffer pool memory in the 64-bit version of SQL Server 2005
  • 905865: The sizes of the working sets of all the processes in a console session may be trimmed when you use Terminal Services to log on to or log off from a computer that is running Windows Server 2003
  • 920739: You may experience a decrease in overall system performance when you are copying files that are larger than approximately 500 MB in Windows Server 2003 Service Pack 1

But nothing solved the problem. We still have the page out problem happening every day.

The server has 16 GB RAM where 12 GB is maximum limit allocated to SQL Server. 4 GB is left to OS and and other application. We have also turned off antivirus and any large backup job. 12 GB RAM should be plenty because there's no other app running on the dedicated SQL Server box. But the page out still happens. When this happens, SQL Server becomes very slow. Queries timeout, website throws error, transactions abort. Sometimes this problems goes on for 30 to 40 minutes and website becomes slow/unresponsive during that time.

I have found what causes SQL Server to page out. File System cache somehow gets really high and forces SQL Server to trim down.

clip_image002

You see the System cache resident bytes are very high. During this time SQL Server gets much less RAM than it needs. Queries timeout at very high rate like 15 per sec. Moreover, there's high SQL Lock Timeout/sec (around 15/sec not captured in screen shot).

clip_image004

SQL Server max memory is configured 12 GB. But here it shows it’s getting less than 8 GB.

While the file system cache is really high, there’s no process that’s taking significant RAM.

clip_image006

After I used SysInternal’s CacheSet to reset file system cache and set around 500 MB as max limit, memory started to free up.

clip_image008

SQL Server started to see more RAM free:

clip_image010

Then I hit the “Clear” button to clear file system cache and it came down dramatically.

clip_image012

Paging stopped. System cache was around 175 MB only. SQL Server lock timeout came back to zero. Everything went back to normal.

So, I believe there's either some faulty driver or the OS itself is leaking file system cache in 64bit environment.

What we have done is, we have a dedicated person who goes to production database servers every hour, runs the CacheSet program and clicks "Clear" button. This clears the file system cache and prevents it from growing too high.

There are lots of articles written about this problem. However, the most informative one I have found is from the SQL Server PSS team:

http://blogs.msdn.com/psssql/archive/2007/05/31/the-sql-server-working-set-message.aspx

UPDATE - THE FINAL SOLUTION!

The final solution is to run this program on Windows Startup:

SetSystemFileCacheSize 128 256

This sets the lower and higher limit for the System Cache. You need to run this on every windows startup because a restart will undo the cache setting to unlimited.

You can run the program without any parameter to see what is the current setting.

Download the program from this page:

http://www.uwe-sieber.de/ntcacheset_e.html

Go to the end and you will get the link to the SetSystemFileCacheSize.zip

Published Wednesday, September 19, 2007 8:46 AM by omar

Comments

# re: A significant part of sql server process memory has been paged out. This may result in performance degradation

Wednesday, September 26, 2007 5:35 AM by Nick Reid

Hi Omar,

we've been dealing with this exact same problem for months now. We have a support case open with Microsoft, but everything we've tried hasn't lead to any improvement at all.

Every time something did look as though it had helped: after the reboot it would be fine for a few days, but then it would start happening again. The frustrating thing is we have another identical(!) server which has never ever had the issue.

In the sql server log I can definately see intriguing patterns, but I can't understand them. I'd like to send you an excerpt of our log so you can see them too, but that would be a bit too much to include here. Can I mail it to you? I'm nick _at_ reeleezee . com

Regards, Nick

# re: A significant part of sql server process memory has been paged out. This may result in performance degradation

Wednesday, September 26, 2007 10:53 PM by omar

Microsoft gave us a hotfix for this which upgrades SQL Server to a higher version than SQL Server SP2. This hotfix is given on case by case. I would suggest you talk to Product Support and they will investigate and give you a hot fix that suits your environment.

# re: A significant part of sql server process memory has been paged out. This may result in performance degradation

Wednesday, September 26, 2007 10:59 PM by omar

Another precaution is to limit SQL Server MAX memory to (Max RAM - 3 GB). This decreases occurrence of such page out.

SQL Server actually takes around 1.5 GB more RAM that it's set to consume in Max Memory List.

# re: A significant part of sql server process memory has been paged out. This may result in performance degradation

Thursday, September 27, 2007 10:07 AM by Tim O.

Omar,

We are also troubled with this issue and we greatly appreciate all your hard work in putting together this post.

So did the Hotfix totally resolve your issue?  What version did it bring your sql server release level too?

# re: A significant part of sql server process memory has been paged out. This may result in performance degradation

Thursday, September 27, 2007 10:37 AM by omar

SQL Server version now is:

9.00.3186.00

# re: A significant part of sql server process memory has been paged out. This may result in performance degradation

Thursday, September 27, 2007 10:37 AM by omar

Unfortunately I cannot tell you the exact hotfix. It's on NDA with MS. Besides we had to pay for it.

# re: A significant part of sql server process memory has been paged out. This may result in performance degradation

Thursday, September 27, 2007 11:17 AM by msanjuan

"What we have done is, we have a dedicated person who goes to production database servers every hour, runs the CacheSet program and clicks "Clear" button. This clears the file system cache and prevents it from growing too high."

Another option is to use ClearCache from command line and an automated task. To clear the cache you must type "ClearCache.exe -1 -1" and then "ClearCache.exe 1024 512000" to again the min/max values.

# re: A significant part of sql server process memory has been paged out. This may result in performance degradation

Thursday, September 27, 2007 11:37 AM by omar

msanjuan,

Thank you very much for the tip!

We no longer do it. Since we installed the hot fix, the problem got resolved.

# re: A significant part of sql server process memory has been paged out. This may result in performance degradation

Thursday, September 27, 2007 12:20 PM by Tim O.

Where can I download ClearCache from?

Omar, Thanks for the reply to my post earlier.

# re: A significant part of sql server process memory has been paged out. This may result in performance degradation

Friday, September 28, 2007 6:49 AM by Nick Reid

Omar,

I don't see how any Sql Server hotfix is going to solve a system-wide problem in the OS's memory management. Remember, it's not just the Sql Server process that gets trimmed, it's every process.

We were also offered several Sql Server hotfixes that gave no improvement whatsoever.

We've now been asked to wait while a fix is being tested.

In our experience, after every reboot it will at first seem that the problem has gone away, but after several days (approx. 6) the OS will start hard trimming again. I expect it to start happening again with your server just about... now.

Keep us posted!

# re: A significant part of sql server process memory has been paged out. This may result in performance degradation

Friday, September 28, 2007 8:37 AM by omar

Hi Tim,

I think the ClearCache utility solved the problem, not the SQL hotfix. However, we don't know exactly what solved it as we tried both at the same time.

It's been two weeks, no page out happened. I think the guinea pig that MS mentioned they are conducting test upon is probably us.

# re: A significant part of sql server process memory has been paged out. This may result in performance degradation

Friday, November 16, 2007 1:43 PM by Jeremy

Look at two things.

1.  Lock pages in memory local group policy set for the SQL Server service account.

2.  AWE (yes, even in 64 bit) enabled in SQL Server 2005 configuration.

# re: A significant part of sql server process memory has been paged out. This may result in performance degradation

Wednesday, January 09, 2008 4:17 AM by Russell Albert

Has anyone got a definitive fix for this? I have just started getting it on Windows Server 2003 SP2 (64-bit) with SQL 2005 SP2 (64-Bit). Also does anyone know where I can get ClearCache?

Thanks

Russell

# re: A significant part of sql server process memory has been paged out. This may result in performance degradation

Thursday, February 07, 2008 4:42 PM by Trucking Nerd

We are running into this 17890 all of a sudden on SQL 2005 SP2 as well.  We have found an interesting way to make this happen on command though.  We were humming along just fine until we created a virtual server machine and turned it on. As soon as we turn it on, SQL barfs this message.  It then repeats every so often until we turn the machine off, then the problem ceases to exist.

The virtual server is microsoft virtual server 2005 R2.  We have tried it with a couple of virtual servers, as soon as you start one, the SQL 2005 installed on the host starts puking these errors.  Wondering if anyone else has observed this as the cause for these mysterious issues?

# re: A significant part of sql server process memory has been paged out. This may result in performance degradation

Tuesday, March 25, 2008 6:49 AM by Nicola Milani

How can I obtain the sql server report that you use in this article (I intend theese one with gray background)?

Thank you, bye

# re: A significant part of sql server process memory has been paged out. This may result in performance degradation

Wednesday, June 11, 2008 4:08 PM by Bryan Hunt

Omar,

Can you tell me what utility that you used to display the performance counters in your examples above?

Thanks.

Bryan Hunt

# re: A significant part of sql server process memory has been paged out. This may result in performance degradation

Tuesday, June 24, 2008 9:25 AM by John

Omar,

Please, do you may help me, with the Clearcache.exe, file. We have now the same problem and need urgently solve this.

john_zuniga at h o t m a i l

Thanks.  

# re: A significant part of sql server process memory has been paged out. This may result in performance degradation

Wednesday, July 09, 2008 12:17 PM by Rob

As an employee with Microsoft SQL Server Support and very familiar with this issue, I want to first thank Omar for his detailed analysis.  However, this is one of many possible causes for this problem.

The bottom line: The issue is caused because the OS trims SQL Server in response to memory pressure it is dealing with. SQL Server has no control over being trimmed.  The OS controls this.

What customers should do in response to this error is to do as Omar did and look to see what is causing the OS pressure.  In this case it was clearly the System Cache, but that in no way is applicable to every situation.

# re: A significant part of sql server process memory has been paged out. This may result in performance degradation

Wednesday, July 09, 2008 12:29 PM by omar

Hi guys, the gray screenshots you see are collected from Performance Monitor. It comes with Windows.

Control Panel => Administrative Tools => Performance

Click on the + button. Now select SQL Server related categories from the dropdown and add the counters you want to monitor.

# re: A significant part of sql server process memory has been paged out. This may result in performance degradation

Wednesday, September 17, 2008 7:21 PM by Thomas

One must select Report View (Ctrl+R) to see the data in Performance Monitor as shown.

# re: A significant part of sql server process memory has been paged out. This may result in performance degradation

Wednesday, October 01, 2008 3:54 PM by RR

I am strugeling with Micorsoft since 3 weeks regarding this issue.  I am thrown between the SQL & OS team.  I have applied SP2, CU#9, KB 920739 & 953600.  Any other hints?

Leave a Comment

(required) 
(required) 
(optional)
(required)