All CS developers know that commerce server extensively uses cache to store frequently used data to scale up the application performance. CS2009 R2 inculcate same features plus few more that will help us to manage the cache effectively. This article will provide an overview of caching and in next articles we will go in depth on this topic.
CS2009 R2 supports two types of caching modes
- Push
- Pull
Push is old mechanism and still supported in R2 which can be ideally be configured in two tier architecture where presentation layer & application layer resides in the same box. R2 supports three tier architecture, so possibility of cache enabling at presentation layer and application layer. So, there is a need to get data refreshed in regular intervals of time in both layers. We have to use Pull cache mechanism where the server takes responsibility of refreshing its cache if it is out dated. Since Pull is supported in two tier & three tier topology, Microsoft strongly recommends this for cache refresh mechanism.
Note: Push or Pull mechanism can refresh data only. For any schema related refresh you need perform IISReset.
On the application tier, the Commerce Foundation operation service queries for cache refresh requests at the interval specified in configuration and clears any affected caches. On the presentation-tier, the Web application polls the connected Commerce Foundation operation service for pending cache refresh requests at the interval specified in configuration and clears the affected local caches(click here to know CS2009 R2 architecture) . Subsequent data requests refill the cache with the latest information from the database. As a developer/support analyst, you need to consider following best practices when you enable caching.
- The time on all servers to be synchronized.
- The cache refresh pooling interval should be same in all servers.
Now lets see how can you configure refresh pooling internal (pull). In your configuration file (web.config/app.config) , you can have a section for cache (as shown below)
|
<microsoft.commerce> |
Enabled attribute signifies whether to enable cache or not (default value is false). The pollinginterval is the interval in seconds at which both the presentation tier and the Foundation OperationService poll for cache refresh requests. This value can be from 1 to 86400 (default is 30) and any number not within this range will throw System.Configuration.ConfigurationErrorException. Be careful while you set this value. A high value will make the servers to have absolute data in their cache and small value will make frequent cache refresh thus using more system resources (instead of gaining performance, we started loosing performance).
If you like this post, please click on our sponsor advertisement.
