Posts

Showing posts from October, 2025

What is /proc/sys/vm/drop_caches?

🔍 What is /proc/sys/vm/drop_caches ? This is a virtual kernel interface that lets you manually free up memory used by: The page cache (file data) Dentries (directory entries) Inodes (metadata for files) It’s useful when: You want to test performance without file cache interference You need to free up RAM quickly in a controlled environment You're benchmarking or tuning systems and want a clean cache state ⚠️ Why cat drop_caches gives "Permission denied" root@iamsonukushwaha:/proc/sys/vm # cat drop_caches cat : drop_caches: Permission denied Even as root, you can't read this file. Here's why: --w-------. 1 root root 0 Oct 6 15:48 drop_caches It’s write-only . There’s no read ( r ) permission — by design. The kernel doesn't expose a value here; it only accepts commands . ✅ How to properly clear caches Before you drop caches, it’s important to sync your file system to avoid data loss: sync Then, choose the appropriate optio...

Setting Up Swap on RHEL 10

  Setting Up Swap on RHEL 10 Just created a 2GB swap file on a fresh RHEL 10 system to improve memory management: fallocate -l 2G /swapfile chmod 600 /swapfile mkswap /swapfile swapon /swapfile echo '/swapfile swap swap defaults 0 0' >> /etc/fstab Swap helps prevent out-of-memory issues and keeps your system stable under load — especially on minimal installs or cloud VMs with limited RAM. Here’s the verification after setup: root@iamsonukushwaha:~ # swapon --show NAME TYPE SIZE USED PRIO /swapfile file 2G 0B -2 root@iamsonukushwaha:~ # free -gh total used free shared buff/cache available Mem: 951Mi 387Mi 328Mi 6.8Mi 390Mi 564Mi Swap: 2.0Gi 0B 2.0Gi Small setup, big impact! 🚀

The Hidden I/O Bottleneck Lurking in Your Linux System

The Hidden I/O Bottleneck Lurking in Your Linux System Have you ever tuned vm.dirty_ratio ? If not, your Linux system might be quietly throttling your disk performance without you noticing. 😬 I took a look at a small RHEL 10 VM and found this: [root@iamsonukushwaha] # cat /proc/sys/vm/dirty_ratio 30 [root@iamsonukushwaha] # cat /proc/sys/vm/dirty_background_ratio 10 What does this mean? ✅ When dirty pages reach 10% of RAM, Linux starts flushing data to disk in the background . 🚨 At 30%, the kernel blocks new writes until it flushes dirty data to avoid overloading the system . On this VM with 951MiB RAM, that translates to: Background flush kicks in at about 95MiB of dirty data. A hard stop happens at around 285MiB . If you’re running a logging-heavy app or working with slow storage, expect those sudden latency spikes. ⚡ Quick tip to smooth out I/O spikes: Set dirty_ratio to 15 Set dirty_background_ratio to 5 This simple adjustment can prevent unexpected sta...