Skip to content
Andrei Montchik edited this page May 7, 2024 · 9 revisions

Swap File

  • Review: sudo swapon --show
  • Resize:
    1. disable: sudo swapoff /swap.img
    2. resize: sudo fallocate -l 32G /swap.img
    3. mark the file as swap: sudo mkswap /swap.img
    4. enable swap file: sudo swapon /swap.img

Memory mapped files limit

  • Check the current limit: sysctl vm.max_map_count
  • Increase:
  1. Search for the vm.max_map_count parameter the sysctl configuration files:
    • sudo grep max_map_count /etc/sysctl.conf
    • sudo grep max_map_count /etc/sysctl.d/*
  2. Update the existing or insert the new map count parameter to /etc/sysctl.conf: vm.max_map_count = 1000000
  3. Reload the sysctl service: sudo sysctl -p
  4. Confirm that the files limit was updated: sysctl vm.max_map_count

Stress Testing

CLI

  • Free memory: free -th or cat /proc/meminfo | grep MemFree
    • refresh every second: free -th -s 1
  • Top 10 processes that use most memory: ps aux --sort=-%mem | head -10

Clone this wiki locally