<Insert Picture Here> SOA Fusion Best Practices Berthold Maier Chief Architect Oracle Corporation, Germany
How you should define SOA in the Fusion Environment Service Oriented Architecture (SOA) is a collection of selfcontained, loosely coupled services with well-defined interfaces that can be discovered by applications for communication in a standard-based manner regardless of location. SOA!= WebService BPEL: SOA is often referred to synonymously with web services; however, they are not the same. SOA is architecture, whereas web service is an enabling technology 2 2007 Oracle Corporation
3 2007 Oracle Corporation
SOA Project Methodology Oracle Fusion SOA Project Methodology provides best practices for SOA to take a project from assessment to execution, accounting for key dimensions such as organization, tools and techniques. Projects have three nested scopes of engagement: Enterprise Enterprise Business Business Level Level Maturity Maturity Model, Project Model, Governance Project--Best Best Practices Practices Governance Scope Enterprise Scope Activities Enterprise Service Activities Service Portfolio Portfolio Produce Application Produce Application best best practices, - practices, -Technical TechnicalLevel Service Application Service Application Classification scope Classification scope activities activities realize realize the the SOA SOA implementation Refinements implementation with Refinements to to the the service with Logical/Physical Logical/Physical design service portfolio portfolio and design Considerations, and business/technical Considerations, business/technical about about the the services Defining services Defining at Technology at the Technology the pillar pillar level components level components Refining Refining the the Process Process Portfolios Portfolios and and Solution Solution Specifications Specifications 4 2007 Oracle Corporation
5 2007 Oracle Corporation
SOA Global Mindchanges Some mind changes are required to implement a suitable SOA Most of Traditional -DB Developer are most forced to change SOA isn t a Project: For each Service implementation you should look up to use existing functionality and use it with a wrapper Anti-Pattern: Although many architects consider data replication bad and label it as a SOA antipattern, it should be noted that any pattern becomes an antipattern if it is implemented excessively, incorrectly, incompletely or just as a quick-fix. Even using web services in place of proper SOA is an antipattern. 6 2007 Oracle Corporation
SOA Critical Success Factors Referencearchitecture Processorchestration SOA Governance Central Metadatamanagement Security Common Data Format SOA Federation Monitoring Test User Interactions (GUI) Transactions Errorhandling Projectmodell 7 2007 Oracle Corporation
8 2007 Oracle Corporation
9 2007 Oracle Corporation
10 2007 Oracle Corporation
Federation as a SOA Key Concept End-to-End Security/User Identity Propagate Transparent Message Routing Trace Transactions End-to-End File Integrated Audit Framework Management across Heterogeneous SOA Environment Oracle SAP JCA Binding Domain 1 MDS 1 UDDI HTTP Binding HTTP Binding Domain 2 ESB Node 1 MDS 2 ESB Node 2 JCA Binding Database Web Service Manager TOMAX ESB Node 1 JMS Binding MOM JMS Binding Domain 3 ESB Node 1 MDS 3 ESB Node 2 Web Service Manager ESB Node 3 MQ Binding Mainframe 11 2007 Oracle Corporation
Useful BPEL Properties wsdllocation This property must be present. The BPEL compiler needs this to validate the BEPL source. wsdlruntimelocation This property is optional, it defaults to the wsdllocation property. This property allows multiple URLs separated by blanks (space, new line and tabs). Thus the engine will try sequentially if any of them are not available. wsseheaders Propagate/ WS-Security credentials wsseusername / wssepassword Security - the username/password for the token preferredport Preferred port to use in case there are multiple WSDL ports availabel. fullwsaddressing (Default value is "false ) WSDL will be generated to include full WSA headers in binding 12 2007 Oracle Corporation
Errorhandling (BPEL) BPEL Fault-Policy Framework Fault Handling With BPEL 10.1.3.3.3 Runtime fault Runtime faults will not be defined by the user; previous it must be handled in the process within catch-activity Default Available Actions: ora-retry ora-replay-scope ora-rethrow-fault ora-human-intervention ora-terminate ora-java <condition> <condition> <test>$fault.code/code="invalid_wsdl /> <test>$fault.code/code="invalid_wsdl /> <action <action ref="ora-terminate"/> ref="ora-terminate"/> </condition> </condition> 13 2007 Oracle Corporation
14 2007 Oracle Corporation
SOA and User Interaction BPEL4People Only usable in asynchron environment Support of synchron user interaction is in most projects a must Interaction BPEL Pattern Combine asynchron BPEL calls with synchron calls Use workflow queue in combination with long running tasks New CRUD Applications often SOA Killer Change architecture and use service at each use case end 15 2007 Oracle Corporation
BPEL Clustering I Firewall DMZ (BPEL Zone) BPEL Tier LBR VIP: bpel.someorg.tld 80, 443 Ports Open: 80, 443 BPELHOST1 BPELHOST2 Active-Active Topology OHS OC4J_BPEL OHS OC4J_BPEL 1521 Active-Passive Topology (Cold Failover Cluster) Firewall (Intranet) Data Tier Ports Open: 1521 RAC Adapters Concurrency High Availability Options RACHOST1 Dehydration Store RACHOST2 Supports: e.g. JCA-Database, JCA- JMS, etc. None Support: File and FTP adapters Active-Active Topology for Adapters Modified Active-Active Topology Active-Passive Topology Modified Active-Active Topology Active-Passive Topology Modified Active-Active Topology for Adapters Disable the Activation Agent for partner links (eg. FTP, File) in bpel.xml Implementation should consider: AQ as JMS-Provider Single-Consumer Queues, Virtualize BPEL Endpoints with ESB, OWSM, Registry,... RAC and Datasource with FCF Recovery Need some CPU Ressouses Disable: Set in Manage BPEL Domain" rcvagentdelay = -1 To prevent lock contention,start recovery only on one BPEl-Node 16 2007 Oracle Corporation
Dehydration - Breakpoint Activities Receive Wait Pick (onmessage, onalarm) Invoke (non-idempotent or non-blocking) It s where the process pauses Activities like wait, receive, onmessage and onalarm will create dehydration points in the process. What gets dehydrated: Meta data: state of process instance Essential for recovery Audit Trail: Dump of process instance history Useless for recovery When to dehydrate: At the end In the middle: at breakpoint activities 17 2007 Oracle Corporation
Tuning Scenario Common Problems Too much dehydration Use completionpersistxxx, auditlevel wisely Avoid Break point activities in large While loop Avoid updates of large variables in large while loop Transformation takes too long Use Oracle XDK Too many layers Minimize componentization Process too complex Use BPEL as glue, not programming language Transient process, audit only faulted instances inmemoryoptimizaiton=on completionpersistpolicy=faulted completionpersistlevel=all auditlevel=all Transient process, see all instances (but not full audit) inmemoryoptimizaton=on completionpersistpolicy=all completionpersistlevel=insteanc eheader auditlevel=minimum Durable process, need ability to recover, but not audit: auditlevel=off 18 2007 Oracle Corporation
Tuning Szenario Process type: oneway, transient (no breakpoints) Message size: 1K Inbound: JMS adapter, Outbound: WSIF/EJB Application Inbound JMS Queue JMS Adapter BPEL PM WSIF Binding EJB Outbound Database Modification Throughput (txn/min) Improve Process Change one-way. to two-way (WSDL) ~1,800 --------- Set completionpersistpolicy=faulted (bpel.xml) Adapter Use OCI driver (j2ee/oc4j_bpel/config/application.xml) 2,500 35% Adapter Create multiple (8) adapter agents (bpel.xml) 10,000 400% Cluster Stripe the one inbound queue into two Create a 2-node queue cluster Create a 2-node BPEL cluster Crisscrossing adapter agents to queues 19,000 (virtually unlimited scalability) 95% 19 2007 Oracle Corporation
BPEL Performance Attributes Durable Contains breakpoint activities (Wait, Asynch, ) Save state more than once Can recover from the last dehydrated state LoanFlow, OrderBooking Transient Process No breakpoint activities Save state ONLY once NO NEED to recover Nothing to recover CreditRatingService HelloWorld completionpersistlevel completionpersistpolicy? Save meta data on/deferred/fa ulted o f f auditlevel Save audit trail Save nothing completionpersistpolicy (inmemoryoptimization) Durable Process Audit Trail Meta Data Transient Process Audit Trail Meta Data Yes Yes completionpersistlevel (inmemoryoptimization) No (ignored) No Yes auditlevel Yes No Yes No 20 2007 Oracle Corporation
ESB Performance Tips Turn off logging in EM (ESB Developer Guide) Turn off instance tracking in ESB Control Use synchronous services wherever possible avoiding costly file or database writes Minimize the use of transformations as much as possible Use DVM in lieu of db lookup within XSL transformations to minimize file IO Note: Since ESB is stateless, the database performance is not as important as for BPEL if you turned off instance tracking 21 2007 Oracle Corporation
Threads and Transaction Dehydration: commit a database transaction Crash/time-out: transaction rolled back Recovery: load instance states from database Transactions can be propagated to EJB or WSIF Service transaction=participate property In 10.1.3.3.0, ESB no longer marks the JTA transaction for rollback if the transaction was initiated by BPEL. Instead, ESB throws an exception back to BPEL 22 2007 Oracle Corporation
Client Threads and Transactions T1 1 Container T1, Tx1 BPEL Engine Connection Pool 1. Receive msg, starts Tx1, acquire DB con, create instance 2. Hit the end of process 3. Save state, end Tx1 3 T1, Tx1 Dehydration Store 2 23 2007 Oracle Corporation
Client Threads and Transaction 1 T1, Tx1 Container 2 Worker Beans T2, Tx2 BPEL Engine Connection Pool 1. Thread 1 receives and saves msg. in Tx1 2. Thread 2 (WB) starts Tx2, acquires DB con, creates instance 3. Hit dehyd. point 4. Savse state, ends Tx2 5. Thread 3 receives and saves msg. in Tx3 6. Thread 3 starts Tx4, acquires DB con, continues instance 7. Hit end of process 8. Saves state, ends Tx4 T3, Tx3 T4, Tx4 Partner 5 DB 6 3 4 8 T2, Tx2 T4, Tx4 Dehydration Store 7 24 2007 Oracle Corporation
Reliability Scenario T1, Tx1 Crash! Client Container Worker Beans T2, Tx2 BPEL Engine Connection Pool Message NOT saved, NOT shown at Recovery Instance NOT saved, NOT shown at Console Client receives error T3, Tx3 T4, Tx4 Partner queue T2, Tx2 T4, Tx4 Dehydration Store 25 2007 Oracle Corporation
Reliability Scenario Message rollbacked to DB, shown at Recovery Client T1, Tx1 Container Worker Beans T2, Tx2 BPEL Engine Crash! Connection Pool Instance NOT saved, NOT shown at Console Client does NOT receive error T3, Tx3 T4, Tx4 Partner queue T2, Tx2 T4, Tx4 Dehydration Store 26 2007 Oracle Corporation
Client Reliability Scenario T1, Tx1 Container Worker Beans T2, Tx2 BPEL Engine Connection Pool Message rollbacked, shown at Recovery Instance saved, shown at Console, with the last state (up to Assign) Client does NOT receive error T3, Tx3 T4, Tx4 Partner queue Crash! T2, Tx2 T4, Tx4 Dehydration Store 27 2007 Oracle Corporation
Reliability Scenario T1 Client Container BPEL Engine T1, Tx1 Connection Pool Message NOT saved, NOT shown at Recovery Instance NOT saved, NOT shown at Console Client or partner receives error Crash! T1, Tx1 Dehydration Store 28 2007 Oracle Corporation
29 2007 Oracle Corporation