Cloud-Ready with Go (Golang)

Digitization is a major topic these days. For example, more and more companies want to digitize and optimize their internal processes or services for customers. Often, they also have to keep up with the growing flow of customers by scaling their applications. In this context, the words cloud and Kubernetes often come up in the first conversation. There is no mention of a microservice-oriented or cloud-native development approach, for example with Go (often also referred to as Golang).


However, it’s not that simple to set up a cloud (and certainly not to work with Kubernetes). Existing legacy systems are to be made “cloud-ready” quickly, and during the initial conception of the necessary system landscape, people quickly see a looming cost explosion. In addition, many legacy systems have critical components that should not end up in a cloud without further ado.

It is therefore worthwhile to first take a look at the application itself. Among other things, you should consider the following aspects:

  • How high is the application’s resource consumption?

  • Is the application scalable?

  • Is it even possible to operate the application in its current form in a public cloud?

  • How well can the current application be maintained?

There are many other important points that need to be considered, but these simple questions can quickly determine whether the application is cloud-ready, and how useful it is to use an orchestrator such as Kubernetes. The consequence is often a new or further development of the application to enable a smooth deployment in the cloud.

Why Program Cloud Native?

If we move to the cloud, we want to take advantage of it. Otherwise, we could just add two more servers to our company’s server room. It’s important to create the awareness that the cloud is not a “Swiss Army Knife” solution, and also that not all software will work there immediately.

By taking a cloud-native development approach, we want to ensure that our applications are highly available, easier to maintain, and more resource-efficient, among other things. The likelihood of our application running successfully in the cloud over time is much higher with such an approach. A popular cloud-native programming language for this is Go.

What Are the Advantages of Golang?

Go is a compiled programming language with a short start-up time that does not require a virtual maschine. It is ideal for scalable system landscapes, such as Kubernetes, and is often used for developing cloud-native microservices. Go can be compiled for all common architectures and operating systems. This means that it is possible to start the application directly in the required system without having to ensure that a necessary virtual machine (e.g., JVM) is installed there for execution, for example. Another advantage is that by omitting such a virtual machine, Docker builds, for instance, become much leaner.

Example 1 shows a simple API service in Go:

As you can see, you can develop a small API Service with very few lines of code. Another advantage is its low resource consumption and the fact that it starts without lead time. The short consumption peak was generated by many consecutive requests and remains low.

Of course, some features of a fully fledged and robust API service are missing here, such as the distinction between GET/POST/PUT/DELETE; moreover, applications are very rarely this small.

The most common programming languages use frameworks to add such functionalities; therefore, we use a web framework as it is done with Spring Boot in Java applications in Example 2. We decided to go for the Gin Web Framework (GitHub – gin-gonic/gin: Gin is a HTTP web framework written in Go (Golang). It features a Martini-like API with much better performance — up to 40 times faster. If you need smashing performance, get yourself some Gin.):

As you can see, our code has not grown significantly. However, the range of functions has expanded greatly. In addition, resource consumption still remains low.

What Else can Golang Do?

We have found out how quickly a simple API service can be realized in Go. However, Go can do much more, and impresses, for example, with an easy-to-learn syntax, concurrency, and simple error handling.

For all of you who are now curious and want to learn more about Go, we offer a training course. The trainers will show you how to integrate Go into future projects, and you’ll be able to apply your newly acquired knowledge in practical exercises.

golang go

Go Training (Golang)

In our Go training, we teach you the basics of Go in two days. You will get to know the syntax and best practices; after the course, you’ll be able to design cloud-native applications for your use cases.

The following two tabs change content below.

Daniel Meng

Latest posts by Daniel Meng (see all)