Memory Leak and utilization troubleshooting tools and usage!


Hello Friends, As far as I am concerned this is one of the most toughest part of my job till today. There is no perfect answer of an actual performance issues. Mostly some assumptions and correlating reports from some of the below tools give a fade view of what actually happening in terms of High CPU or memory utilization in Windows world.

Common tools I use, other than SCOM reports that mostly wont help that much, was system default or some sysinternal process and memory tools.

There were numerous reason behind every resource constraints, it can be a memory leakage, application demanding for memory or a cache. Below are the few Tools I generally use to track and find the memory and/or processor utilization

1. Perfmon : Performance and monitoring tools, we can use to check the real-time resource utilization of a server. We have Data collector set (depend on the service installed, we have few custom generated data collector set other than default system Diagnostics and System Performance)

perfmonperfmon2
2. Task Manager and Resource Monitor : Task manager is a another simple but powerful resource, resource manager (from task scheduler screen), help us track various process, memory and net work utilization to get us some idea about the cause of memory/processor utilization.

resourcemon
3. Process Explorer : Process Explorer also has a powerful search capability that will quickly show you which processes have particular handles opened or DLLs loaded. Process Explorer make it useful for tracking down DLL-version problems or handle leaks, and provide insight into the way Windows and applications work. (https://technet.microsoft.com/en-us/sysinternals/processexplorer?f=255&MSPPError=-2147217396)
4. Process Monitor : is an advanced monitoring tool for Windows that shows real-time file system, Registry and process/thread activity. (https://technet.microsoft.com/en-us/sysinternals/processmonitor)
5. RAMmap : Use RAMMap to gain understanding of the way Windows manages memory, to analyze application memory usage. This also help us clear the meta file(https://technet.microsoft.com/en-us/sysinternals/rammap.aspx?f=255&MSPPError=-2147217396)

rammap
6. VMMap : It shows a breakdown of a process’s committed virtual memory types as well as the amount of physical memory (working set) assigned by the operating system to those types (https://technet.microsoft.com/en-us/sysinternals/vmmap)

vmmap
7. Handle v4.1 : Is a command-line utility, same Like Process explorer. Handle is a utility that displays information about open handles for any process in the system. You can use it to see the programs that have a file open, or to see the object types and names of all the handles of a program.(https://technet.microsoft.com/en-us/sysinternals/handle)

For us one of the recent high memory utilization isolated to meta file, this server process millions of tiny files everyday as part of server operation.

used below command to gather the working set and its owner, the interesting fact was the sum of this is not matching with the total memory utilization.

Get-WmiObject win32_process -filter “name = ‘cscript'”| Select-Object Name,@{n=’Owner’;e={$_.GetOwner().User}}, WS | sort name

Later we used VMmap and RAM map analyse the memory utlization on each process. Interesting fact was! it was not a memory leak but system cache causing this issue. around 6 GB of meta files caused the memory utilization to 90% always!..

Solution to this was setting system cache to some percentage using DynCache (https://www.microsoft.com/en-us/download/details.aspx?id=9258), Prococes as show below

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”
This will create a Service that take care of system cache cleaning
3) Import the DynCache.reg registry file.
4) Modify MaxSystemCacheMBytes to “2024” (alternatively you could use % of memory. Any value below 90, consider as %. For example if you set 60 for this key, up to 60% of the memory would be alocated to store system cache. )
5) Start sc start DynCache

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

Continued…

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s