---
title: "Debugging Systems in the Cloud: MySQL, Kubernetes, and Cgroups"
description: "Slow MySQL Pod startup and degraded query performance on long-running GKE nodes in Shopify's KateSQL platform traced back to a Linux kernel memory cgroup leak: roughly 50K zombie memory cgroups made mem_cgroup_commit_charge slow, so each 128MB mmap during InnoDB buffer pool initialization took about 100 ms. The investigation used strace, perf flamegraphs, slabtop and /proc/cgroups, and Google kernel engineers confirmed it as a side effect of slab reparenting on cgroup removal."
url: "https://swe.quest/articles/debugging-systems-in-the-cloud-mysql-kubernetes-and-cgroups-a5ded3f862ca5b21"
canonical: "https://shopify.engineering/debugging-systems-cloud-mysql-kubernetes-cgroups"
source: "Shopify Engineering"
published: "2021-10-21"
difficulty: "hard"
kind: "Incident"
reading_minutes: 8
tags: ["debugging","linux","mysql","kubernetes","performance"]
---

# Debugging Systems in the Cloud: MySQL, Kubernetes, and Cgroups

A post on [Shopify Engineering](https://swe.quest/sources/shopify.md), published 2021-10-21, 8 min read, Incident. Original: [https://shopify.engineering/debugging-systems-cloud-mysql-kubernetes-cgroups](https://shopify.engineering/debugging-systems-cloud-mysql-kubernetes-cgroups)

## Summary

Slow MySQL Pod startup and degraded query performance on long-running GKE nodes in Shopify's KateSQL platform traced back to a Linux kernel memory cgroup leak: roughly 50K zombie memory cgroups made mem\_cgroup\_commit\_charge slow, so each 128MB mmap during InnoDB buffer pool initialization took about 100 ms. The investigation used strace, perf flamegraphs, slabtop and /proc/cgroups, and Google kernel engineers confirmed it as a side effect of slab reparenting on cgroup removal. Forcing kubepods memory.force\_empty cut cgroups to about 1800, and an 80G buffer pool then initialized in five seconds. The permanent fix was upgrading to GKE 1.18 (COS 85, kernel 5.4). Interim options included recycling nodes, dropping caches and isolating short-lived Pods.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [Debugging](https://swe.quest/tags/debugging.md) (Engineering practices)
- [Linux](https://swe.quest/tags/linux.md) (Infrastructure)
- [MySQL](https://swe.quest/tags/mysql.md) (Data & databases)
- [Kubernetes](https://swe.quest/tags/kubernetes.md) (Infrastructure)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)

## Prerequisites

- Linux cgroups ([easy posts on Linux](https://swe.quest/tags/linux.md?difficulty=easy))
- Kubernetes Pods and nodes ([easy posts on Kubernetes](https://swe.quest/tags/kubernetes.md?difficulty=easy))
- InnoDB buffer pool
- perf and strace

## Keywords

KateSQL, GKE, memcg, InnoDB, jemalloc, Container-Optimized OS, mem\_cgroup\_commit\_charge

## Related posts

- [The case of the vanishing CPU: A Linux kernel debugging story](https://swe.quest/articles/the-case-of-the-vanishing-cpu-a-linux-kernel-debugging-story-3db1aa1b81ec8319.md): ClickHouse · 2025-03-05 · Hard · 32 min read · Linux, Memory management, Debugging, Performance engineering, Incidents & postmortems
  Intermittent, indefinite CPU saturation of ClickHouse Cloud pods, seen only on GCP, turned out to be a Linux kernel memory-management livelock.
- [Spin Infrastructure Adventures: Containers, Systemd, and CGroups](https://swe.quest/articles/spin-infrastructure-adventures-containers-systemd-and-cgroups-5a9e742638fea62c.md): Shopify Engineering · 2022-07-15 · Hard · 8 min read · Containers, Linux, Kubernetes, Debugging, Multi-tenancy
  Spin development instances run systemd inside Kubernetes containers, and processes launched through systemd escaped the pod's memory cgroup, so pod memory limits were not enforced and instances could exceed their allotment and disturb neighbours.
- [Node.js and the tale of worker threads](https://swe.quest/articles/node-js-and-the-tale-of-worker-threads-2f7f52d719f58af7.md): Zalando Engineering · 2024-07-24 · Medium · 10 min read · JavaScript, Kubernetes, Incidents & postmortems, Debugging, Observability
  A Node.js service using cluster mode called os.cpus().length inside a Kubernetes container, which returns the host's core count, not the pod's CPU allocation.
- [The Shift to cgroup v2 in Kubernetes: What You Need to Know](https://swe.quest/articles/the-shift-to-cgroup-v2-in-kubernetes-what-you-need-to-know-ef93aafe6f995ba1.md): Kubernetes Blog · 2026-10-06 · Medium · 11 min read · Kubernetes, Linux, Containers, Memory management
  Kubernetes has deprecated cgroup v1: from v1.35 the kubelet refuses to start on cgroup v1 nodes by default (\`failCgroupV1: true\`), kubeadm preflight errors on it, and the fallback is slated for removal in v1.38. cgroup v2 enables Memory QoS with \`memory.high\` throttling and tiered \`memory.min\`/\`memory.low\` reservations, container-wide OOM kills via \`memory.oom.group\`, safe rootless delegation, eBPF-based device control, PSI metrics, and accurate Pod-level in-place resizing.
- [Clouds, caches and connection conundrums](https://swe.quest/articles/clouds-caches-and-connection-conundrums-9abdd4ad0c3450ff.md): incident.io · 2023-09-26 · Medium · 10 min read · Kubernetes, Networking, Incidents & postmortems, Debugging, PostgreSQL
  After migrating to Google Cloud, sporadic Postgres and memcached connection timeouts on GKE turned out to be node-wide, not process-local.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
