Skip to content
October 2, 2011 / kiranpatils

Basics of MemoryMonitorHook

Challenge:

If you are walking through the log files and if you are finding following lines in log file:

4996 02:21:26 WARN  Memory usage exceeded the MemoryMonitor threshold.
4996 02:21:26 WARN  Memory usage: 4,351,668,224
4996 02:21:26 WARN  Number of suppressed logs due to the minimum time between log entries: 10

It means that your Sitecore instance is consuming more memory than the allocated threshold limit.

Now, the question may come in your mind that — can we increase it? If yes from where? What should be the ideal size?
Or if you have plenty of RAM available on your CM server and it is just hosting Sitecore site only and you are not able to see RAM size consumption more than 30-40% then this post is for you!

Solution:

It comes from Web.Config’s MemoryMonitHook configuration.
I would strongly recommend you to read http://sdn.sitecore.net/Reference/Sitecore%206/Cache%20Configuration
%20Reference.aspx
as per “The Memory Monitor “ section. It suggests following settings[Which are default one]

<hook type="Sitecore.Diagnostics.MemoryMonitorHook, Sitecore.Kernel">
<param desc="Threshold">4096MB</param>
<param desc="Check interval">00:00:05</param>
<param desc="Minimum time between log entries">00:01:00</param>
<ClearCaches>false
<GarbageCollect>false
<AdjustLoadFactor>false
</hook>

Description of tags are as follows:

  • Threshold : Threshold limit for worker process. The ideal value of this should be 60% of your available RAM
  • ClearCaches : Enabling ClearCaches would cause MemoryMonitor to completely clear all Sitecore caches.
  • GarbageCollect : GarbageCollect defines whether Sitecore will issue a forced garbage collection after clearing caches. In general, multiple forced garbage collections may decrease the performance of your application and .NET runtime is expected to perform collections automatically in a most efficient way.
  • AdjustLoadFactor : AdjustLoadFactor can be enabled for MemoryMonitorHook in order to increase calculated sizes of Sitecore caches, which results in decreasing their actual sizes by decreasing the number of entires Sitecore puts into caches. Using AdjustLoadFactor may only be required in a memory-constrained environments to prevent Out Of Memory errors, such as when running 32-bit application pool mode.

Just a note : I would highly recommend running IIS 7.5 (Windows Server 2008 R2) and 64-bit application pool mode for the optimal performance of high volume Sitecore applications.

Q. If you are seeing above given error message, then is it a reason to get worried?
Ans. This is not an error that you see in the log files, but just a warning that the Memory Monitor reports when it reaches the defined memory usage limit. You should be able to ignore the warning assuming that this is an expected memory usage of the application and if you are running a 64-bit process.

You can disable the memory monitor by setting its interval to 00:00:00, or you can increase the threshold by setting it to
e.g. 8GB.

But, even though after increasing the Threshold you are able to see this warning it means that your application is consuming lot of memory and you may need to check your code OR upgrade your RAM.

By default we had our MemoryMonitHook’s Threshold as 4096MB and due to that it was just utilizing 30-40% RAM only on our CM Server. But after increasing Threshold value to 60% of our RAM Size. Now, it is working fine.

Happy Memory Monitor Hooking! :-)

About these ads

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

Follow

Get every new post delivered to your Inbox.

Join 292 other followers

%d bloggers like this: