Thursday, March 31, 2011

Oracle Service Bus (OSB) Best Practices

1. Proxy Service Design
    • Use Headers for Service Routing  
 Place routing information in the SOAP Header or the Transport Header when there is a choice. When designing a SOA framework, it is recommended that routing decisions are based on SOAP headers or Transport headers (for non-SOAP payloads). 

    • Use Split-Join
Use Split-Join to reduce latency when CPU is not saturated. Parallel execution is a common paradigm used to reduce latency while consuming higher system resources. If a set of tasks have no dependency on one another, they can be executed in parallel. This is very useful for latency sensitive use cases

2. Business Service Design

    • EJB Transport  
Use EJB Transport primarily when loose coupling is desired. The EJB transport in OSB is designed to offer a loosely coupled and message oriented interface using WSDL. A WSDL based SOAP message has to be bound to Java interface using the standard JAX-RPC binding. This binding has a translation cost which is acceptable when the back-end EJB represents a reusable service. 

However, the translation cost may be regarded as high when making multiple short calls to one or more EJBs in a single proxy. A Java Callout may be a better solution to access an EJB in a more tightly coupled but low overhead mechanism.

    • Throttling 
Use Throttling to protect back-end systems from spikes in load. Throttling can be implemented creating Throttling policies for a Business Service within OSB or by using Work Managers at the WLS level. One can limit the maximum number of concurrent calls to the back-end service using Throttling.

3. Performance 

    • Avoid creating many OSB context variables that are used just once within another XQuery
    • Use a Replace action to complete the transformation in a single step
    • Use $body/*[1] to represent the contents of $body as an input to a Transformation (XQuery / XSLT) resource
    • Enable Streaming for pure Content-Based Routing scenarios
    • Disable or delete all log actions
    • Avoid the use of double front slashes ("//") in XPaths
4. If too much of message flow is expected, devide into two or more proxy services to have nice maintainability.
5. DON'T use Service Callout unless it's mandatory in the middle of a message flow. It's a thread blocker and performance is impacted.
6. DON'T use to many "IF-ELSE" conditions within the flow. Rather go for Routing Table to be efficient. Alternatively, XQuery can be used to achieve the purpose in one shot.
7. Use Proxy Service Transport as "LOCAL" in case of message processing is limited to LOCAL scope.
8. Keep time-out settings for DB Adapters JCA & http transport to keep the response within the expected time.