MemFS 2.0 - A Memory-based File System on HP-UX 11iv3

12
As mentioned earlier, the amount of free space on the file system depends on the free swap space
at that instant. memfs_swapmax_pct(5) tunable can be used to increase the swap space available
for MemFS. 0-80% of the swap space can be specified for MemFS usage. This tunable will just
specify the maximum percentage of swap space MemFS can use but this will not reserve the
space for MemFS and assures the space for MemFS. In case the MemFS has exhausted the space
available for it, ENOSPC will be returned to the application and following message will be
displayed on the console.
memfs: Cumulative data exceeds memfs_swapmax_pct
Similarly the number of inodes that can be created on the file system depends on the free
available memory at that instant. ninode just specifies the maximum limit, but does not reserve or
assure the number of the files that can be created on that file system. If creation of file or directory
fails if this limit has been reached, ENOMEM will be returned to the application. If it fails due to
memory deficit, error will be returned and following message will be displayed on the console,
memfs: metadata exceeds memfs_metamax
memfs_metamax(5) tunable can be used to increase the memory usage of MemFS. Even this will
just specify the maximum limit but does not assure memory for MemFS. Maximum of 30% of the
memory can be used by MemFS.
Recommended Use
Applications that will benefit most from MemFS are those that perform mostly meta-data intensive
operations like creates and deletes of small files and directories. For example: compilers, editors
and sorting applications. MemFS never writes out meta-data for files, so directory and file
manipulation is always a performance gain. Applications can also interact with MemFS files using
the mmap interface. Use MemFS only for temporary files. The /tmp can be mounted as MemFS for
better performance.
Limitations and Future Work
MemFS uses static hash table for searching the files on a file system. This could reduce the
performance as more number of files is created on the file system. This will be replaced by
dynamic growing hash tables in future.
Summary
MemFS shows better performance advantages associated with memory-based file systems and is
competitive with other vendors. It also provides significant design advantages over its predecessor
and RAMdisk style file systems. MemFS uses memory efficiently because it is not a fixed size, and
memory not used by MemFS is available for other uses. MemFS provides additional file system
space, and supports UNIX file semantics while remaining fully compatible with other file system
types.