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.

转载于:https://www.cnblogs.com/marklove/p/9688127.html

windows2008系统缓存修改相关推荐

  1. 教你从0到1搭建秒杀系统-缓存与数据库双写一致

    本文是秒杀系统的第四篇,我们来讨论秒杀系统中缓存热点数据的问题,进一步延伸到数据库和缓存的双写一致性问题. 在秒杀实际的业务中,一定有很多需要做缓存的场景,比如售卖的商品,包括名称,详情等.访问量很大 ...

  2. 17 | 案例篇:如何利用系统缓存优化程序的运行效率?

    上一节,我们学习了内存性能中 Buffer 和 Cache 的概念.简单复习一下,Buffer 和 Cache 的设计目的,是为了提升系统的 I/O 性能.它们利用内存,充当起慢速磁盘与快速 CPU ...

  3. Linux清除系统缓存释放内存命令介绍

    1. drop_caches 在Documentation/sysctl/vm.txt中有如下描述: drop_caches:Writing to this will cause the kernel ...

  4. C#net6实现Linux系统下修改IP地址、修改系统时间、获取内存信息、获取磁盘信息、重启系统

    C#net6实现Linux系统下修改IP地址.修改系统时间.获取内存信息.获取磁盘信息.重启系统 背景 项目背景 实现思路 代码实现 背景 随着微软.net core的出现,C#程序实现跨平台不在困难 ...

  5. Linux 下清理系统缓存并释放内存

    当在Linux下频繁存取文件后,物理内存会很快被用光,当程序结束后,内存不会被正常释放,而是一直作为caching 因此我们很有必要手动清理系统缓存释放内存. 我们在清理缓存前应该先 sync下 因为 ...

  6. 游戏开发jenkins杂谈系列:windows系统下修改系统时间触发Build periodically设置的定时任务,往前调时间但不再执行定时任务的解决办法

    网上搜了一堆帖子,没有讲到我遇到的这个问题的: windows系统下修改系统时间执行定时任务,例如任务在2020.11.18. 20:36分已经触发了,我将时间调回至2020.11.17 20:35, ...

  7. Laravel之路——file缓存修改为redis缓存

    1.Session: 修改.evn文件: SESSION_DRIVER:redis (如果还不行的话,修改config/session.php的driver) 2.缓存修改为redis 注意:使用 L ...

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

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

  9. XP系统限制修改IP有新招

    笔者于2007年2月<网管员世界>AB合刊上看到"限制修改IP一招"一文,很是激动.因为作为网管,单位的几十台机器(可能个别仁兄面对的是上百台)几乎每天都有问题,有好多 ...

  10. 你需要来自trustedinstaller的权限才能删除_windows10 系统怎么修改文件权限

    Windows10系统在修改.删除.重命名系统级文件时,很可能会遇到提示"你需要权限能才能执行此操作",这个问题我们需要修改下这个文件的权限就可以操作了. 下面是怎么修改系统文件权 ...

最新文章

  1. jenkins 插件执行shell命令时,提示“Command not found”处理方法
  2. ffmpeg流文件合并concat
  3. 通信工程专业的一些小知识点
  4. 信息学奥赛C++语言:三位数的求和
  5. django-模态框添加学生
  6. [转】Python--遍历列表时删除元素的正确做法
  7. 微信小程序区分分享到群和好友
  8. nginx 学习记录:IP+端口号配置网站、隐藏端口号、自签名证书配置Https、强制Https、自定义404
  9. (转)DPDK内存管理 02 -----初始化
  10. 最大公约数(欧几里得算法)
  11. UOJ220 [NOI2016] 网格 【割顶】【并查集】
  12. Linux 服务器后台运行.jar程序
  13. 深度残差网络+自适应参数化ReLU激活函数(调参记录2)
  14. 关于申请博客园开通博客功能
  15. win7为什么安装不了python_【如何在win7下安装Python及配置】电脑无法安装python
  16. Unity Shader学习记录(6) —— 高光反射光照模型和内置计算函数
  17. 连接数据库SSL警告: Establishing SSL connection without server’s identity verification is not recommended.
  18. 信息类专业国际会议/期刊影响因子汇总
  19. 软件质量保证与测试实验(实验三.逻辑覆盖测试用例设计)
  20. lcs算法c语言代码,LCS算法

热门文章

  1. 两个摄像头合成一路_64个高空抛物摄像头安装到位 同德社区居民双手点赞
  2. Git使用教程:最详细、最傻瓜、最浅显、真正手把手教!(又一篇万字长文)...
  3. 在你公司Code Review是一种形式,还是一种开发文化?
  4. python发送邮件程序
  5. php 打乱数组的顺序,php数组打乱顺序
  6. java ajax传值到后台_java ajax发送数据到后台,中文乱码
  7. deepin桌面为什么那么卡_UOS/Deepin桌面卡死该怎么办
  8. 诸葛io的技术架构图_阿里P8总结三面四轮技术面试:Tomcat+Redis+线程池锁+悲观锁+NIO...
  9. 中心极限与大数定理律的关系_中心极限定理的最最通俗解释
  10. android 工具 lve,Android Studio 4.0 新功能中的Live Layout Inspector详解