Skip to main content

Book review: Cloud Native Go

·937 words·5 mins
Go Cloud Review

The full title of this book is Cloud Native Go: Building Reliable Services in Unreliable Environments and it is written by Matthew A. Titmus. It was published in 2021 by O’Reilly Media. This review is for the first edition of the book1.

What is cloud native?
#

This is the question that is at the heart of this book, and all code samples in the book address issues that cloud native applications are expected to handle. The book has a nice mix of theoretical parts and practical advice and code samples that are ready to use in your own projects. Among the theoretical chapters the answer to what it means to be cloud native can be found. Three separate schools of thought on this is presented:

  • The concept of dependability. Dependability is not something you measure with a metric and put on a dashboard. It is the union of availability, reliability, and maintainability. Ways of achieving dependability include means such as fault forecasting, fault removal, fault tolerance, and fault prevention.
  • The Twelve Factor App methodology is a list of twelve factors that a cloud native system should possess. If you are not familiar with the twelve factor methodology I recommend reading through the official page.
  • The Cloud Native Computing Foundation’s (CNCF) definition of cloud native technologies. The essential details of the definition is that a cloud native application should be scalable, loosely coupled, resilient, manageable, and observable.

The main part of the book (chapters seven through eleven) are centered around the CNCF definition of cloud native, where each chapter addresses one of the attributes of a cloud native application. This is a book about Go after all, so each chapter discusses the cloud native attributes through the lens of the Go programming language.

A few highlights
#

Extended code example
#

When you read a book with the word “Go” in the title, you expect to find a lot of Go code spread throughout the book. Personally I think there could have been a lot more code than it was.

However, the fifth chapter contains a great extended example where you get to create a simple key-value store service. Usually an extended example of this size always involves creating a todo-application, so this chapter was a breath of fresh air! A word of warning, there are some gaps in the chapter about how to organize your source code. At one point Matthew refers to a file called service.go without previously mentioning it (or any other file for that matter). I followed along the chapter and wrote the service and discovered a bug. After visiting the GitHub repository that comes with the book I found where the discrepancy was and corrected it.

The extended example presented in chapter five is revisited later in the book during the discussion of the cloud native attributes.

Code efficiency discussion
#

If you pick up any book about cloud computing and read about scalability chances are you will read about setting up auto-scaling for your container workloads, or just use serverless functions and all that will magically be taken care of for you. Matthew also discusses these topics, but I was pleasantly surprised to also find discussions about code efficiency. Scaling the number of containers you use is not always the best solution to your problems, especially if you have to do it just to cover for inefficient code. There are a few code snippets to illustrate some common techniques, such as LRU2 cache and sharding.

Humor
#

Picking up a 400-page technical book is not everyone’s favorite activity3. The writing style of this book is very relaxed, and at times humorous. I got through this book much faster than many other books of the same size.

Will I learn Go by reading this book?
#

The answer to this question depends on your background.

  • If you pick up this book with no previous experience of Go, then you will have to walk a few extra miles4 to get through it. There is a chapter discussing the basic building blocks of Go, but in no way near enough depth to get proficient in the language. I noticed that some major things were left out of the introductory Go chapter5. However, there are additional details about Go sprinkled throughout the book close to code samples where this information is required.
  • If you have experimented with Go enough to know all the building blocks, then you will have no problem to follow along the code examples in this book.
  • If you have extensive knowledge of building cloud native services in other programming languages then you will enjoy learning how to do similar things using idiomatic Go. However, if you are in this situation I don’t think that this should be the primary book you should use to learn Go. This is because a lot of the theoretical parts of this book will most likely already be familiar to you.

Summary
#

All in all I think this was a great read. I like the concrete and applicable code examples to look at. I appreciated how the book strives to give a holistic view of what it means to write (Go) code for the cloud and to strive for the cloud native attributes.


  1. Matthew mentions several times that he is already thinking about changes for the second edition. ↩︎

  2. Least Recently Used. A cache technique where the least recently used item is evicted when the cache is full. ↩︎

  3. It is one of my favorite activities! ↩︎

  4. Perhaps by first visiting the official Go website at https://go.dev/↩︎

  5. For instance, there is no mention of package main or similar. ↩︎

Mattias Fjellström
Author
Mattias Fjellström
Cloud architect consultant and an HashiCorp Ambassador