Skip to content
October 4, 2012 / kiranpatils

Basics of Sitecore full cache clearing

Challenge:

We solely rely on Sitecore caching for improving performance of our solution, and I must say Sitecore caching is really nicely developed and works best!

But before few weeks all our CD servers, suddenly started performing slow. We checked log files and found following entry on all servers:

Heartbeat 11:26:39 WARN  All caches have been cleared. This can decrease performance considerably. DEBUG entries have to
be enabled in log4net to see the corresponding stack trace.

From entry we understood that Full Sitecore cache got cleared. But the question we were having is why? What triggers Sitecore to clear full cache. Tried to search on web. But no luck! [What you also faced such issue and not found solution yet?] And this post is an outcome of it.

Solution:

To find out a root cause we can do two things:

Option 1 : Enable Caching Debugging by changing configuration and wait for issue to occur next time and find out a reason why it got cleared. Yes! you can enable detailed logging to diagnose cache clearing issues. [ALERT — If you enable this settings your log files will get increased heavily and it may affect performance a bit! But not noticeable.] Following are the steps to do it.

  • Take backup of web.config where you would like to diagnose cache clearing issues e.g. CM/PI/CD
  • Find “ <setting name=”Caching.DebugEnabled” value=”true”/>”
  • If not found then add it before “</settings>”
  • If found and value is false then set it to true.
  • log level is set to “DEBUG” on the <log4net><root><priority> node in the web.config file (as shown below):
<root>
<priority value="DEBUG" />
<appender-ref ref="LogFileAppender" />
</root>

Option 2: Analyze log files and find out what happened during that time which caused full cache clearing. We found from log files that publishing of templates was going on during that time. But through out that day lot of other publishing was also there. Then why this publish only caused full cache clearing? We opened reflector and searched for this error message and yes, as someone rightly said “A will will find a way” so as we!

We found the reason for our full cache clearing the reason was. Someone changed a field from “shared” to “unshared” and published it, which caused Sitecore to flush full cache.

So, what are other such reasons which you should be worried for? From reflector found out few methods which causes full cache clear. List of methods which calls Sitecore.Caching.CacheManager.ClearAllCaches() method are as as below:

Caller

Description

Sitecore.Caching.

CacheManager.ClearAll() : Void

Not sure, who calls this method. But /sitecore/admin/cache.aspx has button “Clear all” which should be calling this method.
Sitecore.Context.

set_ProxiesActive(Boolean) : Void

 

Not sure, how it gets called. Reflector says it has something to do with ClientData and sc_DisplayShadows variable. So, my guess would be that it is something to do with CM server.
Sitecore.Data.DataProviders.Sql.

SqlDataProvider.ChangeFieldSharing(TemplateField, TemplateFieldSharing, CallContext) : Boolean

 

If any field gets changed from “Shared” to “Unshared” and Template gets published, it clears full cache. As discussed above.
Sitecore.Data.Engines.TemplateEngine

.DataEngine_FieldSharingChangedRemote(Object, FieldSharingChangedRemoteEventArgs) : Void

Sitecore.Data.DataProviders.

Sql.SqlDataProvider.CleanupDatabase(CallContext) : Boolean

 

When you do DB cleanup via control panel
Sitecore.Data.Managers.

LanguageProvider.InvalidateCaches(Database) : Void

Not sure, But as per reflector Something to do with Language creation and deletion.
Sitecore.Data.Serialization.Manager.<.cctor>b__0(SerializationFinishedEvent) : Void Not sure, something to do with serialization
Sitecore.Diagnostics.MemoryMonitorHook.

AlarmClock_Ring(Object, EventArgs) : Void

Memory Monitor threshold and if clear full caches flag is true.

So, be aware when you do any operation from above list, it may slowdown your Sitecore instance!

Happy Sitecoring! 🙂

Advertisements

5 Comments

Leave a Comment
  1. Pradeep Shukla / Aug 2 2013 12:38 pm

    Really a good article

    • kiranpatils / Aug 3 2013 12:55 pm

      Hey Pradeep,

      Thanks for the nice words!

      Keep reading, Keep visiting!

      Kiran

  2. Rajesh / May 24 2016 3:28 am

    we found this message” All caches have been cleared. This can decrease performance considerably. ” while using revert Tree for de-serailization the content… but no idea how to over come with this issue…
    Will please share some thought on this

    • kiranpatils / May 24 2016 10:31 am

      I believe this must be an expected behavior

Trackbacks

  1. Basic ways of troubleshooting EventQueue challenges « Sitecore basics!

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

%d bloggers like this: