Did you know? DZone has great portals for Python, Cloud, NoSQL, and HTML5!

Peter is a DZone MVB and is not an employee of DZone and has posted 79 posts at DZone. View Full User Profile

Ultra low latency Event Store

02.08.2012
Email
Views: 3213
  • submit to reddit

There are two basic libraries for managing data in Java, JDBC (for connecting to database) and JMS (for messaging). For some use cases you ideally want both, and you want it to be very fast.

History

This is a redevelopment of a previous project HugeCollections The project is still on hold because its too complex IMHO for what it does. This library is lower level and much simpler to understand. It may become the basis for the higher level HugeCollections library.

The Java Chronicle Library

This library attempts to provide ultra low latency, high throughput, persisted, messaging and event driven in memory database with random access to previous messages) The typical latency is as low as 16 nanoseconds (between processes), supporting throughputs of 5-20 million messages per second.

Technical Features

  • It uses almost no heap with trivial GC impact regardless of size, 
  • It can be much larger than your physical memory size (only limited by the size of your disk). and can be shared *between processes* with better than 1/10th latency of using Sockets over loop back. 
  • You can attach any number of readers, including tools to see the exact state of the data externally. e.g. I use; od -t cx1 {file} to see the current state. 

It can change the way you design your system because it allows you to have independent processes which can be running or not at the same time (as no messages are lost) This is useful for restarting services and testing your services from canned data. e.g. like sub-microsecond durable messaging. 

Modes of use

The library can be used in two modes. You can use it as an event driven persisted journal but polling when new excepts are added, or as a re-writable random access store but accessing it randomly and changing what you want. If you want both, you need two chronicles, one to be updated with the latest values and one to notify events.
The main limitations are that it only designed for one writer, and "extracts" or records cannot be made larger once they are written.

Download or Browse the Java Chronicle Library

 

From http://vanillajava.blogspot.com/2012/02/ultra-low-latency-event-store.html

Tags:
Published at DZone with permission of Peter Lawrey, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)