Hsaura Storage in Go: 5x performance increase and 40% less RAM
Blog post from Nhost
Hasura Storage, an open-source service used by Nhost to integrate S3-compatible cloud storage with Hasura, underwent a transition from Node.js to Golang to enhance performance and scalability as the company's user base expanded. The decision to rewrite the service was driven by Golang's efficient dependency management, cloud compatibility, and performance capabilities, despite its verbosity compared to Node.js. Benchmark tests revealed substantial improvements in several metrics, including a 5x increase in requests served while halving memory consumption, and a significant reduction in minimum and P95 response times across most scenarios. The rewrite also led to a 40% reduction in RAM usage in production, allowing for better resource utilization and handling of increased traffic without escalating infrastructure costs. These enhancements were achieved even when both versions relied on the same C library for image manipulation, highlighting the effectiveness of the Golang transition in optimizing service performance.