When you go to a restaurant and you come to know that you have to wait for a while to get your table, will you wait or will you go to another restaurant where you are aware that there is no wait time and have the same quality of food. You would prefer the second restaurant to the first. You’ve felt like buying a head set for a long time, it is one of the items in your must have list. On this intention you went to an online store and started browsing for a head set. What if that online store took 3 minutes to show the product? Will you wait for product to load or go to another web site that is much quicker than the previous one? The second site is winner here.
Faster response time on an online store has to be considered as a service provided by the online store and is important for better service to customer.
Websphere commerce addressed this faster response by introducing Dynamic Cache. Caching will maximize the performance and minimize the load on the server. Let us dive a little deeper to understand what different types of content are in an online store and high level details configuration elements.
Online stores contain static content and dynamic data. Static content consists of HTML, images, CSS and java scripts. Whereas dynamic data contains results that are retrieved from Websphere commands (from database tables ,properties and code). What is the best way to improve performance? The simplest way to ask: is the data I see online retrieved from the nearest place from the browser or it is retrieved by passing through several components? For example, when a user accesses head phones, the server sends images to the browser and it is stored in the local machine. So on the second visit, images will be displayed much faster than the first time. The nearer to the browser, the better the performance.
Application modernization is a growing area of focus for enterprises. If you’re considering this path to cloud adoption, this guide explores considerations for the best approach – cloud native or legacy migration – and more.
Websphere commerce (WC)saves every cacheable object in terms of cache id. When I access the head phones, let’s say the server requires store id and category id. WC creates a cache id with the store id and category id and saves the data in cache tables. Next time, if anyone tries to access the same product on the same store ( same store id and category id) , WC will return the data much faster from the cache by cache id.
Assume every 5 hours the image of the head phones changes. We need to determine how long we can have the present image in cache for faster response. After 5 hours this cache object will be dropped and a new cache id is created with new content. We can invalidate by time, any custom rule or dependency based. You can even invalidate cache manually.
In WC , we can cache either the full page or part of a page. For example, in the product display page, the only content that might be changing is the list of products and the price of the products. The header, footer and menu will not be changed. In this case we can cache only these three. Whereas in login, contact us page or about us page, the entire page can be cacheable.
Dynamic caching allows you to cache servlet caching i.e servlets, jsps, struts . It allows object caching, which is used to store, distribute and share java objects.
Where will we set the rules or policies to tell WC what needs to be cached? Answer is cachespec.xml. Cachespec.xml is the place where we can define the following information:
- What static/dynamic objects to cache
- On what bases WC have to cache
- When to drop the cache object
- How each Cache entry is related ( dependency cache objects might be present)
By now you understand that WC performance can be improved through caching and you understand the basics of caching. What has to be considered for designing caching for a page? To get more details on dynamic caching and configure cachespec.xml you can go through “Mastering DynaCache in Websphere Commerce”