This article provides instructions on how to install and configure a RAMDisk to be used as a video cache temporary directory for a UniFi Video NVR installed on a supported Windows operating system. This helps reduce IOPS overhead on the video storage target and enable utilization monitoring and alerting.
NOTES & REQUIREMENTS:
This procedure is only applicable to UniFi Video installations running on a supported Windows operating system. Debian and Ubuntu installations automatically create a RAMDisk as a temporary filesystem during service start-up and thus require no manual intervention.
Table of Contents
- Creating a RAMDisk in Windows
- Configuring UniFi Video to use the RAMDisk as a Temporary Directory
- Testing & Verification
UniFi Video uses a temporary directory to store inbound video segments from the cameras that are waiting to be processed and permanently stored on the recording drive.
When UniFi Video is installed on a supported Windows operating system, a subdirectory is created under the recording directory (which by default is C:\ProgramData\unifi-video\data\videos\temp\) to be used as this temporary storage.
The constant utilization of this directory as temporary storage can cause a high IOPS load on the storage drives. On larger deployments with many cameras, UniFi Video’s demand for write IOPS on the storage may exceed the capabilities of the drives, and as a result, the system can become overloaded and cause performance related errors.
By moving the temporary directory into a RAMDisk, the IOPS (input/output operations per second) generated by the temporary files can be offloaded from the main recording storage drive and into RAM, greatly improving the performance of the system and increasing the number of cameras that can be supported on a single system.
Utilizing a RAMDisk is strongly encouraged for any UniFi Video deployment that is installed on a supported Windows operating system.
Creating a RAMDisk in Windows
UniFi Video does not require the use of any specific RAMDisk application and we are unable to directly support third-party software. The following instructions explain how to create a RAMDisk using the popular ImDisk Toolkit project. You may use any RAMDisk software as long as it is stable, provides the same performance benefits reliably, and persists after a reboot.
1. Download and install the 64-bit ImDisk Toolkit with the default settings on the Windows system hosting the UniFi Video software. You can download the latest release from https://sourceforge.net/projects/imdisk-toolkit/
2. Once installed, double-click the RamDisk Configuration link on the Windows Desktop.
3. In the window that opens, configure the Basic tab as follows:
- Size: 3 GB (or about 15% - 30% of System RAM, 3GB is reasonable for a system with 8GB of RAM).
- Allocate Memory Dynamically: Unchecked
- Drive Letter: R: - or a suitable drive letter that is currently unused on the system
- File System: NTFS
- Launch at Windows Startup: Checked
- Create TEMP Folder: Unchecked
4. Click OK to configure and create the RAMDisk. A RamDisk R: Properties window may open for the newly created drive. Click OK to close it.
Configuring UniFi Video to use the RAMDisk as a Temporary Directory
Once the RAMDisk is installed and created correctly, UniFi Video needs to be configured to use it as a temporary directory:
1. Open the new drive in Windows Explorer, and create a subfolder named ufvtempdir. If you choose to use a different folder name, make sure it does not include spaces or special characters (only letters and numbers).
2. Run Notepad as an Administrator
ATTENTION: Do not use a rich text editor such as Word, or Wordpad when editing configuration files, as they will add hidden characters that may prevent UniFi Video to load the file correctly.
3. Select File > Open and navigate to C:\ProgramData\unifi-video\data\system.properties
NOTE: The C:\ProgramData\ directory is hidden by default, so you may need to type in the path or configure Windows Explorer to show hidden files and folders.
4. Add the two following lines to the bottom of the file:
NOTE: Click on the upper, right-hand corner of the code box above to copy the commands for pasting. If typing them manually, make sure to use the escape character (double \\) and that there are no extra characters such as spaces at the end of the line.
av.tempdir=R:\\ufvtempdiris pointing UniFi Video to the directory in ramspace where the ramdisk is configured. If the ramdisk fills up for any reason, the service may crash.
app.av.cache.space.check=truetells UniFi Video to dump the ramdisk if it has become critically full. If you see these issues occurring your hardware may be under-provisioned, or some hardware may be faulty.
5. Save and close the system.properties file.
6. Restart UniFi Video service via the system tray icon or using the Windows Services tool (services.msc).
Testing & Verification
In order to confirm the system is now using the new RAMDisk as a temporary directory, verify that files are being created within the created directory while the service is running and cameras are generating recordings.
If the directory remains empty, confirm that the service has been restarted since editing the system.properties file and that the system.properties file has the correct path configured.