Cache in pega instance
Pega Platform™ uses caches to reuse information that it has already retrieved, resolved, generated, or assembled. Caching reduces repeated database interaction, rule resolution, rule assembly, declarative dependency processing, and data retrieval.
Different caches support different runtime operations. For example, the Rule Cache retains recently used rules, the Declarative Rule Cache supports declarative dependencies, and the Virtual Rules Table (VTable) Cache retains assembled rule implementations.
Cache clearing is a troubleshooting operation. Before you clear a cache, identify whether the issue concerns a rule instance, declarative dependency, node-level Data Page, conclusion type, static resource, or assembled rule implementation. After you identify the affected item, use a targeted cache-management operation.
As a Lead System Architect, you must understand the purpose of each cache, distinguish rule caching from rule-assembly caching, identify the cache that corresponds to a runtime condition, account for node-specific cache behavior, and select targeted invalidation instead of performing an unnecessary complete-cache clear.
Cache storage locations
Depending on the cache type, Pega Platform stores cached information in different locations.
- Java Virtual Machine (JVM) memory: Stores runtime cache information that requires fast access during request processing. Examples include the Rule Cache, Declarative Rule Cache, Declarative Page Cache and Virtual Rules Table (VTable) Cache.
- Database: Stores cache-related information that can be reused across system operations.
- Server file system: Stores generated static resources and other file-based cache content. The Static Content Cache is an example.
- Client file system: Stores browser-managed cache content on a user’s device.
Cache types
Pega Platform uses different cache types. Each cache supports specific runtime operations and has distinct cache-management requirements.
Rule cache
The Rule cache is an in-memory collection of recently used rules. Pega Platform maintains the cache to improve application performance by avoiding unnecessary rule resolution and database interactions. When an application requests a rule, Pega Platform retrieves the rule from the cache if it is available. If the rule is not cached, Pega Platform resolves the rule and adds it to the cache.
Declarative rule cache
The Declarative rule cache maintains dependency information that supports declarative processing. The dependency information identifies relationships among declarative rules, classes, input properties, and output properties.
Pega Platform uses this information to identify which declarative processing applies when a property value changes.
The Declarative rule cache supports dependency processing for declarative rules, including Declare Expressions and forward-chaining behavior.
Declarative page cache
The Declarative page cache maintains declarative page definitions and node-level Data Page instances. The Caches API distinguishes page definitions from node pages and includes operations that inspect or remove each type of cached information.
Data Pages provide declarative, on-demand access to application data. The Declarative page cache supports the reuse of declarative page definitions and node-level Data Page instances.
The Caches API exposes node pages through the Declarative page cache.
Conclusion cache
The Conclusion cache stores generated runtime information that is known as conclusions. Pega Platform reuses conclusions instead of repeatedly reconstructing the runtime information or retrieving its source information.
The Conclusion cache improves runtime performance by reusing generated platform metadata and resolved runtime information.
Rule assembly cache
Rule assembly caching stores assembled rule implementations so that Pega Platform can reuse executable artifacts instead of repeatedly assembling rules.
Rule assembly is the process of generating and compiling the Java code that corresponds to executable rules.
Rule assembly differs from rule caching:
- Rule caching retains recently used rules to reduce rule resolution and database interaction.
- Rule assembly generates executable artifacts that Pega Platform uses to run rules.
Pega Platform uses rule-assembly caching to store assembled rule implementations and reduce repeated assembly operations.
Pega Platform supports two rule-assembly caching models:
- VTable cache (default runtime assembly cache) -The Virtual Rules Table Cache is the default rule-assembly caching mechanism in Pega Platform. VTable caching replaces the legacy Application-Based Assembly (ABA) caching model and manages assembled rule-execution artifacts.
During system startup, Pega Platform automatically populates the VTable Cache with rules that have been statically assembled. Pega Platform adds other rules to the cache as the system assembles and uses them at run time.
The VTable Cache retains assembled rule implementations. Pega Platform can reuse these executable artifacts instead of repeatedly assembling the rules.
VTable caching replaces the legacy ABA caching model. - ABA cache (legacy predecessor to VTable) - The Application-Based Assembly Cache is a legacy rule-assembly cache that stores assembled rule implementations on a node.
ABA cache-management capabilities remain available primarily for administration, compatibility, troubleshooting, and migration scenarios.
Use VTable caching as the default rule-assembly caching mechanism. Use ABA cache-management operations only for applications or scenarios that depend on the legacy caching model.
Static content cache
The Static content cache stores generated static resources, such as CSS files, JavaScript files, and other user-interface assets. Caching these resources reduces repeated generation and retrieval of static content and improves application response times.
Cache management best practices
When managing caches in Pega Platform:
- Identify the affected cache and validate the root cause before performing cache-management operations. Use targeted cache invalidation whenever possible instead of clearing entire caches.
- Capture relevant diagnostic information before performing cache-clearing activities, especially in production environments.
- Follow established operational procedures and obtain appropriate approvals before performing broad cache-clearing activities.
- Consider the impact on all nodes in a multi-node environment when clearing or rebuilding caches.
- Back up or preserve relevant cache-related information before performing operations that can affect large portions of the cache.
- Validate application behavior after clearing or invalidating cache entries to confirm that the issue is resolved.
- Use supported cache-management APIs and platform capabilities instead of directly manipulating cache-related database tables.
Check your knowledge with the following interaction: