Case Study: Zero Garbage Collection

Garbage Collection and Performance

Java has significant strong points, such as time to market, scope of deployment, extant expertise. But the most common reservation – performance – is largely a product of poor garbage collection. Java-based applications can provide extreme performance and determinism if properly architected.

The Flyer FIX Engine is a living platform, designed to continuously take advantage of the latest state of the art. One aspect of this is our Zero Garbage Collection model. Our goals here are:

  • Reduce (or remove entirely) intra-day object allocation
  • Eliminate jitter cause by Garbage Collection operations
  • Eliminate JVM pauses caused by Stop-The-World events
  • Improve L1-L2-L3 cache coherence by reducing object allocation rates
  • Reduce jitter caused by swapping

On the high level, this means the capability to run the entire trading day in memory/head with:

  • the standard collector
  • no stop-the-world Garbage Collection
  • no intermittent Garbage Collection

Design

Since its inception, the Flyer FIX Engine has been designed with these goals in mind.

  • 7+ years of research & development
  • Object allocation at startup
  • Re-usable core objects
  • No traditional internal queues
  • Reduce threading-based context switching
  • Lock free concurrent structures
  • Reduce method sizes

Libraries

The Flyer FIX Engine leverages a few libraries that share similar philosophies.

We also avoid certain other libraries or parts of libraries that have hidden (or sometimes egregious) allocations

  • Google Guava (certain collections)
  • Sun Java SelectedSelectionKeySet

We have developed allocation-free replacements. For instance, our CharUtil class provides byte[]->native and native->byte[] operations.

Design in Practice

Developers must code to avoid object allocations, particularly frequent or per-transaction allocations.

  • Re-usable classes
  • Stick with native classes
    • int value = CharUtil.byteToInt()
    • double value =CharUtil.byteToDouble();
    • TIntObjectHashMap + forEachValue() iterators
  • Avoid implicit operations
    • Iterators
    • Auto-boxing
    • toString()
  • ThreadLocal to provide re-usable per-thread copies
  • Leverage shared memory solutions for off-head data structures

The Flyer FIX Engine Advantage

Not only is our FIX platform based on these principles, but Flyer has a world class developer support team able to provide guidance, advice, code review, and development professional services on top of and alongside the Flyer FIX Engine platform. Contact us today!

  • Share

About FIX Flyer

With over 120 clients worldwide, FIX Flyer develops advanced technology for managing complex, multi–asset, institutional securities trading using highly scalable software and network technologies.

Learn More