Skip to content

Latest commit

 

History

History
48 lines (27 loc) · 2.59 KB

Reducing-Garbage.adoc

File metadata and controls

48 lines (27 loc) · 2.59 KB

Chronicle Garbage Reduction

Reducing Garbage

Reducing garbage has several benefits:

  • The obvious benefit is pausing for a Garbage Collection less often.

  • Creating fewer objects, will reduce the work allocating and clearing the object in the first place.

  • Some indirect benefits include simplifying the object life cycle, which reduces the amount of time a GC takes. This also reduces noise when trying to optimise an application which produces garbage.

Placing the bulk of data off-heap.

Chronicle Queue, Map and Market Data Distributor, support storing tera-bytes of data off-heap without adding significantly to the heap size or time to GC. Off heap memory can be as large as your disk space which can be several times main memory size and far beyond what is a practical heap size.

This frees up your JVMs to use data more freely at a lower cost and simplify your designs.

Off heap memory is persisted and shared.

Chronicle Queue Map and Market Data Distributor, support concurrent writers and readers using persisted shared memory. This means there is only one copy in memory and no need for a broker. If all processes die, no data is lost (unless the OS also dies). To protect your system against and OS failure we recommend using chronicle queue or chronicle map replication.

Note
Chronicle FIX uses Chronicle Queue to persist its data.

Recycling objects

Chronicle software is designed to recycle objects as much as possible. After a full GC, these end up in tenured space where they stay and have little impact on minor collections.

For example, if you want to send or receive a POJO or FIX Message, the object holding the data can be serialized or deserialized without creating new objects.

POJOs are recycled even when deserialised

Most serialziation libraries expect to create new objects each time they are deserialized however Chronicle supports using flyweights to deserialize data into existing objects.

Chronicle uses POJOs rather than Maps.

Many other libraries use HashMaps as flexible dynamic data structures but these can create several objects per attribute which in turn later have to be garbage collected by the JVM.

The Chronicle libraries dynamically access real POJO objects with primitives or mutable buffers for fields. This can reduce the object creation to zero on deserialization.

Chronicle supports object pools.

Also, to minimise object creation Strings and other immutable types, are efficiently object pooled Looking up the objects in the pool can be as fast on average as creating new objects, but with lower memory footprint and far less garbage created.