[x^2 for x in lst]

Cloud Native Patterns

Author: Cornelia Davis

Review created: 2019-08-02

Cloud Native Patterns by Cornelia Davis is the first book that I've read that is about patterns that could be used in applications that from the beginning are built to be deployed in the cloud. The book includes some code (written in Java using Spring), but the main focus of the book is not actual code, but the principles behind how to structure an application or a system of applications so that it "behaves well" when deployed and executed in the cloud. To behave well an application should:

  • be able to deploy often
  • be able to deploy easily with zero downtime and with no impact on consumers
  • be able to scale out (and in) in an easy manner
  • handle service discovery
  • handle overload in a gracious fashion
  • be secure
  • ...

And so on.

Cloud Native Patterns discusses most of these things, the exception being security, in detail. It describes why a certain trait is needed and outlines patterns for how to implement it.

The books includes a running example about a blog aggregator service where users can register interest in a number of blogs and the service then collects posts from those blogs and presents them to the user. The service is comprised of three different microservices: the user-connection service, the blog post receiver and the blog posts for user service. These three microservices are evolved in a number of versions in order for the author to illustrate the problems and patterns that the book discusses. All versions of the code can be downloaded from a GitHub repo.

Having a single running example is a good pattern indeed. I makes it easy to describe a problem and a solution to it without having to introduce a new set of services for each problem or pattern. After the first discussion of the example, which isn't very complicated, you basically know everything you need to know about what the different micro-services are supposed to do.

The code is, as previously mentioned, written in Java and built using maven. The services are then deployed locally on Kubernetes using Minikube.

If you don't know java, that is not a problem as long as you know any related language, e.g C++, Python or similar, as the code examples are really basic. Of course there are some Spring magic in them, but not very much, and the stuff that is included is pretty self-explanatory.

The author explains Kubernetes a little bit. Not very much about the overall product, but the commands that are used to run the examples are explained quite well. I did not know almost anything about Kubernetis when I started reading the book but had no trouble following the code examples in it.

Near the end of the book, when event logs and event sourcing are discussed, Apache Kafka is starting to be used in the running example. Here I felt that a little more explanation would have been good. Suddenly, without any discussion, Kafka-related stuff just appears in the code. A couple of sentences describing what Kafta is would have been nice either just before or just after the first code example using it.

So what patterns are included in the book? I noted the following ones while reading it:

  • Retries
  • Service discovery
  • Circuit breaker
  • API gateway
  • Sidecar
  • Service mesh
  • Logging
  • Metrics
  • Distributed tracing
  • Event log
  • Event sourcing

As you can see from the list, not all the "patterns" are what you might expect if you are familiar with regular design patterns. Some, like logging, are more like areas that 1) pose additional challenges to cloud applications compared to applications deployed on the ground and 2) are really important to solve well.

The author does a good job of explaining each "pattern", why it is important, what might happen if it is not considered in the architecture of an application, and how possible solutions may look like. The solutions are discussed on a high level and does not include any cloud-provider (AWS, GCP, Azure, ...) specific things at all. As previously mentioned, the running code example uses Kubernetes/Minikube.

The list of patterns included in the book feels exhaustive. All patterns are relevant and I cannot think of any more pattern that should have been included.

The book is written in a easy-to-read fashion, which makes it enjoyable and quick to read. I managed to finish it in just a couple of days.

Summary: Cloud Native Patterns is a book that all programmers building applications for the cloud should read. If you are really experienced in writing such applications, you might not pick up very much new things, but then you can compare your solutions for the "patterns" in the book to the ones of the author. Do not expect to get any information about the services offered by certain cloud providers however, as such are not discussed. As AWS is the cloud provider that I use most of the time (all of the time to be honest), I think that it would be nice if the author could write a sequel called "Cloud Native Patterns using AWS". If she would, I would buy that book at once. :)