Mmapfs vs niofs?

How can we increase virtual memory on linux?
But if use mmapfs, how it works? In case we have 100 indexes and each of size like 2-3 GB.
In case we have memory up to like 20 GB and in such case will elasticsearch handle, how many will stay in memory and how memory will remain on disk and in this case, mmapfs is not an option?

Add more system memory and the OS will use it.

I don't know the particulars of how mmapfs works though.

mmapfs is a bit more efficient than niofs as it allows to read directly into the filesystem cache while niofs requires to perform some copies. However, we had seen occasional issues with mmapfs on very large indices due to memory fragmentation, so since elasticsearch 1.3, defaults are to use mmapfs on the files that are important for performance and niofs for files that are very large and not so important. I would strongly encourage to use the defaults and not try to configure the directory implementation. See for more information.