Archive

Archive for January, 2009

Context Aware Event Processing

January 17th, 2009

In real life it’s common to see how different messages get a varying meaning when presented in different contexts.

For example, a quote out of context can more or less be turned into whatever the messenger wants it to be. The same goes for pictures where the photographer can create totally different pictures of a scene by simple placing them into a different context, in photography this is done by carefully selecting your angle, background and crop.

That brings us to a very interesting concept in event processing. Namely context aware event processing, its one of the two major ingredients in event processing. The other is the art of detecting interesting combinations of events.

The context is apparent when you process static data. The data you query forms the context. Your SQL query is executed in the context of the data in the database. It’s obvious that the same query results in different sets of answers when executed against different data. In event processing, the context is a bit more complex concept.

Creating Context

In event processing we need to create a context for us. Normally an event processing system is operating on a stream of events. This have to be turned into a meaningful context. You could ofcourse process events one by one, but that tends to be so simple so you won’t actually need specialized CEP software for that.

For example

Let’s say you would like to be informed about trucks which stay still for more than one minute.

Depending on the context, this could mean different things:

  • If detected on a large road with heavy traffic it’s something that need to be attended to immediately
  • If detected inside a city during rush hour, it’s not too much to care about and might only lead to and informative message that the transport is late.

These two contexts give the same situation completely different meaning and it can also be used to ignore the situation if it happens in certain context like inside company premises.

Context Management

The context can viewed as your dynamically managed virtual view into the stream of inbound events. The context contains a sub set of events from the view which, at any point in time, are somehow relevant as a group to the situation you are detecting.

The events which make up your context are normally somehow related using a number of common properties. Some examples:

  • Time – Manage the events in the context based on time constraints. For example only events from the last hour or those between nine and five.
  • Location – Events which notify us about changes in entities located in certain geographical areas, or perhaps those which are close to each other.
  • Content – Event content such as primary keys of different kinds can be used to keep only semantically related events available.
  • Relation – Include only events which are related somehow.  Relations can be dynamic and change over time. Example relations are caused by, is sub class of, is super class of, belongs to same category and so on.
  •  Entity – Include only events which are notifications about state change in the same business entity. For example the same person, truck, order, business process, customer or server

Your Evaluation Context

So what’s the point of all this context definition and management?

Situation detection (aka pattern detection) and other processing is performed in this context! 

This means that the same situation can be defined independently of the context.

Thus allowing same situation to be evaluated against different context in provide a modular and powerful processing model.

In order for this to work smoothly, the context must be treated as a first class citizen in the event processing model used. A context should be defined totally independently of any other processing which is performed using it.

When a situation is detected it is in turn used as a context to any action you like to perform as a result of the detection. This new context together with the original context in which the situation is detection provided a good base for creating meaningful result events.

The context is very important when reporting about a detected situation. In the truck stop example above, it would not be terribly valuable to know "A truck stopped". You need more context! At least the id of the truck and the location and perhaps road number where it stopped and the drivers name. Nice additions would also be how long it stood still and perhaps its movements during the last couple of minutes. All this information is picked up from the context while assembling the response.

All this context in the outbound (or whatever method your event processor uses) action event can be used to initiate a business process to handle the exceptional situation.

Example

 I think most event processing tools have some kind of context management available or at least functionality to create and manage your own context. I’ll use Coral8 and ruleCore here as example just because I know them best and don’t need to look up how they work. Maybe you can add more examples?

In Coral8 there’s a concept called windows. Normally each query contains a window which the query is executed against. There’s a extension of this in the later versions called named windows which are defined independently of the query. These named windows can be used to hold a context. A number of queries can write data into the and they can also be read by multiple queries. The named window can be maintained using CCL and thus there’s a very powerful and flexible way of deciding what events are present in the named view. For example (Copied from the Coral8 docs):

CREATE WINDOW WindowTradesMicrosoft
SCHEMA ‘WindowTradesMSFT.ccs’
KEEP 3 ROWS;

INSERT INTO WindowTradesMicrosoft
SELECT volume, price
FROM StockTrades
WHERE symbol = ‘MSFT’;

INSERT INTO AvgPriceMicrosoft
SELECT AVG(price)
FROM WindowTradesMicrosoft;

 

In ruleCore the context is called event stream views. A view is defined to include only events with certain properties. For example that they come from the same geographic zone or that they are all about the same entity. For example you could write something like:

 

<View name="Interesting Vehicles according to XYZ">

    <Type>
        <Event>Location</Event>
        <Event>X1</Event>
    </Type>


   <ZoneMatch/>


    <PropertyMatch property="Color"/>


    <MaxAge>00:10:00</MaxAge>


</View>

 

To create a view (context) which contains events of type Location and X1 from the same zone with the same color during the last ten minutes.

In ruleCore we use a declarative approach to context management. In the view definition you specify what properties the events must have in order for them to be present in the view.

Other event processing tools might also give the user the option to maintain the context using a procedural approach. You could basically have small piece of code (or other procedural logic) which updates the view continuously. Using some kind of pseudo code from a fictional event processing system this could look like:

if event.type ="Location" and someComplexFunction(event)   
     context.insert(event) 

if event.color = "Green" and databaseLookUp(event) 
    context.insert(event)

if event.color = "Red" and event.entity = "server1" 
    context.insertOrReplace(event)

 

 

Rich context management is one of the things I think sets event processing apart from traditional data processing and you should spend some time in getting it right when designing an event processing system or using one!

 

(When put into context, the boring picture of the Swedish "no parking sign" gets a bit more interesting with the two cars parked in front of it. Also, published in the context of a blog written in English it can be a bit amusing too. (Utfart is Swedish for Exit, nothing else…))

 

 

 

 

Share/Save/Bookmark

Complex Event Processing

Where’s CEP heading?

January 16th, 2009
Comments Off

Last night some parts of Sweden had a blistering temprature of -38C (-36). A pretty cold night by any standards.

If you like Swedish high-tech take a look at Boston Power. Probably the world best batteries, invented by Christina from Sweden.

Sadly Sweden lacks the start-up culture so many companies do just like Boston Power, they invent here in Sweden and then move to the US to build a company of the innovation.  Sweden pays the bills for education and research and US gets the profits from the company building effort. There are a number of other companies in the US that looks American but are actually Swedish.

I have seen a worrying trend in the CEP marketplace recently. The replication of the efforts done by companies which have produced message oriented middleware for integration purposes.

I took a quick look at the current vendors in this space and much of the advertised features compete directly with other message oriented product. Features like event routing/dispatching and transformation looks just like a variation of good old message oriented stuff known to everyone into the integration (EAI) world.

I think that those vendors which fails to realize that this is a problem already solved will have hard time in selling their products.

I asked a tech sales guy what the difference was between their old and widely used businedd integration tool and the new fancy event product. The products I asked about event look similar and you can do most of the stuff in the old tool, but of course there everything is called messages and not events. The answer, well, he was not sure exactly what the difference was once I started to ask about the details. The marketing of the products are certainly different, for any practical purposes I did see no point in investing in the new tool. Apart from the cool factor of having an event processing tool.

The other problem I see is that many vendors position their products in a way so that they are evaluated against traditional databases, BI, DW and other traditional tools. There’s no feeling of "you really, really, really can’t do this with your traditional tools". It works fine for those targeting the financial sector as there the pain of using the traditional tools is just too great.

So, are CEP and CEP vendors doomed? No, not at all. A couple of pure play CEP vendors will survive this crisis and CEP features will find its way into the traditional tools from many vendors. For example, the gains of using CEP to solve finance problems seems to be huge. Suddenly you can solve problems which are unsolvable without CEP. Those who gets this will be rich …

 

Share/Save/Bookmark

Complex Event Processing

StreamBase Gets Cash

January 10th, 2009

It seems that there’s at least someone out there who thinks that event processing is a good place to invest money in.

StreamBase apparently got about $6M of Series D funding from Battery Ventures, Accel Partners, Bessemer Venture Partners, Highland Capital Partners and In-Q-Tel.

This means that StreamBase have got nearly $50M in funding since its start. I suppose VCs like to have something like x10 return on their investment so someday StreamBase need to sell awful lot of expensive licenses. Or perhaps somebody realizing that StreamBase is good value for money at $500M instead of giving someone those $500M to build a competing software…

Being a systems programmer, I have no idea if this is a good thing. In one way it suggest that StreamBase does not sell enough to keep things running using licensing fees. On the other hand it could be seen as a good sign that a number of companies are investing in CEP. I suppose there are a number of briljant thinkers at these companies which are sure, to the point of $50M, that there will eventually be a healthy CEP business. Or they know something I don’t, which is rather probable.

Anyway, congratulations StreamBase! I’m pretty sure they are on track.

 

 

 

 

Share/Save/Bookmark

Complex Event Processing