Why Discord is switching from Go to Rust

Click for: original source

Jesse Howarth wrote this piece about how they seen success with Rust on the client side and server side. For example, they use it on the client side for our video encoding pipeline for Go Live and on the server side for Elixir NIFs. Most recently, they drastically improved the performance of a service by switching its implementation from Go to Rust.

Rust is blazingly fast and memory-efficient: with no runtime or garbage collector, it can power performance-critical services, run on embedded devices, and easily integrate with other languages.

Their post explains why it made sense for us to reimplement the service, how it was done, and the resulting performance improvements:

  • The Read States service
  • Why Go did not meet our performance targets
  • So why 2 minute spikes?
  • Memory management in Rust
  • Async Rust
  • Implementation, load testing, and launch
  • Raising the cache capacity

To explain why Go wasn’t meeting their performance targets, they also discuss the data structures, scale, access patterns, and architecture of the service. Good read!

[Read More]

Tags programming golang web-development how-to