Load Factor Settings

Load Factor Settings


  • A cache setting that specifies the default load factor to use for cached values
  • Represents memory load on the system relative to other possible loads
  • Affects the memory size estimate for each entry in each cache
  • The total size of all cached values is multiplied with this value before being added to the cache

Caching.LoadFactor Purpose

  • Sitecore cannot determine the exact amount of memory consumed by each entry in each cache so Sitecore estimates it
  • Increasing the load factor increases the estimate of the size of each entry in each cache
  • Increase the load factor to reduce the amount of memory allocated to all caches by a constant proportion

Controls featured in this example:

  • Sitecore Web Control

Classes featured in this example:

  • Sitecore.Configuration.Settings.Caching
  • Sitecore.Context
  • Sitecore.Data.Items.Item

Configuration Settings




         <setting name="Caching.LoadFactor" value="1.0"/>


C# Web Control Code

Sitecore.Data.Items.Item item = Sitecore.Context.Item;
if (item == null) return;

output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-weight:bold; width:100%; clear:both");
output.Write("C# Web Control Real-time Output");

output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-size:x-small; width:100%; clear:both");
output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-weight:bold");
//using &#58; for colon and &#63; for question mark and &#160; for space
output.Write("{0}&#58;&#160;{1}", "Item", item.DisplayName);
output.RenderEndTag(); //P

string cachingEnabled = Sitecore.Configuration.Settings.Caching.Enabled.ToString();
string loadFactor = Sitecore.Configuration.Settings.Caching.LoadFactor.ToString();
string maxLoadFactor = Sitecore.Configuration.Settings.Caching.MaxLoadFactor.ToString();

output.Write("{0}&#63;&#160;{1}", "Caching Enabled", "<b>" + cachingEnabled + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Load Factor", "<b>" + loadFactor + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Maximum Load Factor" + "<b>", maxLoadFactor + "</b>");

output.RenderEndTag(); //Div

Load Factor Settings C# Web Control Output

Caching Enabled? True
Load Factor: 1
Maximum Load Factor: 3