when software rewrites are justified

Glauber Costa: rewrite in Rust only when fundamental conditions change, not language preference Confreaks
TL;DW
  • NVMe devices forced CPU-bound workloads instead of IO-bound, making Cassandra's Java architecture suboptimal—this architectural shift justified Scylla's C++ rewrite, not language preference.
  • Rewrite when fundamental conditions change (new hardware like NVMe, cost constraints, AI workload patterns), not because you prefer Rust or dislike the current language.
  • Software accumulates battle scars and undocumented quirks over time (e.g., SQLite's mysterious 1GB page insertion); rewrites lose this implicit knowledge unless you document it obsessively.
  • Inherit the ecosystem by keeping external interfaces stable—Scylla stayed Cassandra-compatible to reuse drivers/connectors; Terso stays SQLite-compatible rather than inventing new databases.
  • Database-per-tenant architecture with AI agents justifies Terso's SQLite rewrite: file-based nature enables billions of isolated databases, features like encryption and concurrent writes require async-first redesign impossible in C.
  • Avoid rewrites driven solely by language preference or desire for a blank canvas; resist the temptation to replace SQL or create entirely new systems when existing interfaces serve you well.
  • When truly rewriting, you're often building something architecturally different disguised as a rewrite—treat it as new software and use the language best suited (Rust now) rather than translating line-by-line.
  • Small compatibility bugs emerge when replacing established software; plan to hunt and fix them iteratively rather than achieving perfect compatibility upfront with new implementations.
  • The Cassandra community's skepticism of Scylla faded as NVME performance gains became undeniable; justified rewrites prove themselves through performance improvements that old architecture physically cannot match.
  • Cost reduction (40x performance, reduced memory spending at Datadog) can justify architectural rewrite when legacy system's fundamental design prevents optimization within the original framework.

Drawing on three rewrites—Cassandra in C++, a Datadog in-memory DB, and SQLite in Rust—Costa argues rewrites succeed when external conditions shift (NVMe, AI isolation needs, cost) and when the rewrite preserves the original's external interfaces to inherit ecosystem adoption rather than starting from scratch.