Powered By Blogger

Tuesday, March 11, 2014

OSB Result Caching

OSB result caching is a OSB feature to cache business service response for a given request.OSB uses Coherence to support caching.As we all know, if we enable caching g in right way then it increases application performance
Now let's talk about OSB with Coherence framework


Given caching is enabled,when request comes to OSB business service, it first checks in cache and  returns result to caller if it finds otherwise it calls back end external service,returns the result to caller and loads the result into cache for next time caller.
Cache also expires based on configured parameter, if cache is expired,the next service call will be routed to back end service and cache will be updated
Here we get the performance by avoiding calls to  back end service


Cache is implemented like Java Map(key,value) pairs, where key is combination of request or part of request identified by cache token ,business service full path and operation being invoked on business service  and value is returned response

So each cached result is  uniquely identified by a cache key

cache-token metadata element value can be expressed on business service configuration or can be set on one of request metadata variables from proxy service message flow
cache-ttl(expiration time,ttl stands for TimeToLive) element value can be expressed on business service configuration or can be set on one of request metadata variables from proxy service message flow
 
Caching needs to be enabled on business service as mentioned in below picture


When expiration time on BS is set to default as shown above, then expiration time is taken from OSB coherence config file- //config/osb/coherence/osb-coherence-cache-config.xml
By default it is set to 5 minutes, you can change this value to required hours(for example, 24h) or days  and restart osb server to reflect the change

TTL and cache token values in the request from proxy service will override the business service configuration parameters.


Note:
Make sure we also enable result caching at
Go to the SBConsole > Operations > Global Settings and enable Result Caching



Friday, February 14, 2014

OSB with JCA large file processing


 As we know, we can use JCA protocol with OSB to interact with various Oracle adapters.

This post will talk about one of the issues faced when OSB is used with FTP JCA for processing files.
FTP JCA was working fine for files less than 3 to 4 MB but file sizes more than that we got below error

<BEA-000000> <Generic Error caught while translating inbound file in streaming mode :
file_name.xml
java.lang.NullPointerException
at oracle.tip.adapter.file.inbound.InboundTranslatorDelegate.xlate(InboundTranslatorDelegate.java:295)
at oracle.tip.adapter.file.inbound.InboundTranslatorDelegate.doXlate(InboundTranslatorDelegate.java:121)
at oracle.tip.adapter.file.inbound.ProcessorDelegate.doXlate(ProcessorDelegate.java:408)
at oracle.tip.adapter.file.inbound.ProcessorDelegate.process(ProcessorDelegate.java:177)
at oracle.tip.adapter.file.inbound.ProcessWork.run(ProcessWork.java:349)
at weblogic.work.ContextWrap.run(ContextWrap.java:41)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:545)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)

JCA uses a flavor of DOM called ScalableDOM to process files but OSB doesn't support this feature.
ScalableDOM XML processing relieves problems of memory inefficiency, limited scalability, and lack of control over the DOM configuration

As per Oracle,three main features of ScalableDOM are
  1. Pluggable DOM:external XML representation to be directly used by Scalable DOM without replicating XML in internal representation
  2. Lazy materialization:XML processor creates nodes that are accessed and frees unused nodes from memory. Applications can process very large XML documents with improved scalability
  3. Configurable: DOM configurations can be made to suit different applications. You can configure the DOM with different access patterns such as read-only, streaming, transient update, and shadow copy, achieving maximum memory use and performance in your applications.
Anyway, in nutshell, we need to disable scalable DOM processing in case of large files with JCA OSB
Please set below property in JCA file

<property name="SupportsScalableDOM" value="false"/>