Cancellation, Context, and Plumbing by Sameer Ajmani
Go makes it easy to start goroutines but doesn't provide any way to stop them. Efficiently canceling unnecessary work is a critical part of making programs scale well. We developed an API called Context to signal request cancelation and provide a way to pass request-scoped data from incoming RPCs to outgoing ones. But now we're faced with the problem of plumbing Contexts into millions of lines of Go code at Google. I'll describe ongoing work that uses static analysis and large-scale refactoring tools to tackle this problem.
Sameer Ajmani leads the Google NYC Go team, which works on making Go work well in Google production systems and on mobile platforms. His prior projects include Bigtable, content distribution pipelines, Making the Web Faster, and Google Maps. He lives in Prospect Heights, Brooklyn with his wife and three children was interviewed recently on WNYC about how to manage screen time for kids.