Skip to content
GitHubLinkedIn

SQL Server on Linux performance

These are OS-level tuning notes for running SQL Server (Standard or Express) on Linux (VM or bare metal), including containerized deployments (Podman/Docker).

Last updated: 2025-07-02

  • Root access on the Linux host.
  • tuned installed (for tuned profiles).

Use a tuned profile designed for high-throughput server workloads:

tuned-adm profile throughput-performance

Check the active profile:

tuned-adm active
# Output: Current active profile: throughput-performance

SQL Server recommends disabling THP to avoid memory compaction delays that affect query performance.

echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
cat <<EOF > /etc/systemd/system/disable-thp.service
[Unit]
Description=Disable Transparent Huge Pages
After=multi-user.target

[Service]
Type=oneshot
ExecStart=/bin/sh -c "echo never > /sys/kernel/mm/transparent_hugepage/enabled && echo never > /sys/kernel/mm/transparent_hugepage/defrag"

[Install]
WantedBy=multi-user.target
EOF

systemctl daemon-reexec
systemctl enable --now disable-thp

Verify:

cat /sys/kernel/mm/transparent_hugepage/enabled
# Expected: [never]

On bare-metal or large VMs with more than one NUMA node, pin containers to reduce cross-node latency.

lscpu | grep -i numa
numactl --hardware
podman update --cpuset-cpus=0-5 your-sql-container
podman update --cpuset-cpus=6-7 your-api-container

Recommended scheduler for fast disks (NVMe or SSD):

cat /sys/block/sda/queue/scheduler
# Expected: [none] mq-deadline kyber bfq
  • none: Best for modern fast storage (default with throughput-performance)
  • mq-deadline: Optionally useful on SATA if contention observed

When using SQL Server Express, resource limits apply automatically but you can still enforce them at the container level.

resources:
  limits:
    memory: "2Gi"
    cpu: "4"

Express Edition limits:

  • 1.41 GB max memory
  • 1 socket / 4 cores
  • 10 GB per database
  • Enable throughput-performance tuned profile
  • Disable THP persistently
  • Confirm I/O scheduler (none or mq-deadline)
  • If multi-NUMA: pin SQL/container workloads
  • If Express: enforce container limits when appropriate
  • Changing tuned profiles can impact other workloads on the host; validate with the full stack running.
  • THP settings may revert after kernel changes if not applied via systemd.
  • CPU pinning can make performance worse if the container threads are starved; validate with real load.