When you see htop showing what appears to be "full" memory while reporting low actual usage (like your 48/494MB), you're witnessing Linux's intelligent memory caching mechanism in action. The colored bars represent:
Green: Used memory (active processes) Blue: Buffers (disk block metadata) Yellow: Cache (disk contents in memory)
Linux automatically uses unused RAM for disk caching to improve performance. This isn't "used" memory - it's available memory being put to work. The system will instantly free cache when applications need more memory.
Your actual memory usage calculation should be:
Real Used = Used (green) - Buffers (blue) - Cache (yellow) Free = Total - Real Used
For a more accurate view, use these commands:
free -h # Output example: # total used free shared buff/cache available # Mem: 494M 48M 320M 2.3M 125M 420M cat /proc/meminfo | grep -E 'MemTotal|MemFree|Buffers|Cached'
Your 494MB server can technically run nginx+PHP+WordPress, but consider:
- Basic WordPress: ~100-150MB memory
- Nginx: ~20-30MB
- PHP-FPM: ~30-50MB per worker
For production use, I recommend at least 1GB RAM. Here's how to optimize your current setup:
# NGINX worker configuration example worker_processes 1; # Match CPU cores worker_connections 1024; # PHP-FPM pool settings pm = dynamic pm.max_children = 3 # For 500MB server pm.start_servers = 1 pm.min_spare_servers = 1 pm.max_spare_servers = 2
Monitor these real danger signs:
watch -n 1 "grep -E 'Dirty|Writeback' /proc/meminfo" # If Dirty memory stays high, processes might stall vmstat 1 # Check si/so columns for swapping
The cache mechanism is working as intended - your server isn't actually out of memory. The "available" metric in free -h
shows what's truly free for new applications.
When you see htop showing full memory bars while reporting low active usage (like 48/494MB), this is actually normal Linux memory management behavior. The memory breakdown in htop consists of:
- Green: Used memory (active processes)
- Blue: Buffers (temporary storage for disk I/O)
- Yellow: Cache (filesystem cache for performance)
Linux aggressively uses available memory for disk caching to improve performance. This cache is marked as "used" in htop's meter but is actually available for applications when needed. The kernel will automatically free cached memory when processes require more RAM.
Here's how to check real memory availability:
free -h
Sample output:
total used free shared buff/cache available
Mem: 494M 48M 100M 5.2M 345M 420M
For a basic nginx + PHP + WordPress setup:
- Minimum: 512MB (will work but may swap under load)
- Recommended: 1GB+ for comfortable operation
- Optimal: 2GB+ for better performance with plugins
If you're constrained to 494MB, consider these optimizations:
# Configure PHP-FPM memory limits
sudo nano /etc/php/7.x/fpm/php.ini
Adjust these values:
memory_limit = 64M
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
Use these commands to check real memory status:
# Check memory pressure
cat /proc/meminfo | grep -E 'MemTotal|MemFree|MemAvailable'
# Check swap usage
vmstat 1 5
Upgrade your server if you consistently see:
- High swap usage (si/so columns in vmstat)
- Memory availability below 100MB during normal operation
- OOM (Out of Memory) killer terminating processes
For most small WordPress sites, 1GB RAM is sufficient, but monitor your actual usage after deployment.