
Connecting to a Private AKS Cluster with Azure Bastion – No Jump Box Needed!
August 12, 2025🎉Malware scanning add-on is now generally available in Azure Gov Secret and Top-Secret clouds
August 13, 2025Hello, Linux + SQL Server Fans!
If you’re running SQL Server on Linux, here’s some great news – cgroup v2 is now supported in SQL Server 2025 preview and SQL Server 2022 CU 20. This enhancement brings more precise and reliable resource management, especially for containerized deployments in environments like Docker, Kubernetes, and OpenShift.
Why cgroup v2 Matters
In Linux, control groups (cgroups) are a kernel feature that allows you to allocate, prioritize, and limit system resources such as CPU and memory. With cgroup v2, these capabilities are more unified and robust, offering better enforcement and visibility compared to the older version. To know more please visit: Control Group v2 — The Linux Kernel documentation.
How to Check Your cgroup Version
Run this command: stat -fc %T /sys/fs/cgroup/
- If it returns cgroup2fs, you’re using cgroup v2.
- If it returns cgroup, you’re on cgroup v1.
How to switch to cgroup v2: The simplest path is choosing a distribution that supports cgroup v2 out of the box. To switch manually:
- Add to GRUB config: systemd.unified_cgroup_hierarchy=1
- Run: sudo update-grub
SQL Server and Cgroupv2:
Before this update, users running SQL Server containers on Kubernetes clusters (e.g., Azure Kubernetes Service version 1.25 and above) reported that SQL Server did not respect memory limits set via container specs. This led to issues like Out of Memory (OOM) errors, even when limits were properly configured. Here is an example:
– For a standard D4ds_v5 machine that has 4 CPUs and 16 GB of RAM as shown in below screenshot
If you check the SQL Server errorlog before SQL Server 2022 CU 20: You would observe that SQL Server can see 80% (12792 MB) of the overall memory (16 GB) available on the worker node of the Kubernetes cluster, even though you have configured the 3 Gi memory limit.
You ask why just 80% then learn more about the memory.memorylimit, which by default is configured to 80% of the physical memory, to prevent out of memory (OOM) errors. For details please refer: Configure SQL Server Settings on Linux – SQL Server | Microsoft Learn.
Below is the errorlog snippet and the container configuration:
“Microsoft SQL Server 2022 (RTM-CU19) (KB5054531) – 16.0.4195.2 (X64) Apr 18 2025 13:42:14 Copyright (C) 2022 Microsoft Corporation Developer Edition (64-bit) on Linux (Ubuntu 22.04.5 LTS)
….
….
Detected 12792 MB of RAM, 12313 MB of available memory, 12313 MB of available page file. This is an informational message; no user action is required”
– This was despite the container being configured with a 3Gi memory limit:
kubectl get pod mssql-0 -n cgrouptest -o jsonpath=”{.status.qosClass}`n{.spec.containers[*].resources.limits.memory}” Guaranteed
3Gi
Even though users limited the memory for SQL Server containers to 3 GB, SQL Server was still able to see the entire physical memory on the host and tried using that ending up in OOM crashes.
But, With the release of SQL Server 2025 preview and SQL Server 2022 CU 20, the memory limits are now correctly enforced. Here’s what the error log looks like with cgroup v2 support:
“Microsoft SQL Server 2022 (RTM-CU20) (KB5059390) – 16.0.4205.1 (X64) Jun 13 2025 13:38:45 Copyright (C) 2022 Microsoft Corporation Developer Edition (64-bit) on Linux (Ubuntu 22.04.5 LTS)
..
..
Detected 2458 MB of RAM, 1932 MB of available memory, 1932 MB of available page file. This is an informational message; no user action is required”
The limits are same as previous case with memory limited to 3 GB as shown below, SQL Server ends up with 80% of 3 GB as the limit that is 2458 MB as printed in the errorlog.
Below is the container configuration with a 3Gi memory limit:
kubectl get pod mssql-latest-0 -n cgrouptest -o jsonpath=”{.status.qosClass}`n{.spec.containers[*].resources.limits.memory}”Guaranteed
3Gi
Learn More
- SQL Server on Linux Overview
- SQL Server 2025 Release Notes
- Deploy a SQL Server Linux container to kubernetes
Deploy SQL Server on OpenShift or Kubernetes
- Understanding Cgroup v2on Kubernetes
- Understanding Cgroups on RHEL
Wrapping Up
With the introduction of cgroup v2 support in SQL Server 2025 and SQL Server 2022 CU 20, Linux-based deployments gain a powerful tool for smarter resource management. Whether you’re running SQL Server in containers or on bare metal, cgroup v2’s unified hierarchy, simplified configuration, and real-time pressure metrics offer a more predictable and efficient way to enforce Quality of Service. From isolating workloads in Kubernetes to dynamically tuning performance under contention, this enhancement empowers DBAs and platform engineers to deliver consistent service levels across diverse environments. As SQL Server continues to evolve on Linux, embracing cgroup v2 is a strategic step toward building resilient, high-performance data platforms.
Thanks,
Engineering: Andrew Carter (Lead), Nicolas Blais-Miko
Product Manager: Attinder Pal Singh and Amit Khandelwal