Stop Thinking, Just Do!

Sung-Soo Kim's Blog

In-Memory Caches


9 January 2014

Most CEP platforms provide some sort of in-memory caches as part of the runtime engine.

In-memory caches are used by the CEP engine primarily to store events and windows. Caches are also used for other purposes, such as sharing data between streams, maintaining state and storing external data (from relational databases and data from web services, for example) for ultra-fast processing. These data types are stored outside the windows and event streams but can participate in computation when required. It should be noted that data stored in this cache is not persistent unless specified otherwise; when a server is shut down, the cached data goes down with it.

CEP engines implicitly manage evictions while caching events and windows using policies such as Least Frequently Used (LFU), Least Recently Used (LRU), and First in First out (FIFO) when the maximum cache size is reached. Eviction of user-defined cache objects should be managed explicitly.

In case an application requires a persistent cache wherein data is not lost across the runs or when one node fails, CEP engines can be integrated to use disk- based cache or distributed cache that is out of process. Some platforms bundle these alternative caching mechanisms as a feature; others can be extended to use an off-the-shelf product. Depending on the platform, these alternative mechanisms can be used to store events received or reference data.

A persistent cache plays an important role in high availability. From a performance point of view, however, in-memory caches are much faster. If the reads are high and the invalidation happens rarely for a relatively small data volume, the distributed cache objects could be replicated in memory to form a near-cache. A tradeoff between high availability and speed would determine caching design.


[1] Complex Event Processing – 10 Design Patterns – Sybase
[2] Big Data vs Event Processing – The TIBCO Blog
[3] Understanding Scalability – Oracle CEP Guide
[4] The Forrester WaveTM: Complex Event Processing (CEP) Platforms, Q3 2009.
[5] Storm & Esper
[6] The Esper CEP Ecosystem
[7] Enterprise Integration Patterns: Designing, Building, and Deploying Messaging Solutions- Gregor Hohpe,Bobby Wool; Addison-Wesley Professional.
[8] A Hitchhiker’s Guide to Microsoft StreamInsight Queries - Ramkumar (Ram) Krishnan, Jonathan Goldstein, Alex Raizman (Version: Jun 12 2012)
[9] StreamInsight: User Defined Aggregates and Operators - MSDN
[10] StreamBase: Expression Language Functions
[11] Esper: Packaging and Deploying
[12] StreamBase: Administration Guide
[13] StreamInsight: Planning and Architecture
[14] StreamInsight: Resiliency
[15] Oracle Complex Event Processing High Availability
[16] StreamBase tuning tips
[17] Fincos – Benchmarking tool for CEP systems
[18] Mohd. Saboor, Rajesh Rengasamy, Designing and Developing Complex Event Processing Applications, Sapient Global Markets, August 2013.

comments powered by Disqus