“It does not work? Refresh the Cache!”. Architecture and caching process in SAP PI 7.4
Today is a good day to talk about such thing as a cash.. Oh no, sorry, I mean “cache” – not a money, unfortunately. 🙂
What is Cache?
Cache (from the French. cacher – «hide”, pronounced [kæʃ] – «cache”) – an intermediate buffer with fast access containing information that may be requested with the highest probability. Accessing data in the cache is faster than the original sampling data from the slower memory, or a remote source, but its volume is considerably limited as compared with the initial data storage.
There is a standard “highly professional” comment on any issue in the SAP PI – “Update the cache.” Indeed, it is often helpful. Why?
I assume that in times then the architecture of SAP PI was developed, the developers team had two problems:
- Split the development environment and already working interface objects, give developer an opportunity to change the interface without affecting productive work.
- Given the number of different components of SAP XI / PI – establish interaction between them, taking the performance into account.
Most likely, the idea was to use the “cache” as an intermediate storage for all interface objects.
Overall caching scheme in the PI looks like this:
Pic. 1: Cache architecture in SAP PI
How it works?
Update of the cache is starting automatically after object activation took place in the ESR or Integration Directory; the process of update can also be initiated manually.
When object activation occurs in Enterprise Service Repository – PI takes the following sequence of actions:
- collects all related and linked objects, which also needs to be updated;
- Notification Service (Cache Refresh Notification Service) provides information on the required update to the Integration Directory;
- Searching of all linked and relevant objects in the Integration Directory;
- Notification Service (Cache Refresh Notification Service) sends all collected objects to “consumers” – various cache mechanisms in PI.
“Consumers” are the following cache mechanisms:
- Mapping cache – storage for ready (compiled) mapping programs;
- CPA cache – all development objects and settings for interface execution in Advanced Adapter Engine;
- Integration Engine cache – all design and customization objects required required for interface execution in Integration Engine; here are also stored all the objects needed for ccBPM runtime;
- Business System cache – cache of SAP business system (ABAP) connected to PI; it contains all necessary interface objects for proxy and web-service interfaces.
In addition to the chain, there is SLD-caches in the ESR and Integration Directory:
- SLD-cache in the ESR is updated whenever the developer imports the new software component.
- SLD-cache in the ID is updated when the developer imports the business system.
SLD-caches can also be forced to update.
Monitoring and Administration.
There are a number of tools to monitor the status and contents of the cache mechanisms in PI, as well as for manual cache updates.
The first tool is a part of the administration tools located on the home page of PI:
Select the tab “Repository”, a group of instruments “Lock and Cache Administration”, the tool “Java Virtual Machine Cache”.
As you can see, virtual machine has several different cache mechanisms. We are particularly interested in the SLD cache. On this page we can force an update the cache manually by clicking “Refresh Selected Caches”.
You can also use “Data Cache” in the same group of tools:
Pic.4: CPACache Update.
Pic.5: Mapping Cache update
You can force an update of CPACache and Mapping Cache here. When you click on the link “Refresh” next to the appropriate cache mechanism – PI will open the page of update tool.
CPACache update has two options: “Delta” and “Full”.
Delta-update tries to minimize the syncronization time and update only items that have been changed since the last update. Option “Full” conducts a full synchronization of ESR and Integration Directory repositories with CPACache.
TIP: You can copy URLs for CPACache and Mapping Cache updates and use them directly.
“Directory” tab contains the same tools:
Pic.7: “Directory” tab – SLD Cache update
Pic.8: “Directory” tab – CPACache refresh
These tools are effective when you want quickly eliminate possible cache error during interface execution.
But it’s not enough for a complete analysis or troubleshooting.
You can find more advanced tools in the “Configuration and Monitoring Home” toolset, located on the initial PI page:
Go to http://<host>:<port>/dir and select “Configuration and Monitoring Home” in the lower right corner.
You will see the following portal:
Pic.9: Monitoring and customizing tools for SAP PI
You can choose from the menu on top of page – what part of PI you want to see: Integration Engine, Adapter Enginge, Business Process Engine or Mapping Runtime.
Pic.10: Cache Monitor for Integration Engine (ABAP)
Pic. 11: Cache Monitor for Adapter Engine (J2EE)
Pic. 12: Cache Monitor for mappings (J2EE)
Choose “Cache Monitor” and enjoy the power over all caching mechanisms of SAP PI. 🙂
Pic.13: Cache Monitor for Adapter Engine — content view
Here you can see what is in the cache, synchronize individual objects or entire cache.
Caching and Developer.
There are some useful cache-related tools for developers you can use to monitor and control the caching process.
Open the Enterprise Service Builder, choose “Environment”:
Pic. 14: Cache tools in Enterprise Service Builder
The item “Clear SLD Data Cache” allows you to reset all cached objects from SLD, next time all objects will be read directly from SLD (not from cache).
This tool is useful when you just created a new software component in SLD, but it’s not visible in the list during the import to the ESR.
The item “Cache Status Overview” calling the monitor for Cache Refresh Notification Service.
For example, the monitor now shows that some development object was activated and this change was successfully provided to Integration Directory cache:
Pic. 15: successful object activation message in the ESR cache monitor
The life of this object can be traced in the <strong> Integration Directory </ strong> now. Run the Integration Builder, call the menu “Environment” -> “Cache Status Overview”:
Pic. 16: successful object activation message in the Integration Directory cache monitor
The monitor shows that the activated object has been successfully transferred to “consumers”: Integration Cache (ABAP) and Adapter Engine Cache (J2EE).
Here you can also refresh SLD Cache, which stores a list of Business Systems from SLD. After a cleaning, the first import of business systems would start direct reading of business systems list from the SLD.
Caching in ABAP.
If you want to see cache of ABAP part (Integration Server itself or connected SAP system) – use transaction SXI_CACHE:
Pic. 17: SXI_CACHE transaction
You can also find tools for delta- and full cache updates in the transaction menu:
Pic.18: SXI_CACHE menu
That’s all about cache universe in PI for now.
If you want more information, you can use these sources:
Good luck in your integrations!
Freelance Integration Expert