London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
Not sure I fully understand but the current cache mechanisms in CMS and Commerce Connect are way too frequently hit to try to make them "hybrid" (in my opinion). They are only meant to be used with memory cache.
Your app will be very slow if you do that but for CMS you can set the expiration settings to 0:0:0 as described here: https://docs.developers.optimizely.com/content-management-system/docs/configuring-cms#contentoptions
I'm really interested in your use case here @Todd. Why would you want to disable cache? Is it because you want to understand database usage (i.e you think db usage is still high so you want to see how effective the cache is?)
We're running our sites in Kubernetes. We're trying to figure out why memory ramps up at pod startup and never tapers off, which is what we'd expect with a working cache. It actually gets worse. That doesn't mean we don't have a leak somewhere else, quite possible. Right now we're in the "lets see what happens" phase haha. We want to see if the cache is actually working or just doing Gets (fail), get from DB and Store (fail).
Thanks for the suggestions, we're going to play with these
VersionCacheSlidingExpiration
ContentCacheSlidingExpiration
StringCompressionThreshold
PropertyLazyLoadThreshold
MaximumVersions
Have you considered activating the cache monitor to get a sense of what's going on?
https://docs.developers.optimizely.com/content-management-system/docs/monitoring-memorycache
The thing with caching in CMS is that most immutable objects like pages and blocks will be cached (per instance) in memory after being accessed to reduce unnecessary roundtrips to the database. This cache layer is referred to as Content Cache.
If you have a load-balanced environment with let's say three instances each and one of them will hold its unique copy of the cache, any distributed cache-clearing mechanisms like the one Opti offers using MassTransit and RabbitMQ will only clear cached instances when an event is sent. This is typically done when an editor updates the content of a page. This means that the cache (Content Cache that is) will continue to grow with the number of pages being accessed, this is normal.
Here is a simple example of how what's to be expected when publishing things, IF you have the content events configured.
If you can reproduce the issue locally, running it with dotMemory attached would be a much simpler way to diagnose. otherwise, you can take memory dumps of the web app and analyze.
you can always reach out to developer support service for further assistance. We have people with expertise in that area (I will probably jump in eventually if it is escalated)
We'd like to disable or override the internal cache implementation in CMS/Commerce (latest). We're on .NET 8. We've tried implementing a null object instance cache but when trying to run the container the site is completely dead. Also, if the Optimizely internal cache was working properly, upon deployment, wouldn't we expect to see a spike in database utilization that would taper off over time?
After some digging we found some code comments on UseSharedCache. How would we go about using external token caching?
/// <summary>
/// Share the cache between all ClientApplication objects. The cache becomes static. Defaults to false.
/// </summary>
/// <remarks>
/// Recommended only for client credentials flow (service to service communication).
/// Web apps and Web APIs should use external token caching (Redis, Cosmos etc.) for scaling purposes.
/// Desktop apps should encrypt and persist their token cache to disk, to avoid losing tokens when app restarts.
/// ADAL used a static cache by default.
/// </remarks>
Here is the null object implementation we tried
public class NullObjectInstanceCache : ISynchronizedObjectInstanceCache
{
public FailureRecoveryAction SynchronizationFailedStrategy { get; set; } = FailureRecoveryAction.None;
public IObjectInstanceCache ObjectInstanceCache { get; } = new NullInnerObjectInstanceCache();
public object Get(string key) => null;
public void Insert(string key, object value, CacheEvictionPolicy evictionPolicy) { }
public void Remove(string key) { }
public void Clear() { }
public object Get(string key, Func<string, object> getter, CacheEvictionPolicy evictionPolicy)
{
return getter(key);
}
public void RemoveLocal(string key)
{
}
public void RemoveRemote(string key)
{
}
void IObjectInstanceCache.Remove(string key)
{
}
}
public class NullInnerObjectInstanceCache : IObjectInstanceCache
{
public object Get(string key) => null;
public void Insert(string key, object value, CacheEvictionPolicy policy) { }
public void Remove(string key) { }
public void Clear() { }
}