After years of python programming I started at a company that was using Google’s C/C++ alternative Go (aka Golang) for its core product. While I definitely missed some of Python’s neat features and amazing standard library, I was very impressed by one thing in Go: its approach to parallelism. That is why in this workshop I want to give an example of how to build a highly parallel service in Go, from the perspective of someone that knows what it means to leave Python’s niceness behind.

I will start by giving you some motivation of why you might be tempted to even try Go, mostly by giving some technical background of how parallel execution works in Python versus how it works in Go. After being properly motivated, our actual programming will start simple: we will build our first API call in Go, including the infamous task of taking untyped JSON and putting it into a typed Go struct. Nothing parallel just yet.

The next step is the exciting part, as we will call two APIs in parallel, using channels and goroutines, Go’s core language features for parallel execution. All this we will wrap in a nice job abstraction, with a start method, so we feel right at home as Python developers. To ward us against slow APIs we will then add a parallel timeout and stopping behavior.

In the description I promised you a service, so this is what we will do in the end. We will implemented a Go HTTP server that spawns a new goroutine for every request, which in turn will spawn a goroutine for each of our API calls. So much parallelism! But I promise you, this will not result in any headaches.

Instructions for the workshop

Before joining the workshop, make sure you have Go installed in your local environment. Head out to the workshop repo and follow the instructions

Dominik Henter

Affiliation: Ecosia

Dominik Henter studied Computer Science at the TU Kaiserslautern, while working part-time as a research assistant at the DFKI (German Research Center for Artificial Intelligence). Having spent several years in the Palatinate Forest and multiple months in different rainforests his love for tech was joined by a love for nature. This is why, after some jobs in Machine Learning and Data Engineering, he is now working as a Fullstack Developer at Ecosia.

visit the speaker at: GithubHomepage

Jéssica Lins

Affiliation: Ecosia

Born and raised in Brazil, Jéssica Lins also studied Computer Science there. During her studies, she did some internships and also had the chance to take part in an exchange program at Politecnico di Torino, in Italy. Today she is based in Berlin working mainly with backend development using Go and Python, and is happy that she can apply her programming skills towards a greener planet by working at Ecosia.

visit the speaker at: GithubHomepage