AlgoTraderAlgoTrader Documentation

Chapter 9. Caching

9.1. Hazelcast Introduction
9.1.1. Persistence
9.1.2. Cache access
9.1.3. Configuration

AlgoTrader uses an in-memory data-grid solution called Hazelcast. This layer resides between the application layer (business logic) and persistence. It is responsible for providing easy and fast access to any persistent data for both read and write operations.

As a general rule we can assume, that there is at least 1 magnitude difference in speed between reading from RAM and from disks. Algotrader uses in-memory caching not only to provide clear separation between persistence and application layer, but to be able to perform high-speed trading without being bound to disk speed. This approach however requires some changes to what could be considered "standard" way of implementing persistence in Java applications.

The caching layer separates the application layer from the persistence logic. The application layer does not directly access DAO methods anymore and is required to go through CacheFacade classes to access data. These CacheFacade classes internally rely on Hazelcast IMaps. IMaps have similar characteristics to the standard Java Map interface. The biggest difference being the possibility to attach MapStores to these maps, giving them the ability to use persistent storage.