Swap
Swap
Swap usage leads to performance degradation of your server. So we highly recommend to configure swap space properly or disable it entirely
How to configure
Most of distribution's default settings for swap is to use the swap when Ram usage exceeds 40% check your swappiness value with
cat /proc/sys/vm/swappiness
(the value 60 here means to start to use the swap when there is less then 60% of free RAM - this not makes sense for realtime services)
You can change it in a run-time,effect is instant after disable/enable the swap(but not persists restart of a server)
echo '5' > /proc/sys/vm/swappiness
You can set the value permanent by adding the line at end of /etc/sysctl.conf
vm.swappiness=5
(0 value means to use swap only when there is no Ram free)
Make swap empty
swapoff -a swapon -a
How to disable
root@vmsniff:~# swapoff -a
Then edit the /etc/fstab file and comment out the swap lines. E.g.
proc /proc proc defaults 0 0 # / was on /dev/md0 during installation UUID=17e56a9a-0f42-44ca-90e8-570315708def / xfs relatime 0 1 # swap was on /dev/sda2 during installation #UUID=0a403f5e-0505-4055-a219-70217b6b74d1 none swap sw 0 0 # swap was on /dev/sdb2 during installation #UUID=4cf42564-4339-42ed-b7ec-29644a3085f1 none swap sw 0 0
Note: use dmesg (or dmeg -T) command to ensure there is no service crashing because of no ram free.
Checking VoIPmonitor Memory Configuration
Before tuning system-level swap settings, you should also review VoIPmonitor's internal memory configuration parameters. Excessive buffer settings can cause memory pressure and trigger swap usage.
Check the current memory-related settings:
cat /etc/voipmonitor.conf | grep '^max_buffer_mem\|^ringbuffer\|^packetbuffer'
- ringbuffer = 50 (default) - Ringbuffer size in MB. Recommended >= 500 for >100 Mbit traffic. Max 2000.
- max_buffer_mem = 2000 (default) - Maximum buffer memory in MB for packet buffers.
- packetbuffer_enable = yes (default) - Enable packet buffer cache.
Reduce these values if your sensor is swapping:
- Lower ringbuffer and max_buffer_mem if not capturing at very high traffic rates
- Consider packetbuffer_compress = yes to reduce memory usage at the cost of CPU
- See Sniffer_configuration for complete memory and buffer configuration documentation
Checking Current Memory and Swap Usage
To verify the current memory and swap status:
free -m