Skip to end of metadata
Go to start of metadata

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 the files that NMIS touches very often are found in the nmis8/var directory.

Icon

Any files written to RAM disk will not survive a reboot.  After the server reboots the RAM disk will be empty.

Please review this Wikipedia article that addresses tmpfs:

https://en.wikipedia.org/wiki/Tmpfs

Icon

This is an advanced configuration technique for large scale deployments with experienced sysadmin.  The benefits for small scale deployments would be negligible.

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. 

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?

In the example above there appears to be 11GB of RAM available.

Icon

The NMIS Self Test settings may need to be adjusted if the nmis8/var directory is running at a high rate of usage.  Look for the following attributes in nmis8/conf/Config.nmis:

  • 'selftest_min_diskfree_percent' => 10
  • 'selftest_min_diskfree_mb' => 25

 

Step #2 - Create the RAM disk

The RAM disk mount point will need to be created.  In this example we are using /media/ramdisk; be sure to mind the permissions.

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.

Icon

When creating the RAM disk the size parameter may be a number expressed with the suffix k, m or g (kilo, mega, and giga).  It may also be expressed with the % sign.  For example if you'd like to allow the ramdisk to consume up to 25 percent of the available RAM the following technique could be used.


mount -t tmpfs -o size=25% tmpfs /media/ramdisk

Keep in mind that the ramdisk will not immediately consume the amount of RAM specified.   This is the most it will be allowed to consume should it need to.  Also keep in mind that if the RAM is oversubscribed the ramdisk could be pushed into swap.  If the ramdisk find's itself in swap space it defeats the purpose of this expedition, so do try to avoid this situation.

Icon

If you find yourself in a situation where you need to resize the ramdisk on the fly the following method may be useful.

This does not require a reboot and will preserve the files that reside on the ramdisk.

 

Use the df command to confirm that the ramdisk was created.

Step #3 - Disable NMIS

We need to disable NMIS so that it will not attempt to modify the files as we point nmis8/var to the new RAM disk.  This is easily accomplished by placing a file called 'NMIS_IS_LOCKED' in the nmis8/conf directly as in the following example.

Once the lock file is in place check the server for any nmis.pl processes.

When none are found continue

Step #4 - Point nmis8/var at the RAM Disk

Since we are planning to put a sym link in /usr/local/nmis8/ for /var pointing at the new RAM disk; verify that in /usr/local/nmis8/conf/Config.nmis nmis8/var points to /usr/local/nmis8/var.  Here's a sample of the directories configuration in that file.

/usr/local/nmis8/conf/Config.nmis

Create the sym link in /usr/local/nmis8/ sending /var to the RAM disk.

Step #5 - Re-enable NMIS

Remove the previously created NMIS lock file.

Step #6 - Verify

  • move to the /usr/local/nmis8/var directory and execute a 'df -h .' command.  This command should reveal that we are indeed on the ramdisk.

  • Take a look in the /usr/local/nmis8/var directory and confirm that node.json and view.json files have been created. 
  • Verify that the NMIS GUI is functioning normally.
  • Review the nmis8/logs/nmis.log file
  • Check the root user mailbox

 

  • No labels