Overview
Some customers may benefit by moving files that NMIS reads/writes to very often to a RAM Disk. We have seen this improve performance on pollers that have shared storage and 2,000+ nodes provisioned. The concept is that NMIS will be able to read/write to RAM faster than the shared storage. Most of these files that NMIS touches very often are found in the nmis8/var directory.
Procedure
Step #1 - Determine Space Required
There are two questions that quickly come to mind:
- How big should the RAM disk be?
- How much RAM is available?
Check how much space nmis8/var is currently using; minus the nmis8/var/events directory. We will keep the nmis8/var/events directory on a hard drive because it contains stateful event history; we don't want to loose these if the server is rebooted.
[root@TEST var]# pwd /usr/local/nmis8/var [root@TEST var]# du -hs 2.6G . [root@TEST events]# pwd /usr/local/nmis8/var/events [root@TEST events]# du -hs 1.7G .
In this example we notice that the nmis8/var directory minus the nmis8/var/events directory is approximately 900MB. It appears that a RAM disk of 1GB would be sufficient.
How much RAM is available?
[root@TEST events]# free total used free shared buffers cached Mem: 37016616 25990916 11025700 1796 861860 15379752 -/+ buffers/cache: 9749304 27267312 Swap: 4169724 558624 3611100
In the example above there appears to be 11GB of RAM available.
Step #2 - Create the RAM disk
The following commands will create the RAM disk, keep events on the hard drive, and ensure permissions are not lost. These commands should also need to be added to a script that runs at boot time. On Centos 6 /etc/rc.d/rc.local works well.
mount -t tmpfs -o size=1000M tmpfs /media/ramdisk/ mkdir -p /media/ramdisk/nmis8/var ln -s /data/nmis8/var/events /media/ramdisk/nmis8/var /usr/local/nmis8/admin/fixperms.pl