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
Step #3 - Disable NMIS
We need to disable NMIS so that it will not attempt to modify the files as we are point nmis8/var to the new RAM disk. Comment out any jobs in /etc/cron.d/nmis that may run during the next 20 minutes. Here's an example of a couple cron jobs that should be commented out.
###################################################### # Run (selective) Statistics and Service Status Collection often #* * * * * root /usr/local/nmis8/bin/nmis.pl type=collect mthread=true ; /usr/local/nmis8/bin/nmis.pl type=services mthread=true ###################################################### # Run Summary Update every 5 minutes #*/5 * * * * root /usr/local/nmis8/bin/nmis.pl type=summary
After these jobs have been disabled, check the server for any nmis.pl processes
[root@TEST]# ps -ef | grep nmis.pl
When none are found continue
Step #4 - Point nmis8/var at the RAM Disk