A few month ago, I have built a Readlist Application to keep track of interesting reads. Back then I used Python with Flask to build the backend of the service.
However, recently I started learning the Go programming language. I then used the opportunity to rewrite the backend using Go with gqlgen.
Previous blog post: https://www.hagen-schupp.me/2020/05/18/ReadlistApplication.html
As most tutorials for programming languages cover rather simple problems only, and I wanted to deepen my knowledge on Go, I was looking for a project that was more complex than a simple Hello World
program.
The Readlist backend had to combine a GraphQL based webservice that also needed to connect with a MongoDB NoSQL-database.
This means the project had to deal with dependency management.
Reimplementing the backend using Go meant to go from an untyped, interpreted language to a strictly typed and compiled language. A compiled language has several advantages over an interpreted language:
Developing using Go was an interesting task. There was a steep learning curve to deal with Go Modules, using the Go MongoDB driver and to use GraphQL in a Go context. It took longer to write the code than the Python impementation mainly due to my previous knowledge on Python and the overhead because of having to define the required types.
The savings in the size of the Docker image are massive: -98%. These savings will make the launch of the Docker daemon faster. Additonally it help to reduce carbon-dioxide emissions: https://medium.com/stanford-magazine/carbon-and-the-cloud-d6f481b79dfe. The savings for our service are marginal, but in a larger context of being more efficient with storage and compute resources, this can have a huge impact.
Another benefit is the reduced latency of the Readlist Application measured on client side: loading & rendering a full readlist takes ~150ms with the new Go backend. The Python backend was slower and took ~300ms.
I hope you find this comparison helpful. I found the project to rewrite the backend very helpful in getting more expose to Go. ✌️