Earlier this month I was involved in organizing the Monument Family History Day. It was certainly a complex event, with dozens of presenters, guides and 100s of visitors. So with that experience of a complex event under my belt I decided to refresh my acquaintance with Oracle Event Processing (CEP).
CEP has a developer side based on Eclipse and a runtime environment.Server install
The server install is very straightforward (documentation). It is recommended to use the JRockit JDK with CEP so the steps to set up a working CEP server environment are:
- Download required software
- Install JRockit
- Run the JRockit installer, the download is an executable binary that just needs to be marked as executable.
- Install CEP
- Unzip the downloaded file
- Run the CEP installer, the unzipped file is an executable binary that may need to be marked as executable.
- Choose a custom install and add the examples if needed.
- It is not recommended to add the examples to a production environment but they can be helpful in development.
The developer install requires several steps (documentation). A developer install needs access to the software for the server install, although JRockit isn’t necessary for development use.
- Download required software
- Install Eclipse
- Unzip the download into the desired directory
- Start Eclipse
- Add Oracle CEP Repository in Eclipse
- Install Oracle CEP Tools for Eclipse 3.6
- You may need to set the proxy if behind a firewall.
- Modify eclipse.ini
- If using Windows edit with wordpad rather than notepad
- Point to 1.6 JVM
- Insert following lines before –vmargs
- Insert following lines before –vmargs
- Increase PermGen Memory
- Insert following line at end of file
- Insert following line at end of file
Restart eclipse and verify that everything is installed as expected.Voila The Deed Is Done
With CEP installed you are now ready to start a server, if you didn’t install the demoes then you will need to create a domain before starting the server.
Once the server is up and running (using startwlevs.sh) you can verify that the visualizer is available on http://hostname:port/wlevs, the default port for the demo domain is 9002.
With the server running you can test the IDE by creating a new “Oracle CEP Application Project” and creating a new target environment pointing at your CEP installation.
Much easier than organizing a Family History Day!
I have just received a copy of the “Oracle SOA Suite 11g Administrator's Handbook” so as soon as I have read it I will let you know what I think. In the meantime the first thing that struck me was the author credentials, although I have never met either of them as I remember, I have read Admeds blog postings and they are a great community resource, so immediately I am well disposed towards the book. Similarly Arun is an employee of my friend and co-author Matt Wright, and I have heard good things about him from Rubicon Red people.
A first glance at the table of contents looks encouraging, I particularly like their approach to performance tuning where they give a clear concise explanation of the knobs they are using.
More when I have read more.
I recently led an OSB POC where we needed to get high throughput from an OSB pipeline that had the following logic:
1. Receive Request
2. Send Request to External System
3. If Response has a particular value
3.1 Modify Request
3.2 Resend Request to External System
4. Send Response back to Requestor
All looks very straightforward and no nasty wrinkles along the way. The flow was implemented in OSB as follows (see diagram for more details):
- Proxy Service to Receive Request and Send Response
- Request Pipeline
- Copies Original Request for use in step 3
- Route Node
- Sends Request to External System exposed as a Business Service
- Response Pipeline
- Checks Response to Check If Request Needs to Be Resubmitted
- Modify Request
- Callout to External System (same Business Service as Route Node)
- Checks Response to Check If Request Needs to Be Resubmitted
The Proxy and the Business Service were each assigned their own Work Manager, effectively giving each of them their own thread pool.The Surprise
Imagine our surprise when, on stressing the system we saw it lock up, with large numbers of blocked threads. The reason for the lock up is due to some subtleties in the OSB thread model which is the topic of this post.
Basic Thread Model
OSB goes to great lengths to avoid holding on to threads. Lets start by looking at how how OSB deals with a simple request/response routing to a business service in a route node.
Most Business Services are implemented by OSB in two parts. The first part uses the request thread to send the request to the target. In the diagram this is represented by the thread T1. After sending the request to the target (the Business Service in our diagram) the request thread is released back to whatever pool it came from. A multiplexor (muxer) is used to wait for the response. When the response is received the muxer hands off the response to a new thread that is used to execute the response pipeline, this is represented in the diagram by T2.
OSB allows you to assign different Work Managers and hence different thread pools to each Proxy Service and Business Service. In out example we have the “Proxy Service Work Manager” assigned to the Proxy Service and the “Business Service Work Manager” assigned to the Business Service. Note that the Business Service Work Manager is only used to assign the thread to process the response, it is never used to process the request.
This architecture means that while waiting for a response from a business service there are no threads in use, which makes for better scalability in terms of thread usage.First Wrinkle
Note that if the Proxy and the Business Service both use the same Work Manager then there is potential for starvation. For example:
- Request Pipeline makes a blocking callout, say to perform a database read.
- Business Service response tries to allocate a thread from thread pool but all threads are blocked in the database read.
- New requests arrive and contend with responses arriving for the available threads.
Similar problems can occur if the response pipeline blocks for some reason, maybe a database update for example.Solution
The solution to this is to make sure that the Proxy and Business Service use different Work Managers so that they do not contend with each other for threads.Do Nothing Route Thread Model
So what happens if there is no route node? In this case OSB just echoes the Request message as a Response message, but what happens to the threads? OSB still uses a separate thread for the response, but in this case the Work Manager used is the Default Work Manager.
So this is really a special case of the Basic Thread Model discussed above, except that the response pipeline will always execute on the Default Work Manager.
Proxy Chaining Thread Model
So what happens when the route node is actually calling a Proxy Service rather than a Business Service, does the second Proxy Service use its own Thread or does it re-use the thread of the original Request Pipeline?
Well as you can see from the diagram when a route node calls another proxy service then the original Work Manager is used for both request pipelines. Similarly the response pipeline uses the Work Manager associated with the ultimate Business Service invoked via a Route Node. This actually fits in with the earlier description I gave about Business Services and by extension Route Nodes they “… uses the request thread to send the request to the target”.Call Out Threading Model
So what happens when you make a Service Callout to a Business Service from within a pipeline. The documentation says that “The pipeline processor will block the thread until the response arrives asynchronously” when using a Service Callout. What this means is that the target Business Service is called using the pipeline thread but the response is also handled by the pipeline thread. This implies that the pipeline thread blocks waiting for a response. It is the handling of this response that behaves in an unexpected way.
When a Business Service is called via a Service Callout, the calling thread is suspended after sending the request, but unlike the Route Node case the thread is not released, it waits for the response. The muxer uses the Business Service Work Manager to allocate a thread to process the response, but in this case processing the response means getting the response and notifying the blocked pipeline thread that the response is available. The original pipeline thread can then continue to process the response.Second Wrinkle
This leads to an unfortunate wrinkle. If the Business Service is using the same Work Manager as the Pipeline then it is possible for starvation or a deadlock to occur. The scenario is as follows:
- Pipeline makes a Callout and the thread is suspended but still allocated
- Multiple Pipeline instances using the same Work Manager are in this state (common for a system under load)
- Response comes back but all Work Manager threads are allocated to blocked pipelines.
- Response cannot be processed and so pipeline threads never unblock – deadlock!
The solution to this is to make sure that any Business Services used by a Callout in a pipeline use a different Work Manager to the pipeline itself.The Solution to My Problem
Looking back at my original workflow we see that the same Business Service is called twice, once in a Routing Node and once in a Response Pipeline Callout. This was what was causing my problem because the response pipeline was using the Business Service Work Manager, but the Service Callout wanted to use the same Work Manager to handle the responses and so eventually my Response Pipeline hogged all the available threads so no responses could be processed.
The solution was to create a second Business Service pointing to the same location as the original Business Service, the only difference was to assign a different Work Manager to this Business Service. This ensured that when the Service Callout completed there were always threads available to process the response because the response processing from the Service Callout had its own dedicated Work Manager.Summary
- Request Pipeline
- Executes on Proxy Work Manager (WM) Thread so limited by setting of that WM. If no WM specified then uses WLS default WM.
- Route Node
- Request sent using Proxy WM Thread
- Proxy WM Thread is released before getting response
- Muxer is used to handle response
- Muxer hands off response to Business Service (BS) WM
- Response Pipeline
- Executes on Routed Business Service WM Thread so limited by setting of that WM. If no WM specified then uses WLS default WM.
- No Route Node (Echo functionality)
- Proxy WM thread released
- New thread from the default WM used for response pipeline
- Service Callout
- Request sent using proxy pipeline thread
- Proxy thread is suspended (not released) until the response comes back
- Notification of response handled by BS WM thread so limited by setting of that WM. If no WM specified then uses WLS default WM.
- Note this is a very short lived use of the thread
- After notification by callout BS WM thread that thread is released and execution continues on the original pipeline thread.
- Route/Callout to Proxy Service
- Request Pipeline of callee executes on requestor thread
- Response Pipeline of caller executes on response thread of requested proxy
- Request message may be queued if limit reached.
- Requesting thread is released (route node) or suspended (callout)
So what this means is that you may get deadlocks caused by thread starvation if you use the same thread pool for the business service in a route node and the business service in a callout from the response pipeline because the callout will need a notification thread from the same thread pool as the response pipeline. This was the problem we were having.
You get a similar problem if you use the same work manager for the proxy request pipeline and a business service callout from that request pipeline.
It also means you may want to have different work managers for the proxy and business service in the route node.
Basically you need to think carefully about how threading impacts your proxy services.
Thanks to Jay Kasi, Gerald Nunn and Deb Ayers for helping to explain this to me. Any errors are my own and not theirs. Also thanks to my colleagues Milind Pandit and Prasad Bopardikar who travelled this road with me.
Last day at OpenWorld. The exhibits are closed, and the final few presentations are being given. I spent much of the day meeting with customers to talk about SOA/OSB and Coherence. Main event of the day was the farewell party which was loud and surprisingly well attended. I was able to have lunch with Dave Felcey, Coherence PM, who has a great blog and is always ready to share his expertise with people.
So that was OpenWOrld for another year. I met a friend of a friend who attends OpenWorld every year and attends the Demo Grounds with a list of questions to ask people. I think that illustrates the point that everyone approaches OpenWorld in a different way and looks to get different things from it. For me OpenWorld is a great experience to feel the energy in Oracle and network with customers and partners. Hope to see you there next year!
My third day was exhibition day for me! I took the opportunity to wander around the JavaOne and OpenWorld exhibitions to see what might be useful for me when selling WebLogic, Coherence & SOA Suite. I found a number of interesting vendors and thought I would share what I found here. These are not necessarily endorsements, but observations on companies that I thought had interesting looking products that fill a need I have seen at customers.Highly Available EBS Upgrades
A few years ago I worked with a customer that was a port authority. They wanted to tie E-Business Suite into their operations to provide faster processing of cargo and passengers. However they only had a 2 hour downtime window to perform upgrades. This was not a problem for core database and middleware technology, this could accommodate those upgrade timescales easily. It was a problem for EBS however so I intrigued to find Rapid E-Suite Inc offering an 11i to 12i upgrade service that claims to require no outage. This could be a real boon to EBS customers like my port friends that need to upgrade without disruption to their business.Mobile on WebLogic
I have come across a number of customers who want a comprehensive mobile solution, connected and disconnected operation and so forth. ADF only addresses part of these requirements currently so I was excited to discover mFrontiers Inc offering an apparently comprehensive solution that should integrate easily with Oracle SOA Suite to mobile enable a SOA infrastructure. The ability to operate without a network is important for many applications, particularly in industries that require their engineers to enter buildings to perform maintenance or repairs, because network access is not always available – many of my colleagues don’t have mobile access from their homes because they live in the middle of nowhere – and disconnected support is crucial in these situations.Sharepoint Connector for WebCenter Content
Obviously Sharepoint is an evil pernicious intrusion into a companies IT estate but it is widely deployed and many people like it but also would like to take advantage of Oracle products such as WebCenter Content. So I was encouraged to see that Fishbowl Solutions have created a connector for Sharepoint that allows it to bring in content from WebCenter, it looks like a valuable way to maintain the Sharepoint interface end users are used to but extend the range of content by pulling stuff (technical term for content) from WebCenter.
The Enterprise Deployment Guides are Oracles bible on building highly available FMW environments, and each of them requires a front end load balancer. I have been asked to help configure F5 Load Balancers on a number of occasions over my time at Oracle and each time I come back to it I find more useful features have been added to the BigIP line of load balancers that F5 sell, many of their documents are tailored to FMW. I like F5, they provide (relatively) easy to use products that do what they say on the side of the box. They may not have all the bells and whistles of some of their more expensive competitors but they do the job and do it well! Besides which I like their logo!Other Stuff
I saw lots of other interesting products and services, such as a lightweight monitoring tool for Coherence, Forms migration services, JCAPS migration services and lots of cool freebies to take home to the children!A Quiet Night
Wednesday night was the partner appreciation event and I had decided to go back to the hotel and have an early night. I decided to attend the last session of the day – a Maven/Hudson/WebLogic tutorial. I got the wrong hotel for the session and snuck in 20 minutes late at the back and starting working on the hands on workshop. One of my co-attendees raised his hand for help and as the presenter came over to help he suddenly stopped and yelled – “Is that Antony”! It was my old friend Steve Button who used to be based in Redwood Shores but is now a WebLogic guru PM in Australia. It was good to catch up with him. As he yelled out a guy with really bad posture turned around to see who he was talking to, this turned out to be my friend Simon Haslan, Oracle ACE from the UK. After the tutorial Simon and I retired to the coffee shop to catch up and share stories. 2 and half hours later we decided it was time to retire, so much for an early night but great to renew old friendships and find out what real customers are worrying about.
My second full day started with me waking up and realising that I was supposed to meet my friend Tejas Joshi (co-author of the Oracle Exalogic Elastic Cloud Handbook) at the station in 20 minutes! Needless to say I didn’t make it, but then I felt better later when I found out he had caught the wrong shuttle bus and ended up at the airport instead of the BART!
The morning was spent in the Authors Seminar arranged to give authors a whirlwind tour of Oracle Product updates and strategy plans. It was useful to see what was happening in areas I knew little or nothing about. In the afternoon I wandered around Java One, a very different show to OpenWorld with much more bleeding edge stuff and just plain blue sky thinking. Of course who couldn’t love a show with a full size Duke wondering around and available for photographs.
Attended a presentation on a highly available Weblogic JMS environment wich did a great job of laying out to architect a highly available solution.
Dinner with customers and then collapsed exhausted into bed!
A couple of things I forgot to mention about yesterdays OpenWorld.
First I attended a presentation on SOA Suite and Virtualization which explained how Oracle Virtual Assembly Builder (OVAB) can be used to accelerate the deployment of an Enterprise Deployment Guide (EDG) compliant SOA Suite infrastructure. OVAB provides the ability to introspect a deployed software component such as WebLogic Server, SOA Suite or other components and extract the configuration and package it up for rapid deployment into an Oracle Virtual Machine. OVAB allows multiple machines to be configured and connections made between the machines and outside resources such as databases. That by itself is pretty cool and has been available for a while in OVAB. What is new is that Oracle has done this for an EDG compliant installations and made it available as an OVAB assembly for customers to use, significantly accelerating the deployment of an EDG deployment. A real help for customers standing up EDG environments, particularly in test, dev and QA environments.
The other thing I forgot to mention was the most memorable demo I saw at OpenWorld. This was done by my co-author Matt Wright who was showcasing the products of his company Rubicon Red. They showed a really cool application called OneSpot which puts all the information about a single users business processes in one spot! Apparently a customer suggested the name. It allows business flows to be defined that map onto events. As events occur the status of the business flow is updated to reflect the change. The interface is strongly reminiscent of social media sites and provides a graphical view of business flows. So how does this differ from BPEL and BPM process flows? The OneSpot process flow is more like a BAM process flow, it is based on events arriving from multiple sources, and is focused on the clients view of the process, not the actual business process. This is important because it allows an end user to get a view of where his current business flow is and what actions, if any, are required of him. This by itself is great, but better still is that OneSpot has a real time updating view of events that have occurred (BAM style no need to refresh the browser). This means that as new events occur the end user can see them and jump to the business flow or take other appropriate actions. Under the covers OneSpot makes use of Oracle Human Workflow to provide a forms interface, but this is not the HWF GUI you know! The HWF GUI screens are much prettier and have more of a social media feel about them due to their use of images and pulling in relevant related information. If you are at OOW I strongly recommend you visit Matt or John at the Rubicon Red stand and ask, no demand a demo of OneSpot!
Lots of people are blogging insightfully about OpenWorld so I thought I would provide some non-insightful remarks to buck the trend!
With 50,000 attendees I didn’t expect to bump into too many people I knew, boy was I wrong! I walked into the registration area and immediately was hailed by a couple of customers I had worked with a few months ago. Moving to the employee registration area in a different hall I bumped into a colleague from the UK who was also registering. As soon as I got my badge I bumped into a friend from Ireland! So maybe OpenWorld isn’t so big after all!
First port of call was Larrys Keynote. As always Larry was provocative and thought provoking. His key points were announcing the Oracle cloud offering in IaaS, PaaS and SaaS, pointing out that Fusion Apps are cloud enabled and finally announcing the 12c Database, making a big play of its new multi-tenancy features. His contention was that multi-tenancy will simplify cloud development and provide better security by providing DB level isolation for applications and customers.
Next day, Monday, was my first full day at OpenWorld. The first session I attended was on monitoring of OSB, very interesting presentation on the benefits achieved by an Illinois area telco – US Cellular. Great discussion of why they bought the SOA Management Packs and the benefits they are already seeing from their investment in terms of improved provisioning and time to market, as well as better performance insight and assistance with capacity planning.
Craig Blitz provided a nice walkthrough of where Coherence has been and where it is going.
Last night I attended the BOF on Managed File Transfer where Dave Berry replayed Oracles thoughts on providing dedicated Managed File Transfer as part of the 12c SOA release. Dave laid out the perceived requirements and solicited feedback from the audience on what if anything was missing. He also demoed an early version of the functionality that would simplify setting up MFT in SOA Suite and make tracking activity much easier.
So much for Day 1. I also ran into scores of old friends and colleagues and had a pleasant dinner with my friend from Ireland where I caught up on the latest news from Oracle UK. Not bad for Day 1!