Juggling with Bits and Bytes
summary
Explains Flink’s active memory management that allocates 32KB memory segments (on- or off-heap), writes with sun.misc.Unsafe-backed serializers and operates directly on bytes; sorting uses a two-region buffer with fixed-length binary prefix keys and pointers to full objects so most compares avoid deserialization. Benchmarks sort 10M records (~150 MB): heap-object sort uses ~700 MB and triggers GC spikes, serialized sort uses 277–315 MB serialized footprint and minimal GC. Hybrid-hash and external-merge strategies spill gracefully when data exceeds memory.
AI-written summary · about
chapters (18)
- 0:00Introduction to memory management
- 3:40Flink’s active memory approach
- 9:01Memory segments and allocation
- 13:16Serialization stack and type system
- 18:11Operating on binary data
- 20:16External sort merge example
- 24:09Performance benchmarks
- 30:48Handling disk spills
- 32:11Optimizing memory layout
- 33:37Summary and future work
- 35:24Q&A on type extraction
- 36:30Optimizing group operations
- 38:39Compression in serialization
- 39:43Java Unsafe and licensing
- 42:53Disk spills and fragmentation
- 46:06Memory fragmentation in delta iteration
- 47:30Deserialization from off-heap
- 48:02Fallback to Kryo serialization
