Optimizing CentOS 7 Memory Usage: Can You Safely Stop Tuned Daemon After Profile Activation?


4 views

When working with CentOS 7 systems, the tuned service plays a crucial role in performance optimization. The process (/usr/bin/python -Es /usr/sbin/tuned -l -P) actively monitors system behavior and dynamically adjusts parameters according to your selected profile. However, this comes at a memory cost - typically consuming 50-100MB RSS, which can be significant on constrained systems.

There are two fundamental types of tuned profiles:

# List available profiles
tuned-adm list

# Common static profiles:
- throughput-performance
- latency-performance
- virtual-guest

# Dynamic profiles (require daemon):
- powersave
- balanced
- desktop

Static profiles apply their settings once at activation, while dynamic profiles continuously adjust parameters like CPU frequency scaling or disk I/O scheduling.

Before making changes, verify your active profile and its type:

# Check active profile
tuned-adm active

# Examine profile configuration
cat /etc/tuned/active_profile

If you're using a static profile, you can safely disable the daemon after activation:

# Apply profile (one-time for static profiles)
tuned-adm profile throughput-performance

# Stop and disable the daemon
systemctl stop tuned
systemctl disable tuned

# Verify settings persist
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

Static profile settings persist because they:

  • Modify sysctl parameters in /etc/sysctl.conf
  • Set kernel boot parameters in /etc/default/grub
  • Configure udev rules for device handling

Be aware of these scenarios where stopping tuned might cause issues:

# Virtualized environments may need dynamic adjustments
# Check for these indicators:
dmidecode -s system-product-name | grep -i vmware
virt-what

If you need some dynamic features but want reduced memory usage:

# Create a custom minimal profile
mkdir -p /etc/tuned/minimal
cat > /etc/tuned/minimal/tuned.conf <<EOF
[main]
include=throughput-performance

[vm]
transparent_hugepages=never
EOF

# Apply the minimal profile
tuned-adm profile minimal

In Linux performance tuning, the tuned service operates in two distinct modes:

# Static application (one-time)
tuned-adm profile your_profile
# Dynamic mode (continuous)
systemctl start tuned

On a CentOS 7 system with 2GB RAM, typical memory usage observations:

# Process memory comparison
ps -eo pid,cmd,%mem --sort=-%mem | head -5
  PID CMD                         %MEM
 1234 /usr/bin/python -Es tuned    1.8%
 5678 /usr/sbin/sshd               0.6%
 9012 /usr/sbin/crond              0.4%

Static profile settings persist through several mechanisms:

  • Sysctl values written to /etc/sysctl.d/
  • CPU governor settings via /etc/rc.local
  • Disk scheduler configurations in /etc/udev/rules.d/

For non-dynamic profiles (e.g., throughput-performance):

# Verify current profile
tuned-adm active

# Apply profile persistently
tuned-adm profile throughput-performance

# Disable the daemon
systemctl stop tuned
systemctl disable tuned

# Verify settings remain
cat /proc/sys/vm/swappiness
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

Required scenarios for dynamic operation:

# Power-aware profiles
tuned-adm profile laptop-ac-powersave
tuned-adm profile virtual-guest