Hasty Briefsbeta

Bilingual

Tune Code Before Your Garbage Collector

6 days ago
  • #Java Performance
  • #Garbage Collection
  • #Low Latency
  • Memory allocation optimization in Java can have a greater impact on performance than the choice of Garbage Collector (GC).
  • A benchmark using JLBH for MarketDataSnapshot to NewOrderSingle at 50K/s for 30 minutes compared logging with SLF4J versus no logging (using Chronicle Queue).
  • Adding redundant SLF4J logging significantly degraded latency metrics (p99 and p99.99) across various GCs like Parallel, ZGC, G1, and Shenandoah.
  • Moving logs to a tmpfs filesystem reduced latency, but removing redundant logging entirely led to even greater improvements, with p99.99 dropping by three orders of magnitude.
  • Removing logging changed the optimal GC choice: Parallel GC performed best, while Shenandoah worsened, highlighting that workload optimization should precede GC tuning.