The CAP theorem provides system designers with a choice between three guarantees: consistency, availability, and partition tolerance. While partitions are rare, there is an incredible range of flexibility for handling partitions and recovering from them. Thus, our goal is to
Strata + Hadoop World London 2016 we’re on our way! Join us at Booth #331 to learn about our new Spark Distribution and hear the latest on XAP 11! We’re very excited to be in London and can’t
After having the opportunity to present this topic at the recent Big Data Expo in Utrecht, Netherlands (and a few other expos) I thought it would also be a good time to share my thinking with the online community. Data storage &
What It Takes to Implement Massive Scale Event Processing
- Partitioning and distribution: Perhaps the single most important trait when it comes scaling your system. If you can efficiently and evenly distribute the load of events across many event processing nodes (and even increase the number of nodes as your system grows), you will ensure consistent response times and avoid accumulating a backlog of unprocessed events.
XAP allows for seamless content based routing, based on properties of your events. It also supports adding more nodes on the fly if needed.
- In memory data: in many cases, you need to access and even update some reference data to process incoming events. For example, if you’re calculating a financial index you may need to know if a certain event represents a change in price of a security which is part of the index, and if so you may want to update some index related information. Hitting the network and the disk for every such event is not practical at the scale we’re talking about, so storing everything in memory (the events themselves, the reference data and even calculation results) makes much more sense. An in memory data grid allows you to achieve that by implementing memory based indexing and querying. It helps you to seamlessly distribute data across any number of nodes, and takes care of high availability for you. The more powerful your in-memory indexing and querying capabilities are, the faster you can perform sophisticated calculations on the fly, without ever hitting a backend store or accessing the network. XAP’s data grid provides high availability, sophisticated indexing and querying, and a multitude of APIs and data models to choose from.
- Data and processing co-location: Once you’ve stored data in memory across multiple nodes, it’s important to achieve locality of data and processing. If you process an incoming event on one node, and need to read and update data on other nodes, your processing latency and scalability will be very limited. Achieving locality requires a solid routing mechanism, that will allow you to send your events to the node most relevant to them, i.e. the one that contains the data that is needed for their processing. With XAP’s event containers, you can easily deploy and trigger event processors that are collocated with the data and make sure that you never have to cross the boundaries of a single partition when processing events.
- Fault tolerance: Event processing is in many cases a multi-step process. For example, even the simplest use case of counting words on twitter entails at least 3 steps (tokenizing, filtering and aggregating). When one of your nodes fail, and it will at some point, you want your application to continue from the point in which it stopped, and not go through all the processing flow for each “in-flight” event (or even worse, completely lose track of some events). Replaying the entire event flow again can cause numerous problems: If your event processing code is not idempotent your processors will fail. And under high loads this can create a backlog of events to process, which will make your system less real time and less resilient to throughput spikes. XAP’s data grid in general, and event containers in particular, are fully transactional (you can even use Spring’s declarative transaction API for that if you’d like). Each partition is deployed with one synchronous backup by default, and transactions are only reported committed once the all updates reach the backup. When a primary fails, the backup takes over in a matter of seconds and continues the processing from the last committed point. In addition, XAP has a “self healing” mechanism, which can automatically redeploy a failed instance on existing or even new servers.
- Integration with batch oriented big data backends: Real time event processing is just part of the picture. There are some insights and patterns you can only discover thorough intensive batch processing and long running Map/Reduce jobs. It’s important to be able to easily push data to a big data backend such as Hadoop HDFS or a NoSql database, which unlike relational databases, can deal massive amounts of write operations. It’s also important to be able to extract data from it when needed. For example, in an ATM fraud detection system you want to push all transaction records to the backend, but also extract calculated “patterns” for each user, so you can compare his or her transactions to the generated pattern and detect frauds in real time. You can use numerous adaptersto save data from XAP to NOSQL data stores. XAP’s open persistency interface allows for easy integration with most of these systems.
- Manageability: & Cloud Readiness: Big data apps can become quite complex. You have the real time tear, the Map/Reduce / NoSql tear, a web based front end and maybe other components as well. Managing this consistently, and more so on the cloud which makes for a great foundation for big data apps, can easily become a nightmare. You need a way to manage all those nodes, scale when needed and recover from failure when they happen. Starting from XAP 9.0, XAP users can leverage all the benefits of Cloudify, to deploy and manage their big data apps in their own data center or on the cloud, with benefits like automatic machine provisioning for any cloud, consistent cluster and application-aware monitoring and automatic scaling for the entire application stack, and not just the XAP components.
XAP 9.0 for Big Data Event Processing
- FIFO groups (AKA Virtual Queues): this feature is quite unique to XAP. It allows you to group your events based on the value of a certain property, and while across groups you can process any number of events in parallel, within the same group you can only access one event at a time, ordered by time of arrival. Think of a homeland security system with multiple sensors – in many cases you want to process readings from the same sensor in order, so you can tell for example if a certain suspicious car is moving from one place to another, and not vice versa, but across sensors you want to process as many events as possible.
- Storage types: Most real time analytics systems rely heavily on CPU and memory. So using them efficiently is always important. With XAP 9.0 we’ve introduced a new mechanism that allows users to annotate object properties (object can represent both events and data) with one of 3 modes – native (meaning the property is saved on the heap as a native object), binary (the property is serialized and is only deserialized when an actual client reads it) and compressed (same as binary, with gzip compression). This allows for fine-grained control over how the memory is utilized and save your application from doing unnecessary serialization and deserialization when accessing the data grid.
- Transaction-aware durable notifications: Pub/Sub notification are important in scenario where you want a certain event to trigger multiple flows, or be processed in parallel on multiple servers. It is also useful when propagating processing results downstream to other applications. With XAP 9.0 we’ve enhanced our pub sub capabilities to be durable (i.e. even if a client disconnects and reconnects it will not miss an event) and provide once and only once semantics. In addition, Notifications for data grid updates (e.g. event objects written or removed, other data updated) maintain transaction boundaries. That means that if multiple events were written, or multiple pieces of data updated, the subscribed clients will be notified on all of them or none at all.
- Reliable, transaction-aware local view: another interesting use case when it comes to event processing is when you want you event processor to be located outside of the data grid. This gives you the benefit of scaling your event processors separately from the data grid, at the expense of accessing the data over the network. However using the local view feature allows you to locally cache within the processor’s process, a predefined subset of the data that you to be relevant to your processing logic. The local view mechanism will make sure it stays consistent, up to date and that you never miss a data update even after disconnecting and reconnecting.
- Web Based Data Grid Console: Understanding what’s going on with your events, what types of events are queued, and what data resides in the data grid is essential to the operation of every event processing system. XAP’s new data grid console allow you to monitor everything within the data grid from your browser using intuitive HTML5 interface. You can view event and data counters, submit SQL queries to the data grid, and do a lot more.
- Cloud Enablement: XAP 9.0 comes with Cloudify, our new open source PaaS stack built in, which allows you to manage all of the components of your big app, including the backend Hadoop or NoSql database and the web front end.