Windwos Server 2008 中经常有物理内存占用较高,但任务管理器中各进程的内存看起来占用并不多情况。

这可能是由于OS为保证服务器性能不限制系统缓存,服务器系统长时间执行I/O,系统文件缓存不断占用物理RAM造成,现在通过限制系统缓存大小来解决。具体可使用微软现已免费工具:Windows Dynamic Cache

Humm that’s a good question when we use Disks and do Read and Write Operations on them at that point there are some I/O (Input and Output Operation) Operations also generated. The Microsoft Windows Dynamic Cache Service will manage the working set size of the Windows System File Cache. For 64 bit systems this service helps to address the problem of excessive cached read I/O that could eventually consume all of physical memory.

By using this Microsoft Windows Dynamic Cache Service we can stabilize the things and initially we need to open a case with Microsoft to get it – but now its good news for us that Microsoft Windows Dynamic Cache Service for Windows Server 2008 R2. It is now freely available to download from the following link: Download Microsoft Windows Dynamic Cache Service for Free

Download:  http://aikitsupport.com/download-microsoft-windows-dynamic-cache-service-free/

具体支持的操作系统官网有详细说明:

Supported Operating System

Windows Server 2003 R2 x64 editions, Windows Server 2003 x64 editions, Windows Server 2008 Datacenter, Windows Server 2008 Enterprise, Windows Server 2008 R2, Windows Server 2008 R2 Datacenter, Windows Server 2008 R2 Enterprise, Windows Server 2008 R2 Standard, Windows Server 2008 Standard, Windows Vista 64-bit Editions Service Pack 1, Windows Vista Enterprise 64-bit edition, Windows Vista Home Basic 64-bit edition, Windows Vista Home Premium 64-bit edition, Windows Vista Ultimate 64-bit edition。 Windows Server 2003, Windows Server 2008, Windows Server 2008 R2, Windows Vista>

Details of the Files is as follows
Version: 1.0.3
Date Published: 2/21/2014
File name: DynCache.zip
File size: 1.4 MB

具体操作可参考解压后的Readme,以下FYI:

1.将解压后的文件夹中Dycache.exe copy到系统盘目录下,%SystemRoot%\System32  
  注意版本问题,DynCache\Retail\AMD64 适应64位普通X86架构系统,IA为安腾系列CPU架构使用的文件,I386对应普通X86架构32位OS。
2.执行脚本,增加Dynamic
Cache Service
sc create DynCache binpath= %SystemRoot%\System32\DynCache.exe start= auto type= own DisplayName= "Dynamic Cache
Service"
3.执行DynCache\DynCache.reg ,导入注册表
4.修改对应注册项参数/值 (MaxSystemCacheMBytes/MinSystemCacheMBytes) 
  HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DynCache\Parameters  
参数说明: 
RegValue:MaxSystemCacheMBytes
Type: REG_DWORD
Values:
0 = Limit to 90% of Physical RAM (default)  --默认虽然表示最大到物理内存90%,实际业务运行到这么大,几乎和无限制没什么区别了。
1-99 = Limit the maximum size of the System File Cache to this percentage of Physical RAM
> 200 = Limit the maximum size of the System File Cache to x Mbytes 
How this works:
This setting is the absolute maximum that the System File Cache’s working set could be set to.  The default is 0, limiting it to 90% of physical RAM with an upper limit of total Physical RAM minus 300 Mbytes.  The lower limit for absolute values is 200 Mbytes
and it must be at least 100 Mbytes greater than the MinSystemCacheMBytes value, which defaults to 100 Mbytes.

RegValue: MinSystemCacheMBytes
Type: REG_DWORD
Values:
0 = 100 Mbytes (default)
x = Limit the minimum size of the System File Cache to x Mbytes
How this works:
This setting is the minimum size of the System File Cache’s working set.  The absolute lower limit is 100 Mbytes.The service does not dynamically change this value.  

 
其他具体参数说明参考附件readme,内容如下(官网可查):
The Microsoft Windows Dynamic Cache Service will manage the working set size of the Windows System File Cache.
 For 64 bit systems this service helps to address the problem of excessive cached read I/O that could eventually consume all of physical memory.  This problem is described in this blog post:
http://blogs.msdn.com/ntdebugging/archive/2007/11/27/too-much-cache.aspx
This service will only run on Windows Server 2008 R2 or earlier versions of Windows.  Do not attempt to run this service on a version of Windows after Windows Server 2008 R2 as it will most likely cause performance problems.
The included source code and compiled executables demonstrate one example of using Microsoft Windows APIs to affect the Windows System File Cache behavior.

Installation
1) Copy DynCache.exe to %SystemRoot%\System32.
2) From a command prompt, run:
 sc create DynCache binpath= %SystemRoot%\System32\DynCache.exe start= auto type= own DisplayName= "Dynamic Cache Service"
3) Import the DynCache.reg registry file.  This registry file contains default settings that you will probably want to modify.

If you wish to uninstall this service, execute the following commands: 
sc stop DynCache
sc delete DynCache

Configuration
The Dynamic Cache Service will monitor the registry for configuration changes.  You do not need to restart the service if you change any of these settings. 
Open Regedit.exe and go to this registry location:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DynCache\Parameters

RegValue: MaxSystemCacheMBytes
Type: REG_DWORD
Values:
0 = Limit to 90% of Physical RAM (default)
1-99 = Limit the maximum size of the System File Cache to this percentage of Physical RAM
> 200 = Limit the maximum size of the System File Cache to x Mbytes
How this works:
This setting is the absolute maximum that the System File Cache’s working set could be set to.  The default is 0, limiting it to 90% of physical RAM with an upper limit of total Physical RAM minus 300 Mbytes.  The lower limit for absolute values is 200 Mbytes
and it must be at least 100 Mbytes greater than the MinSystemCacheMBytes value, which defaults to 100 Mbytes.

RegValue: MinSystemCacheMBytes
Type: REG_DWORD
Values:
0 = 100 Mbytes (default)
x = Limit the minimum size of the System File Cache to x Mbytes
How this works:
This setting is the minimum size of the System File Cache’s working set.  The absolute lower limit is 100 Mbytes.The service does not dynamically change this value.

RegValue: BackOffMBytesOnLowMemory
Type:  REG_DWORD
Values:
0 = Do not back off on low memory notification
x = Back off x MBytes for each notification.  Keep backing off until the minimum limit is reached.
How this works: 
If this value is set, the Dynamic Cache Service will register for a low memory notification.  If the available memory drops below a threshold, the Dynamic Cache Service will reduce the maximum working set size of the System File Cache by the amount defined
here (in Mbytes).  As long as available memory is below this threshold, this service will continue to reduce the maximum working set size by this amount.  Once available memory is above the threshold, the service will restore the max working set size in increments
of this amount over time.  The default low memory threshold that triggers the notification is 64 MB (if you have at least 2GB of physical RAM).  You can modify the low memory threshold by adding this registry value:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management
LowMemoryThreshold (REG_DWORD) – This value is in Mbytes

RegValue: SampleIntervalSecs
Type: REG_DWORD
Values:
0 = Do not monitor processes’ working sets.  Just set the System File Cache limits once and exit.
x = Check the processes’ working sets every x seconds.  Adjust the working set of the System File Cache accordingly.
How this works:
If this is value is defined, this service will use performance monitor counters to check the working sets of active processes.  It will adjust the size of the System File Cache’s working set accordingly.  Setting this value too low could result in more overhead
in monitoring and constant adjusting of the System File Cache’s working set.  Setting this value too high may not allow this service to adjust the working set size of the System File Cache quick enough. The example settings file DynCache.reg sets it to 60
seconds.

RegValue: CacheUpdateThresholdMBytes
Type: REG_DWORD
Values:
0 = Default to 100 Mbytes
x = Update the System File Cache limits when the new calculations change by x Mbytes.
How this works:
This value defines the minimum amount of working set size change that is required before this service will update the size of the System File Cache’s working set.  This setting is used to reduce the frequency of adjusting the System File Cache’s working set
that can be caused by small changes in process working sets.  If you use the default setting of 100 Mbytes, then the process’ working sets will need to increase or decrease by at least 100 Mbytes before this service will update the System File Cache’s working
set size.

RegKeys: <Process Image Name>
Create registry subkeys under the Parameters registry key for each process that you want to back off from.  This service will monitor the working sets of each of these processes and back off the System File Cache’s working set by their combined amount.  If
there are multiple instances of one process, the combined working sets for all instances will be used.  In essence you are trying to prioritizing the working sets for these processes to be higher than the System File Cache’s working set.  The registry file
includes 3 examples: Notepad, Microsoft SQL Server and the System.  Each process can use these additional settings.

RegValue: <Process Image Name>\AdditionalBackoffMBytes
Type: REG_DWORD
Values:
0 = No additional back off bytes for this process
x = Back off an additional x Mbytes if this process is running
How this works:
If this value is defined and this process is currently active this service will back off the process’s working set plus this additional amount.  You can use this setting as additional slack space for only when this process is running.  Multiple instances of
this process have no affect on this amount.  It is only used for the first instance of this process.

RegValue: <Process Image Name>\AdditionalBackOffCounter
Type: REG_SZ
Value:
<formatted counter string> = Whatever this counter value is, back off by that amount.
How this works:
This string needs to be a correctly formatted performance monitor string.  Refer to the SQL Server sample for an example of using an additional counter to monitor.  If this process is active, this service will use this additional counter.

SQL Server Example:
SQL Server’s process’s working set does not include the size of the database that is in physical RAM.  The SQL Server performance counter exposes a different counter that keeps track of database memory usage.  That counter is: "\SQLServer:Memory Manager\Total
Server Memory (KB)".  If this counter is defined as an AdditionalBackOffCounter for sqlservr (as provided in the default registry file), then this service will back off from SQL Server’s working set and the working set of its database.  If you want to prioritize
SQL’s (or similar application) working set over the System File Cache’s working set then you should use this counter to properly account for the memory usage of this process.
Since this service is set to start automatically and it is very light weight, it will probably start before SQL Server.  The service will attempt to query the SQL counter, but the SQL may not be fully started.  The SQL counter may return invalid numbers.  If
you use this service to monitor SQL Server, then you need to set this service’s dependency on SQL Server’s service.  This way the SQL counter will be able to query the SQL service and return valid numbers.  To set a dependency on the SQL service, go to the
following registry key and add this registry value:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DynCache\Parameters
RegValue: DependOnService
Type: REG_MULTI_SZ
Value:
MSSQLSERVER

Source Code
The source code for the Microsoft Windows Dynamic Cache Service is provided along with the compiled binaries.  In order to build this project, it is recommended that you install both the Windows Driver Kit (WDK) and the Windows Software Development Kit (SDK).
 Use the WDK build environment and add the following environment variables:
PSDK_INC_PATH – Set this to the location of the include files for the Windows SDK.
PSDK_LIB_PATH – Set this to the location of the libraries for the Windows SDK.
This project requires the Windows SDK because it uses the Performance Data Helper (PDH) library to collect performance counter data.

Troubleshooting/Verification
The debug build of this service includes debug logging of what this service is doing.  Copy the debug build of this service to your System32 folder and use DebugView (from www.sysinternals.com) to see what this service is doing.

Disclaimer
This service is experimental.  The code and compiled binary are provided as a sample.  Anyone is free to use this code in their own solution.  Please note that you may experience some performance side effects while using this service.  It cannot possibly address
all usage scenarios.  There may be some edge usage scenarios that are negatively impacted by this service.  The service only attempts to improve the situation given the current limitations.  Please report any bugs or observations to the blog (above).  While
we may not be able to fix every usage problem, we will try to offer best effort support.
 
Side Effects may include
Cache page churn - If the System File Cache's working set is too low and there is sustained cached read I/O, the memory manager may not be able to properly age pages.  When forced to remove some pages in order to make room for new cache pages, the memory manager
may inadvertently remove the wrong pages.  This could result in cached page churn and decreased disk performance for all applications.

fromhttps://blog.csdn.net/elsaleo/article/details/52997273?utm_source=copy

windows2008系统缓存修改的更多相关文章

  1. 设置windows2008系统缓存大小限制,解决服务器运行久了因物理内存耗尽出僵死(提升权限后,使用SetSystemFileCacheSize API函数,并将此做成了一个Service)

    声明: 找到服务器僵死的原因了,原因是虚拟内存设置小于物理内存. 只要虚拟内存设置为系统默认大小就不会出生僵死的现象了. 当时因为服务器内存48G,系统默认虚拟内存大小也是48G, 觉得太占硬盘空间, ...

  2. C# ASP.NET系统缓存全解析

    原文:http://blog.csdn.net/wyxhd2008/article/details/8076105 目录(?)[-] 系统缓存的概述 页面输出缓存 页面局部缓存 文件缓存依赖 数据库缓 ...

  3. Mybatis缓存(1)--------系统缓存及简单配置介绍

    前言 Mybatis的缓存主要有两种: 系统缓存,也就是我们一级缓存与二级缓存: 自定义的缓存,比如Redis.Enhance等,需要额外的单独配置与实现,具体日后主要学习介绍. 在这里主要记录系统缓 ...

  4. C# 嵌入dll 动软代码生成器基础使用 系统缓存全解析 .NET开发中的事务处理大比拼 C#之数据类型学习 【基于EF Core的Code First模式的DotNetCore快速开发框架】完成对DB First代码生成的支持 基于EF Core的Code First模式的DotNetCore快速开发框架 【懒人有道】在asp.net core中实现程序集注入

    C# 嵌入dll   在很多时候我们在生成C#exe文件时,如果在工程里调用了dll文件时,那么如果不加以处理的话在生成的exe文件运行时需要连同这个dll一起转移,相比于一个单独干净的exe,这种形 ...

  5. 性能分析(7)- 未利用系统缓存导致 I/O 缓慢案例

    性能分析小案例系列,可以通过下面链接查看哦 https://www.cnblogs.com/poloyy/category/1814570.html 前提 前面有学到 Buffer 和 Cache 的 ...

  6. linux系统下修改文件夹目录权限

    linux系统下修改文件夹目录权限 文件夹权限问题 Linux.Fedora.Ubuntu修改文件.文件夹权限的方法差不多.很多人开始接触Linux时都很头痛Linux的文件权限问题.这里告诉大家如何 ...

  7. C#系统缓存全解析(转载)

    C#系统缓存全解析 对各种缓存的应用场景和方法做了很详尽的解读,这里推荐一下 转载地址:http://blog.csdn.net/wyxhd2008/article/details/8076105

  8. Windows2008系统忘记密码的解决方法

    网上转载的,忘记密码不用发愁了.   windows2008系统忘记密码的解决方法: 利用放大镜的漏洞来重设密码 首先用系统盘来引导 选择修复计算机 然后打开命令提示符:先备份放大镜,然后用CMD替换 ...

  9. linux系统缓存机制

    http://my.oschina.net/lenglingx/blog/425258 1.缓存机制 为了提高文件系统性能,内核利用一部分物理内存分配出缓冲区,用于缓存系统操作和数据文件,当内核收到读 ...

随机推荐

  1. Arcgis API本地化

    ①将API文件夹复制到该目录下C:\Program Files\ArcGIS\Server\framework\runtime\tomcat\webapps ②打开API文件夹中的init.js文件( ...

  2. HDU2044:一只小蜜蜂...

    题目贴不上了︿( ̄︶ ̄)︿http://acm.hdu.edu.cn/showproblem.php?pid=2044 注意数据类型,用int会超范围 #include<stdio.h> ...

  3. 实验吧—密码学——WP之 古典密码

    首先我们研究题目 1.古典密码 2.key值的固定结构 3.加密方式就在谜面里 首先看到这些数字我们就能想到ASCII,而且做题多了就能看出123是{:125是},所以得到字符串如下 OCU{CFTE ...

  4. 通过阻止 touchstart 事件,解决移动端的 BUG

    在 iOS10 下,即使设置了 meta 标签的 user-scalable=no 依然不能阻止用户缩放. 解决此 BUG 的方法是阻止 PC 事件: document.addEventListene ...

  5. Go Example--Hello

    Hello world package main import "fmt" //通过import导入fmt标准包 func main() { //语句结尾不需要;分号, //Pri ...

  6. centos7安装terminator

    用惯了terminator再用系统自带的终端,发现很不习惯不能快速分屏,于是琢磨着给centos7安装terminator 方法一:rpm安装 首先,下载rpm包 wget -c http://li. ...

  7. POI导出Excel--合并单元格

    package com.test.util; import java.io.FileNotFoundException; import java.io.FileOutputStream; import ...

  8. taro 项目、代码说明

    入口文件的生命周期: 入口文件继承自 Component 组件基类,它同样拥有组件生命周期,但因为入口文件的特殊性,他的生命周期并不完整,如下 生命周期方法 作用 说明 componentWillMo ...

  9. openstack 开启 spice远程连接

    openstack 默认开的远程控制是novnc 这里是用kolla初建的openstack nova_console vi /etc/kolla/globals.yml ... # Valid op ...

  10. redis水平扩展实践,完全配置,无需代码改动

    设计思路 思路很简单,就是基于用户ID进行分库,将用户的ID字符串按照byte逐个计算ID对应的hash原值(一个数字,取绝对值,因为原始值可能过大溢出,变成负数),然后,再用这个hash原值对库的个 ...