WebSphere Commerce Cache Technology
Introduction
In the previous chapters, the "slimming" aspect of network traffic has been suggested to improve product performance. This section will focus on the caching provided in the WebSphere Commerce product to improve product performance.
Cache technology has become increasingly important in today's Internet applications, especially for enterprise-class e-business applications such as WebSphere Commerce. The main reason is of course, in a certain hardware topology and configuration conditions, the site visited the most frequent pages and objects cache to fully improve the performance of the server, so that the page access is very fast, improve the user experience.
But caching technology is like a double-edged sword, with good, can achieve the expected high performance, not good, not only improve performance, but will lead to performance degradation, and even cause serious data inconsistency problem.
Dynamic caching, as a means of performing high performance, requires as much as other product designs to be considered as early as possible throughout the life cycle of a product or project. It is often difficult to expect dynamic caching to solve problems if performance is not met in the late performance testing phase.
Cache Overview
The core idea of dynamic caching is reuse. In the design architecture of a typical WebSphere Commerce enterprise application, as shown in Figure 1, from the database side, the application server, the Web server, the network cache provided by the Third-party service provider (edge caching), and the browser itself cache, we can see that the cache is everywhere. You can see that the closer the cache is to the customer, the better the cache will be (faster), but the greater the cost of cache expiration refreshes. The product architect needs to consider and grasp the caching strategy of the system as a whole.
This article no longer details browser caching and edge caching (common for CDN caching), mainly about the caching and best practices offered in WebSphere Commerce products.
Figure 1. A typical WebSphere Commerce system architecture
In the WebSphere Commerce application, we are using the WebSphere caching mechanism (Dynacache) provided by WebSphere application Server to divide commonly used cache content into the following types:
Servlet/jsp the content cache, caching the entire page or page fragment (Fragment) produced by a servlet or JSP.
Command cache, which caches commands, EJBS, and WebService return objects.
Data cache, caching database query results. The underlying mechanism of dynamic caching is implemented through distributed MAP.
Fragment (fragment) cache
In the actual system, the pages are generally more complex, a page has relatively stable information, and dynamic changes or personalized information. Figure 2, the head sidebar, the mini shopping cart, the comparison tool, and other clips on the page can be reused. In this case, we would divide an entire page into several different fragments for caching, and the "Do-not-consume" attribute could make a fragment separate from the entire page and be cached separately. So that the cache object and the maximum degree of reuse of the page, thereby reducing server-side load, to improve system performance.
Figure 2. Page Fragment sample