Expertise
6 mins read

Why is Go popular in the devops world?

Development
Senior DevOps Engineer
Development

Senior DevOps Engineer
Matthew, the Senior DevOps Engineer at Rawnet, has been instrumental to the success stories of clients such as Hornby and Whistl. His expertise in crafting innovative solutions has left an indelible mark on their digital presence. Since joining Rawnet in 2016, Matthew has been a cornerstone of the agency's success, contributing to its growth and reputation as a digital leader. His dedication and tenure underline his commitment to the agency's mission and his role in steering its technological evolution. Beyond client projects, Matthew plays a pivotal role in the agency's internal dynamics. He develops bespoke software solutions tailored to client needs while simultaneously spearheading initiatives to streamline and enhance Rawnet's internal development processes. His dual focus on client satisfaction and internal efficiency solidifies his standing as a multifaceted leader within Rawnet's dynamic ecosystem.

Go, or GoLang, is favoured in DevOps for its exceptional performance.

It is also preferred for its concurrent programming capabilities and static typing.

Its broad standard library simplifies tasks like configuration management. Cross-platform compatibility and minimal dependencies make it practical for tool development and deployment.

  • Efficiency and Speed: Go excels in performance and efficiency. That makes it an excellent choice for building tools and applications that need to be fast and lightweight. This is crucial in DevOps, where tools must perform tasks swiftly without using too many system resources.
  • Static Typing: Go is a statically typed language which can catch many common programming errors at compile time. This ensures that DevOps tools work reliably and are crucial for smooth infrastructure and deployment operations.
  • Concurrent Programming: Go has built-in support for concurrent programming with goroutines and channels. This is especially useful in DevOps, where handling concurrent tasks, managing asynchronous events, and multiple processes are common requirements.
  • Standard Library: Go's standard library is a great tool for building networking, file systems, and other system-level applications. This makes it easy to create DevOps tools for tasks like configuration management, deployment automation, and monitoring.
  • Cross-Platform: Go is a cross-platform language. This means you can build applications and tools that work on various operating systems without significant modifications. This is crucial in DevOps, where infrastructure and applications often span multiple platforms.
  • Minimal Dependencies: Go applications are typically self-contained, as Go compiles everything into a single binary. This reduces the need for external dependencies, simplifying the deployment and distribution of DevOps tools.
  • Community and Ecosystem: Go's community is active and growing. They provide a wide range of open-source libraries and tools. Many DevOps tools such as Docker and Kubernetes contribute to a robust Go ecosystem.
  • Security: Go's strong typing and memory safety features make it less prone to common security vulnerabilities. In DevOps, security is paramount, and Go's design principles align well with the need for secure infrastructure and operations.
  • Easy to Learn: Go has a simple and readable syntax. This makes it accessible to developers who might not have extensive programming experience. This can be helpful in DevOps, where team members may come from diverse backgrounds.
  • Maintainability: Go promotes clean and maintainable code through its simplicity and strict style guide (gofmt). This is an advantage in the context of DevOps, where tools often need to be maintained and extended.

Overall, Go's speed, efficiency, simplicity, and strong concurrent programming support make it ideal for DevOps tools and applications. DevOps community has widely adopted this language for creating infrastructure automation and system administration tools. It is a popular choice due to its simplicity and ease of use.

What tools use Go?

  • Docker: The Docker container platform, used for containerisation and application deployment, is primarily written in Go. This project played a significant role in popularising Go within the DevOps and containerisation communities.
  • Kubernetes: Kubernetes, the container orchestration system for automating the deployment, scaling, and management of containerised applications, is also largely written in Go. It's a core component of modern containerised application management.
  • Prometheus: Prometheus is an open-source monitoring and alerting toolkit designed for reliability and scalability. It is implemented in Go and is widely used for monitoring applications and infrastructure.
  • Terraform: Terraform is an Infrastructure as Code (IaC) tool written in Go. It allows efficient creation, management, and versioning of infrastructure using code.
  • Grafana: Grafana is an open-source platform for monitoring and observability, allowing you to visualise and analyse data from various sources, including Prometheus, InfluxDB, and more.
  • Packer: Packer is an open-source tool for creating identical machine images for multiple platforms from a single source configuration. It is often used for building virtual machine images and containers.

What major players use Go?

  • Google: Go was developed by Google, and the company continues to use it for various internal projects. Google also contributes to the Go ecosystem by maintaining the Go programming language and its standard libraries.
  • Docker: Docker, the company behind the popular containerisation platform, extensively uses Go in the development of Docker-related tools and projects.
  • Kubernetes: Kubernetes, developed by Google and now part of the Cloud Native Computing Foundation (CNCF), is a flagship project that relies on Go for many of its components.
  • HashiCorp: HashiCorp, the company behind tools like Terraform, Consul, Vault, and Nomad, uses Go as the primary language for building these DevOps and infrastructure management tools.
  • Cloudflare: Cloudflare, a leading provider of internet security and performance services, employs Go in various components of its infrastructure, such as the edge server software.
  • Canonical: The company behind Ubuntu, Canonical, utilises Go for several projects, including Juju, a service modelling and deployment tool.
  • Netflix: Netflix, a prominent streaming service provider, uses Go in parts of its microservices architecture for performance and scalability.
  • Dropbox: Dropbox employs Go for various components of its infrastructure, such as the Magic Pocket storage system, which is designed to improve the durability and reliability of data storage.
  • The New York Times: The New York Times uses Go for some of its backend services and microservices, benefiting from Go's efficiency and performance.
  • SoundCloud: SoundCloud, the audio distribution platform, utilises Go for its backend systems and services.
  • Uber: Uber has adopted Go in some of its backend and infrastructure components, benefiting from Go's concurrency support and performance.
  • Facebook: While Go is not a primary language at Facebook, it is occasionally used in specific projects and teams, particularly when performance and efficiency are critical.
  • Twitter: Twitter has experimented with Go in some of its services, utilising its performance characteristics in certain use cases.
  • Stripe: Stripe, a payment processing platform, uses Go for specific backend services and systems.

How does Rawnet Leverage Go?

Go, also known as GoLang, is a powerful language. We use it in our ecosystem to address specific requirements where concurrency, performance, and minimal footprint are key.

For Example:

  • We utilise Go for our infrastructure build utilising Go currency. This allows us to spin up entire infrastructure stack items in parallel with dependencies. This means we can create a server and a database at the same time with a single command.
  • Recording statistics, Memory, CPU, SWAP and other monitoring.
  • Building our desktop applications to support our in-house developers.
  • High-performance tasks such as converting a multi-page PDF to an image.

Some simple example codes of how we can utilise concurrency to collect data:

 

package main


import (
"sync"
)


func main() {
// create our wait group
wg := &sync.WaitGroup{}
wg.Add(2)


// create our channels to accept data
memoryChan := make(chan float64, 1)
cpuChan := make(chan float64, 1)
errChn := make(chan error, 2)
exitChan := make(chan struct{}, 1)


// spin up a routine to handle the transactions
go func(wg *sync.WaitGroup, memoryChan chan<- float64, cpuChan chan<- float64, errChn chan<- error) {
// spin up a child routine to run our cpu checking
go func(wg *sync.WaitGroup, cpuChan chan<- float64, errChn chan<- error) {
defer wg.Done()


data, err := checkCPU() // check out CPU usage


if err != nil {
errChn <- err //passing errors if they have occurred to be handled
return
}


// send the cpu usage back to the channel
cpuChan <- data
}(wg, cpuChan, errChn)


// spin up a child routine to run our memory checking
go func(wg *sync.WaitGroup, memoryChan chan<- float64, errChn chan<- error) {
defer wg.Done()


data, err := checkMemory() // check out memory usage


if err != nil {
errChn <- err
return
}


// send the memory usage back to the channel
memoryChan <- data
}(wg, memoryChan, errChn)


// wait within the parent routine until they are all complete
wg.Wait()
close(exitChan) // close our complete channel
}(wg, memoryChan, cpuChan, errChn)


var (
cpuData float64
memoryData float64
errs []error
)


// our blocking data collection
done:
for {
select {
case cpu := <-cpuChan:
cpuData = cpu
break
case mem := <-memoryChan:
memoryData = mem
break
case err := <-errChn:
errs = append(errs, err)
break
case <-exitChan:
break done


}

Benefits

  • The above code is all pure Go which provides 0 dependencies. Which improves stability.
  • The above code could be improved to include context time-outs for the sub-routines to improve reliability but again this is pure Go.
  • This may also give you insights into collecting data say about a user all at the same time from multiple places. For example, you could collect:
    • Users purchase history
    • Users billing information
    • Query a third-party API for the users' Geo Location to display on a map

Conclusion

Go is Awesome!
Its rapid rise in the DevOps landscape is no coincidence. Its powerful combination of speed, efficiency, and reliability makes it an essential tool for modern infrastructure and deployment operations. With an extensive standard library and minimal dependencies, Go simplifies the development of robust DevOps solutions, all while maintaining a strong focus on security and accessibility.

Related articles

In today’s digital age, where web applications and software dominate the tech landscape.

Web development is evolving, staying on top of the latest techniques is vital. 

In the contemporary digital landscape, online shopping reigns supreme.

Other articles by Matthew Thomas

You might have had some advanced knowledge about a NoOps reality.

As companies seek updates and data management, serverless tech offers solutions.