Caching in OSB

As osb acts as integration layer between client and enterprise applications, often there will be requirement to store external system result to in-memory instead of invoking the external system again and again. In osb we can achieve this functionality by using Result caching feature in business service.


If you use business services that return results that do not change often, you can configure those business services to cache results. When you enable result caching, the service returns results from the cache rather than invoking the external service. This configuration improves performance by reducing network overhead to access the external service. Result caching also helps improve scalability by reducing the load on the back-end servers that host the external service.

Below Figure illustrates, a client invoking a business service and receiving a response from external service and that result will be cached into cache. In the next subsequent requests result will be fetched from cache instead of invoking external service.





How Result Caching Works



Each cached result is uniquely identified by a cache key that is made up of the ServiceRef, the operation being invoked, and a cache token string. The cache token helps to uniquely identify a single cache result among other cache results for one business service. You control the value of the cache token. You can set the cache token either by configuring the cache token expression in the result caching configuration for the business service or by using the cache-token metadata element in $transportMetaData using the pipeline.

  • Cache Token - The token configured in Business Service (e.g - Customer ID)
  • ServiceRef - Service Type (i.e - BusinessService) + Fully qualified path name of the service (e.g - <OSBProjectName>/<Business>/<BusinessServiceName>)
  • Operation - Operation name of the business service.

If the business service locates cached results through a cache key, it returns those cached results to the client instead of invoking the external service directly.






1 comment: