Install > Installing or enabling additional software > Configure Social Commerce
Configure Social Commerce performance using disk caching
Social Commerce assets benefit from the caching provided by IBM HTTP Server. The IBM HTTP Server (IHS) supports disk caching using the mod_disk_cache module. Follow the instructions on this page to enable and configure disk caching with Social Commerce.
Before you begin
Configure Social Commerce
Procedure
- Enable the mod_disk_cache module:
- Open the Web server httpd.conf file in a text editor.
- Add the following directives to the file:
LoadModule cache_module modules/mod_cache.so
LoadModule disk_cache_module modules/mod_disk_cache.so
- Create a cache directory for the IBM HTTP Server disk cache.
The cache directory must have:
- Read and write permissions set for the user account under which IHS is running
- Space on the file system to allow the cache to grow to its maximum size.
For example, the following commands create a sample directory, cacheroot, on an AIX, Linux or Solaris operating system:
% mkdir /opt/WebSphere/HTTPServer/cacherootRefer to the operating system documentation for more information on creating directories and directory permissions.
% chown nobody /opt/WebSphere/HTTPServer/cacheroot
- Add the caching directives to the VirtualHost elements for port 80 and port 443:
- Open the Web server httpd.conf file in a text editor.
- Find the caching directives for Virtualhost elements in the file for port 80 and 443. These elements will start and end with tags similar to the following examples:
<VirtualHost myserver.myhost.com:80> </VirtualHost>
<VirtualHost myserver.myhost.com:443> </VirtualHost>The following sample directives identify the location of the disk cache and specify that caching should be enabled for Social Commerce request URIs identified by the /soccom context root. The mod_cache module will examine the HTTP response headers to identify responses that can be cached according to the HTTP 1.1 specification.
CacheRoot /opt/WebSphere/HTTPServer/cacheroot
CacheEnable disk /soccom
CacheLastModifiedFactor 0.5
CacheIgnoreNoLastMod On
CacheIgnoreHeaders Set-CookieTips: The following links are helpful when configuring IBM HTTP Server performance:
- Additional documentation on configuring caching rules for the IBM HTTP server: Apache module mod_cache
- Additional documentation on the specifics of disk caching: Apache module mod_disk_cache
- Refer to the htcacheclean documentation to periodically to remove cache entries to limit the size of the cache: htcacheclean - Clean up the disk cache
- Configure the cache expiration times as needed. Dynamic content from Social Commerce is served with two cache control directives, s-maxage and max-age.
To use these two cache control directives:
- Edit...
- WC_INSTALL/components/social-commerce/config/adapter.config
- By default max-age is set to 300 seconds and s-maxage is set to 1400 seconds. These values are configurable using the two configuration settings in the adapter.config configuration file. The two default values are shown in the following example:
# Set the Cache-Control directive max-age
/config/soccom/cache/cacheExpiration = 180
# Set the Cache-Control directive s-maxage
/config/soccom/cache/sharedCacheExpiration = 1440
- Run the following command whenever you have made changes to the adapter.config file:
config_ant.sh -DinstanceName=instance -buildfile ../components/common/xml/enableFeature.xml -DfeatureName=social-commerce UpdateAdapterConfig