Why architecture matters here

Dedup fails on wrong workload + CPU overhead. Architecture matters because dedup + interning + alternatives compose.

Advertisement

The architecture: every piece explained

The top strip is basics. String allocation. G1 string dedup. Compact strings. intern().

The middle row is tradeoffs. Dedup table. Cost. Metrics. Alternatives.

The lower rows are ops. String pool sizing. GC impact. Ops — tuning + measurement.

Java string dedup — G1 dedup + intern + memory tradeoffscollapse duplicate strings to save memoryString allocationduplicates commonG1 string dedupbackground scanCompact stringsLatin-1 vs UTF-16intern()explicit dedupDedup tableweak-referencedCostCPU vs memoryMetricsdedup rate + savingsAlternativesapp-side interningString pool sizing-XX:StringTableSizeGC impactreduce livesetOps — tuning + measurement + rollbackweaktrademeasurealternatesizereducereduceoperateoperate
Java string dedup: G1 + intern + compact strings.
Advertisement

End-to-end flow

End-to-end: log-heavy app with many duplicate strings. G1 dedup enabled. Compact strings default. Dedup rate 12%, saving 250MB heap. GC pauses shorter.