Skip to main content

Command Palette

Search for a command to run...

2. ๐Ÿง Linux Troubleshooting & Performance Tuning for DevOps Engineers

Updated
โ€ข3 min readโ€ขView as Markdown
N

Open to Work | Cloud & DevOps Engineer | AWS | Kubernetes | Terraform | CI/CD | Automations | Available for Full-Time / Freelance / Mentorship

๐ŸŽฏ Why This Blog Matters?

In real DevOps roles, you are rarely asked โ€œwhat is Linux?โ€
Instead, you are asked:

โ€œCPU is 100%, disk is full, application is slow โ€“ what will you do?โ€

This blog covers exactly those real-world scenarios.


๐Ÿ”ฅ Common Linux Performance Issues

  • High CPU usage

  • Memory leaks

  • Disk space exhaustion

  • High load average

  • Slow application response

  • Zombie or stuck processes


๐Ÿ”น Troubleshooting High CPU Usage

Step 1: Identify the Process

top
htop

Look for:

  • %CPU

  • Load average

  • Process state


Step 2: Analyze the Process

ps -eo pid,ppid,cmd,%cpu,%mem --sort=-%cpu | head

Step 3: Inspect Threads

top -H -p <PID>

Step 4: Take Action

kill -9 <PID>
renice +10 <PID>

๐Ÿ”น Troubleshooting High Memory Usage

Check Memory Stats

free -m
vmstat 1 5

Identify Memory-Hungry Processes

ps aux --sort=-%mem | head

Check for Memory Leaks

  • Java โ†’ Heap dump

  • Python โ†’ Infinite object creation

  • Containers โ†’ Missing memory limits


๐Ÿ”น Understanding Load Average (Interview Favorite)

uptime

Load Average = Number of processes waiting for CPU.

CPU CoresLoadStatus
42Healthy
44Full
48Overloaded

๐Ÿ”น Disk Space Troubleshooting

Step 1: Check Disk Usage

df -h

Step 2: Find Large Directories

du -sh /* | sort -h

Step 3: Find Large Files

find / -type f -size +1G 2>/dev/null

Step 4: Clean Safely

logrotate
journalctl --vacuum-time=7d

โš ๏ธ Never delete logs blindly.


๐Ÿ”น Disk I/O Bottlenecks

iostat -x 1

High:

  • %util

  • await

๐Ÿ‘‰ Indicates disk latency issues.


๐Ÿ”น Zombie & Stuck Processes

ps aux | grep Z

Zombie = Process finished but not reaped by parent.

Fix:

  • Restart parent process

  • Restart service


๐Ÿ”น Network Slowness Troubleshooting

ss -tulnp
netstat -i
ping
traceroute

Check:

  • Packet drops

  • Port conflicts

  • Network latency


๐Ÿ”น Service-Level Troubleshooting

systemctl status nginx
journalctl -u nginx

Restart safely:

systemctl restart nginx

๐Ÿ”น CPU, Memory & Disk Tuning Tips

CPU

  • Reduce thread count

  • Enable autoscaling

  • Tune application configs

Memory

  • Add swap (temporary fix)

  • Configure heap limits

  • Use memory limits in Docker

Disk

  • Separate volumes

  • Enable log rotation

  • Monitor inode usage


๐Ÿ”น Real Production Scenario

Issue: Kubernetes node showing NotReady

Root Cause:

  • Disk full due to container logs

Fix:

df -h
du -sh /var/lib/docker/*

Enable:

  • log rotation

  • disk monitoring alerts


๐ŸŽฏ Interview Takeaways

  • Always start with observability

  • Never kill blindly

  • Fix root cause, not symptoms

  • Linux troubleshooting = calm + systematic

More from this blog

Beginner to Advanced

16 posts