> Markdown version of [/videos/100058-go-s-concurrency-and-parallelism-inside-containers?t=51](https://www.wearedevelopers.com/videos/100058-go-s-concurrency-and-parallelism-inside-containers?t=51). Every page supports `.md` or `Accept: text/markdown`. Links point to the HTML versions so they work for humans too. Agent guide: [/agents.md](https://www.wearedevelopers.com/agents.md). --- # Go's Concurrency and Parallelism Inside Containers Stop artificially inflating GOMAXPROCS in your containerized environments. Modern Go automatically adapts to Kubernetes CPU quotas, preventing scheduler thrashing and optimizing parallel execution. - **Speakers:** [Rick Rackow](https://www.wearedevelopers.com/@rick-rackow) - **Event:** World Congress 2026 Europe - **Published:** July 9, 2026 - **Duration:** 30:48 - **URL:** https://www.wearedevelopers.com/videos/100058-go-s-concurrency-and-parallelism-inside-containers ## Summary Understanding the fundamental distinction between concurrency and parallelism is essential for optimizing Go applications, especially when deploying them within containerized environments. Inspired by Rob Pike's maxim—"concurrency is about dealing with lots of things at once; parallelism is about doing lots of things at once"—this walkthrough examines how the Go scheduler maps concurrent workloads to available hardware resources. By transitioning a simple sequential Go program into a concurrent one using goroutines, developers can see firsthand how executing tasks in parallel is highly dependent on allocated logical CPUs controlled via the `GOMAXPROCS` parameter. However, scaling CPU-bound processing isn't as simple as increasing thread counts. Artificially inflating `GOMAXPROCS` beyond the actual number of physical cores causes scheduler thrashing and drastically diminishes performance. This dynamic becomes more complex inside Docker containers, which don't directly manage resources but instead rely on runC to configure Linux control groups (cgroups) managed by the host OS. When platforms like Kubernetes allocate fractional CPU bounds—such as 0.5 CPUs—legacy Go versions would often misinterpret the host machine's total cores, leading to inefficient thread allocation. Fortunately, modern Go distributions automatically adapt `GOMAXPROCS` to respect container-level CPU quotas natively. This capability significantly streamlines deploying Go services into container orchestration systems. Software engineers and SREs can now rely on the runtime to align thread creation with actual restricted CPU parameters, ensuring resilient, highly performant scheduling without the need for manual workarounds or third-party auto-limit libraries. **Keywords:** go programming, golang concurrency, parallelism vs concurrency, goroutines, gomaxprocs parameters, docker container performance, container cpu limits, linux cgroups, runc containerization, kubernetes orchestration, fractional cpu allocation, go scheduler optimization, multithreading architecture, sre performance tuning ## Chapters 1. **Introduction to Go concurrency and parallelism** (00:51) — How Go differentiates between concurrently dealing with tasks and executing processes in parallel. 1. **Sequential execution versus concurrent execution in Go** (03:23) — A basic code demonstration reveals how an unoptimized Go program processes scheduled tasks sequentially. 1. **Introducing goroutines and the Go scheduler** (07:23) — Implementing a wait group coordinates goroutines to demonstrate single-CPU task concurrency. 1. **Scaling CPU-bound processing with the GOMAXPROCS variable** (10:45) — Enabling parallel execution across multiple CPU cores significantly reduces expected batch processing time. 1. **Performance penalties from excessive hardware thread allocation** (13:54) — Assigning more threads than available hardware cores creates scheduling overhead and slows runtime performance. 1. **Building a Go application inside a Docker container** (17:31) — Writing an optimized multi-stage Dockerfile compiles and packages a compiled Go binary for deployment. 1. **Troubleshooting Docker Desktop resources on macOS environments** (20:22) — Resource limits imposed by underlying Linux virtual machines affect containerized application execution on Mac hardware. 1. **How GOMAXPROCS behaves inside limited container computing environments** (26:45) — Modern Go releases automatically align default execution threads with allocated Linux control group constraints. 1. **Key takeaways on Go container performance optimization** (29:59) — Summarizing how concurrency, parallelism, and allocated runtime CPU limits fundamentally impact Go application behavior. ## Related Moments - [Configuring Go runtime concurrency with the GOMAXPROCS variable](https://www.wearedevelopers.com/videos/100053-the-hidden-costs-of-cpu-limits-in-kubernetes) (from "The Hidden Costs of CPU Limits in Kubernetes") - [Leveraging the Go programming language for scalable infrastructure](https://www.wearedevelopers.com/videos/347-mlops-and-ai-driven-development) (from "MLOps and AI Driven Development") - [Demystifying the mechanics behind container execution routines](https://www.wearedevelopers.com/videos/1094-docker-exec-without-docker) (from "Docker exec without Docker") - [Integrating containers to solve serverless execution limitations](https://www.wearedevelopers.com/videos/491-serverless-landscape-beyond-functions) (from "Serverless landscape beyond functions") - [Orchestrating with Kubernetes against Docker and accessing slides](https://www.wearedevelopers.com/videos/487-debug-a-kubernetes-operator) (from "Debug a Kubernetes Operator") - [Answering audience questions on container functionality and local workflows](https://www.wearedevelopers.com/videos/166-local-development-techniques-with-kubernetes) (from "Local Development Techniques with Kubernetes") ## Related Articles - [Building AI Solutions with Rust and Docker](https://www.wearedevelopers.com/magazine/494-building-ai-solutions-with-rust-and-docker) - [The Concept of Concurrency & Multithreading: What Are They And How They Function](https://www.wearedevelopers.com/magazine/89-the-concept-of-concurrency-multithreading-what-are-they-and-how-they-function) - [How we Build The Software of Tomorrow](https://www.wearedevelopers.com/magazine/120-how-we-build-the-software-of-tomorrow) - [MLops – Deploying, Maintaining And Evolving Machine Learning Models in Production](https://www.wearedevelopers.com/magazine/115-mlops-deploying-maintaining-and-evolving-machine-learning-models-in-production) ## Related Jobs - [Golang Software Engineer](https://www.wearedevelopers.com/jobs/ext/1652471-golang-software-engineer) at **Redis** - [Staff Software Engineer](https://www.wearedevelopers.com/jobs/ext/1425755-staff-software-engineer) at **GitHub** - [Cloud Foundations Team](https://www.wearedevelopers.com/jobs/ext/1483289-cloud-foundations-team) at **GitHub** - [Principal Software Engineer, Database Infrastructure](https://www.wearedevelopers.com/jobs/ext/1465908-principal-software-engineer-database-infrastructure) at **GitHub** - [Senior Software Engineer, Enterprise Products](https://www.wearedevelopers.com/jobs/ext/1841248-senior-software-engineer-enterprise-products) at **GitHub** - [Senior Software Engineer](https://www.wearedevelopers.com/jobs/ext/159190-senior-software-engineer) at **GitHub**