Friday, December 9, 2011

Siddhi: A Second Look at Complex Event Processing Implementations

Following slide deck presents Siddhi, a University of Moaratuwa final year project I worked with Suho, Isuru, Subash, and Kasun last year. Siddhi is a Complex Event Processing Implementation that incorporates most of the state of the art advances.

Siddhi: A Second Look at Complex Event Processing Implementations



We presented the Siddhi paper titled Siddhi: A Second Look at Complex Event Processing Architectures, in Gateway Computing Environments Workshop (GCE), Seattle, 2011 (Co-located with Super Computing 2011). Above slides provide an outline of our work.


Following three graph's shows some of the key results of the Paper. Other CEP engine is Esper, which is a well-known opensource CEP engine. In the given scenarios we did from about 0.3 times to 10 times better.

Query 1: Filter (select symbol, price from StockTick(price>6))


Query2: Window (select irstream symbol, price, avg(price) from StockTick(symbol=’IBM’).win:time(.005))



Query3: Followed by pattern (select f.symbol, p.accountNumber, f.accountNumber from pattern [every f=FraudWarningEvent2 -> p=PINChangeEvent2(accountNumber= f.accountNumber)])



Siddhi is currently being used by
  • Los Angeles Smart Grid Demonstration Project
  • It forecasts electricity demand, respond to peak load events, and improves sustainable use of energy by consumers.
  • Open MRS NCD module – idea is to detect and notify patient when certain conditions have occurredhttps://wiki.openmrs.org/display/docs/Notifiable+Condition+Detector+%28NCD%29+Module
Also likely that future WSO2 Complex Event Processing Server would also use Siddhi, yes that is if it can continue to do better. Siddhi code can be found from http://siddhi.sourceforge.net/, and If you are interested to help, please join us at architecture@wso2.org for discussions.

CSE 2011 Keynote: Distributed Systems: What? Why? And bit of How?

Last week I did the keynote for the Annual research conference of Computer Science and Engineering Department, University of Moratuwa, and following are the slides I used. I had to talked about distributed systems in 30 minutes, and it was a interesting challenge. I will write down some of the things I talked about soon, specially the timeline for some of the distributed systems technologies.


View more presentations from Srinath Perera.

Tuesday, November 8, 2011

WSO2 Con 2011: Data Panel

Following is the recording of the data panel, and you can find the openning I did from here.

Monday, October 31, 2011

Shelan's talk at Telecom 2011


Shelan's talk at Telecom 2011 (http://world2011.itu.int) participating as a young innovator. The conference was held in Vianna. His proposal is a medical report management framework based on Mahasen project, a final year project at University of Moaratuwa to build a scalable storage framework building on to of P2P technologies.

Saturday, October 29, 2011

List of Known Scalable Architecture Templates

New version of this article can be found in https://medium.com/@srinathperera/a-list-of-known-scalable-architecture-templates-a85c386cf6cb.

For most Architects, "Scale" is the most elusive aspect of software architecture. Not surprisingly, it is also one of the most sought-after goals of today's software design. However, computer scientists do not yet know of a single architecture that can scale for all scenarios. Instead, we design scalable architectures case by case, composing known scalable patterns together and trusting our instincts. Simply put, building a scalable system has become more an art than a science.

We learn art by learning masterpieces, and the scale should not be different! In this post, I am listing several architectures that are known to be scalable. Often, architects can use those known scalable architectures as patterns to build new scalable architectures.
  1. LB (Load Balancers) + Shared nothing Units - This model includes a set of units that does not share anything with each other fronted with a load balancer that routes incoming messages to a unit based on some criteria (round-robin, based on load etc.). A unit can be a single node or a cluster of tightly coupled nodes. As the Load balancer, users can use DNS round robin, hardware load balancers, or software load balancers. It is also possible to build a hierarchy of load balancers that includes combination of above load balancers. The article, "The Case for Shared Nothing Architecture" by Michael Stonebraker, discusses these architectures
  2. LB + Stateless Nodes + Scalable Storage - Classical Three tire Web architectures follows this model. This model includes several stateless nodes talking to a scalable storage, and a load balancer distributes load among the nodes. In this model, the storage is the limiting factor, but with NoSQL storages, it is possible to build very scalable systems using this model.
  3. Peer to Peer Architectures (Distributed Hash Table (DHT) and Content Addressable Networks (CAN)) - This model provides several classical scalable algorithm, which almost all aspects about the algorithm scaling up logarithmically. Example systems are Chord, Pastry (FreePastry), and CAN. Also several of the NoSQL systems like Cassandra is based on P2P architectures. The article "Looking up data in P2P systems" discuss these models in detail.
  4. Distributed Queues – This model is based on a Queue implementation (FIFO delivery) implemented as a network service. This model has found wide adoption through JMS queues. Often this is used as task queues, and scalable versions of task queues scale out by keeping a hierarchy of queues where lower levels sends jobs to upper levels when they cannot handle the load.
  5. Publish/Subscribe Paradigm - implemented using network publish subscribe brokers that route messages to each other. The classical paper "The many faces of publish/subscribe" describes this model in detail and among examples of this model are NaradaBroker and EventJava.
  6. Gossip and Nature-inspired Architectures - This model follows the idea of gossip in normal life, and the idea is that each node randomly pick and exchange information with follow nodes. Just like in real life, Gossip algorithms spread the information surprisingly fast. Another aspect of this are Biology inspired algorithms. Natural world has remarkable algorithm for coordination and scale. For example, Ants, Folks, Bees etc., are capable of coordinating in scalable manner with minimal communication. These algorithms borrow ideas from such occurrences. The paper "From epidemics to distributed computing" discusses the models.
  7. Map Reduce/ Data flows - First introduced by Google, MapReduce provides a scalable pattern to describe and execute Jobs. Although simple, it is the primary pattern in use for OLAP use cases. Data flows are a more advanced approach to express executions, and projects like Dryad and Pig provide scalable frameworks to execute data flows. The paper,  "MapReduce: Simplified data processing on large clusters"  provides a detailed discussion of the topic. Apache Hadoop is an implementation of this model.
  8. Tree of responsibility - This model breaks the problem recursively and assign to a tree, each parent node delegating work to children nodes. This model is scalable and used within several scalable architectures.
  9. Stream processing - This model is used to process data streams, data that is keep coming. This type of processing is supported through a network for processing nodes. (e.g. Aurora, Twitter Strom, Apache S4)
  10. Scalable Storages – ranges from Databases, NoSQL storages, Service Registries, to File systems. Following article discusses their scalability aspects.
Having said that there are only 3 way to scale: that is distribution, caching, and asynchronous processing. Each of the above architectures uses combinations of those in their implementation. On the other hand, the scalability killer, apart from bad coding, is global coordination. Simply put, any kind of global coordination will limit the scalability of your system. Each of aforementioned architectures has managed to achieve local coordination instead of global coordination.

However, combining them to create a scalable architecture is not at all trivial undertaking. Unless you are trying to discover new scalable pattern, often it is a good idea to solve problems by adopting known scalable solutions than coming up with new architecture using first principals.
If you enjoyed this post, you might also like my new Book: Software Architecture and Decision-Making.
Get the Book, find more find more details from the Blog.
Please note that as an Amazon Associate, I earn from qualifying purchases.

Wednesday, October 26, 2011

InfoQ Article: Finding the Right Data Solution for Your Application in the Data Storage Haystack

The article "Finding the Right Data Solution for Your Application in the Data Storage Haystack" just went live on InfoQ and you can also find the slide deck of the NoSQL Now talk in this earlier post.

I firmly believe that the reason scale and some of other problems are too hard because we are too lazy to consider specific cases and analysis them in detail. Instead we are trying to find general answers that works everywhere. For an example, I can not find a taxonomy of Computer Science usecase/domins anywhere (will write about this in a later post).

Following article takes four parameters about an application/usecas, then take some 40+ cases that arises from different combination of those parameters and make concrete recommendations for each case from the storage solutions Haystack (e.g. Local memory, Relational, Files, Distributed Cache, Column Family Storage, Document Storage, Name value pairs, Graph DBs, Service Registries, Queue, and Tuple Space etc.).

It is intended as a guide to choose the right storage (SQL or NoSQL) solution for a given usecase.

Four parameters are
  •  Types of data stored (structured, unstructured, semi-structured)
  • Scalability requirements (small 1-4,  medium 10s, and very large 100s)
  • Nature of data retrieval (i.e. Types of Queries: key lookup, WHERE, JOIN, Offline)
  • Consistency requirements (ACID, single atomic Operation, loose consistency)
I do not consider the second part is done in any way. I am sure there is lot to argue and analyze there, and please let me know if you have any thoughts on this. 

Tuesday, October 25, 2011