DEV Community

Michael
Michael

Posted on • Originally published at gbase.cn

Pre‑Deployment OS Tuning for GBase 8a: ulimit, Kernel, Disk, and Network

The performance ceiling of a gbase database cluster is often set by the operating system. Before GBase 8a goes live, you must tune file limits, virtual memory, the I/O scheduler, and the network stack. This guide covers every essential OS‑level setting with a validation checklist.

1. User Resource Limits (ulimit)

Recommended production values for the gbase user:

Parameter Value Meaning
nofile 655360 Max open files per process
nproc 655360 Max processes/threads per user
stack unlimited Thread stack size
core unlimited Core dump file size

Where to Configure (all locations required)

/etc/security/limits.conf:

*    soft    nofile     655360
*    hard    nofile     655360
*    soft    nproc      655360
*    hard    nproc      655360
*    soft    core       unlimited
*    hard    core       unlimited
Enter fullscreen mode Exit fullscreen mode

/etc/security/limits.d/20-nproc.conf: set nproc to 655360, root to unlimited.

/etc/systemd/system.conf (for systemd‑managed services):

DefaultLimitNOFILE=655360
DefaultLimitNPROC=655360
DefaultLimitCORE=infinity
Enter fullscreen mode Exit fullscreen mode

Run systemctl daemon-reexec afterwards, then verify as the gbase user:

su - gbase
ulimit -n   # must show 655360
ulimit -u   # must show 655360

# Confirm the running gnode process limits
PID=$(pgrep -f gbase | head -1)
cat /proc/$PID/limits | grep -E "Max open files|Max processes"
Enter fullscreen mode Exit fullscreen mode

2. Virtual Memory and Kernel Parameters (sysctl)

Add to /etc/sysctl.conf and apply with sysctl -p:

# Virtual memory
vm.swappiness = 1
vm.dirty_ratio = 10
vm.dirty_background_ratio = 5

# HugePages (gnode memory / 2MB)
vm.nr_hugepages = 32768

# File system
fs.file-max = 6553560

# Network stack
net.core.rmem_max = 134217728
net.core.wmem_max = 134217728
net.core.rmem_default = 25165824
net.core.wmem_default = 25165824
net.ipv4.tcp_rmem = 4096 87380 134217728
net.ipv4.tcp_wmem = 4096 87380 134217728
net.core.netdev_max_backlog = 250000
net.core.somaxconn = 65535
net.ipv4.tcp_fin_timeout = 15
net.ipv4.tcp_tw_reuse = 1
net.ipv4.ip_local_port_range = 10000 65000
net.ipv4.tcp_keepalive_time = 300
net.ipv4.tcp_keepalive_intvl = 30
net.ipv4.tcp_keepalive_probes = 5

# Shared memory
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
kernel.sem = 250 32000 100 128
Enter fullscreen mode Exit fullscreen mode

3. Disable Transparent Huge Pages (THP)

THP background compaction causes unpredictable latency spikes. Disable it:

echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
# Persist in /etc/rc.d/rc.local
# Verify: expected output includes [never]
cat /sys/kernel/mm/transparent_hugepage/enabled
Enter fullscreen mode Exit fullscreen mode

4. Disk I/O Tuning

Disk Type Scheduler Queue Depth
HDD deadline / mq-deadline 128
SSD / NVMe noop / none 1024

Make permanent via /etc/udev/rules.d/60-io-scheduler.rules.

Use XFS with noatime,nodiratime mount options:

/dev/sdb  /opt/gbase  xfs  defaults,noatime,nodiratime  0  0
Enter fullscreen mode Exit fullscreen mode

5. NUMA Considerations

  • Inspect topology: numactl --hardware
  • Bind gnode to a NUMA node: numactl --cpunodebind=0 --membind=0 -- gbase_services gbase start
  • Disable automatic NUMA balancing: echo 0 > /proc/sys/kernel/numa_balancing

6. Network Verification

# Bandwidth test between nodes (10GbE should reach >9 Gbps)
iperf3 -c 10.168.10.27 -t 30 -P 4

# Distribute NIC interrupts
systemctl enable irqbalance && systemctl start irqbalance
Enter fullscreen mode Exit fullscreen mode

7. One‑Shot Validation Script

Run on every node before deployment:

#!/bin/bash
echo "===== Open Files ====="
su - gbase -c "ulimit -n" 2>/dev/null
echo "System file-max: $(cat /proc/sys/fs/file-max)"

echo "===== THP ====="
cat /sys/kernel/mm/transparent_hugepage/enabled

echo "===== Swap ====="
free -h && cat /proc/sys/vm/swappiness

echo "===== I/O Scheduler ====="
for disk in $(ls /sys/block/ | grep -E '^sd|^nvme'); do
    echo "$disk: $(cat /sys/block/$disk/queue/scheduler 2>/dev/null)"
done

echo "===== Network ====="
sysctl net.core.rmem_max net.core.wmem_max net.ipv4.tcp_tw_reuse

echo "===== Time Sync ====="
timedatectl status | grep -E "synchronized|NTP"

echo "===== SELinux ====="
sestatus 2>/dev/null || echo "sestatus not available"

echo "===== Firewall ====="
systemctl status firewalld 2>/dev/null | grep Active
Enter fullscreen mode Exit fullscreen mode

8. Configuration Checklist

Item Recommended Location
nofile 655360 limits.conf + systemd
nproc 655360 limits.conf + 20-nproc.conf
vm.swappiness 1 /etc/sysctl.conf
vm.dirty_ratio 10 /etc/sysctl.conf
THP never /etc/rc.local
I/O scheduler (HDD) deadline udev rules
I/O scheduler (SSD) noop udev rules
File system XFS, noatime /etc/fstab
net.core.rmem_max 134217728 /etc/sysctl.conf
NUMA balancing off /etc/sysctl.conf
SELinux disabled /etc/selinux/config
Firewall off or allow 5258/UDP 5405 systemctl
Time sync NTP enabled, drift < 1s chrony/ntpd

9. Common Cluster Issues Caused by OS Misconfiguration

Symptom Root Cause Fix
gnode CLOSE, "Too many open files" nofile too low Update limits.conf + systemd
Random query stalls, high P99 THP background compaction Disable THP
Low network throughput during load TCP buffers too small Increase rmem_max/wmem_max
gnode OOM repeatedly Excessive swap usage vm.swappiness=1, add memory
Frequent node disconnections TCP keepalive too long Lower tcp_keepalive_time
gcware port_scanning error Firewall blocks UDP 5405 Open the port
Installer reports IPv6 not supported IPv6 disabled Enable IPv6

A well‑tuned OS is the silent foundation of every performant gbase database cluster. Run through this checklist before any production deployment of GBASE's MPP platform — your future self will thank you.

Top comments (0)