Four and a Half Years of Go in Production at goto Chicago 2016
Travis Reeder, CTO and co-founder of Iron.io, gave a talk at Goto Chicago 2016 discussing Iron.io’s early migration to Go, why we changed our infrastructure and the benefits it has brought to us.
One of the questions that always comes up after telling people we migrated to Go is:
“Why not Ruby?”
Some people were asking why we didn’t just try to optimize Ruby. It wouldn’t have been as big of a bang for our buck. It’s an order of magnitude faster in Go, so it would have been hard to mirror that gain in Ruby.
Concurrency is a fundamental part of the language, which is nice. The standard library has almost everything we need. It’s terse, compiles fast, it runs fast and Google is backing it.
(It’s also really fun to write.)
We ported our API to Go — the exact same API, we went overnight from 30 servers to 2. The two servers were barely being used, and this holds to this day, four years later.
It was a risky decision — the technology was new, and there was no community around it at that time. We weren’t sure if we could even hire a Go engineer. We were the first people to post a job to the Gonauts mailing list. Our investors were nervous.
Goroutines
Goroutines are like a super lightweight thread. Running hundreds of thousands of goroutines is no problem however; that’s a differentiation to threads. Behind the scenes, goroutines are multiplexed.
Channels enable you to communicate between goroutines. Instead of worrying about shared memory, you can use channels.
Reliability
It’s hard to quantify, but Go applications are fairly robust. We rarely have a failure or crash that wasn’t related to some external problem. The code tends to be cleaner and higher-quality; the compiler forces you to be strict with your code. You can do a lot with a small amount of very clean code.
Deployment
Go compiles into a single static binary file; you deploy by putting that file on a server. If you’re using Docker, you end up with a very tiny docker file. You don’t have to put JARs or gems or NPM modules. Our whole IronMQ binary is about 6 megabytes.
Go is now 6.5 years old — it was released in 2009. Today, thousands of developers are using Go code. At Google: Millions of lines of Go code in Google’s repos, including Kubernetes, Vitess.io, Google Data Server. At Intel: they’re exposing Intel platform features and prototyping cloud ecosystems in Go. Baidu is China’s largest internet portal, and they rewrote their entire HTTP stack in Go, serving a billion requests per day. Docker tools are all written in Go. Heroku is using Go for all their high-performance metrics, logging and routers. Dropbox rewrote their entire service layer in Go. Uber re-wrote their highest query-per-second service in Go.