Quote:
Originally Posted by newbinaryfile
which one is faster then other ? ramfs or tmpfs. because i/o speed most important think for me. i dont care data safety
|
I don't think there is any significant performance difference. But you might need to check that by testing and/or by searching for results of other tests.
tmpfs is significantly more flexible in the ways you can configure it and in the ways it adjusts to level of use, so it is almost always a better choice than ramfs.
I don't recall the exact limits and issues with ramfs (I only use tmpfs). Some of the advantages of tmpfs that I think are not shared by ramfs are:
1) tmpfs only uses the ram if you actually allocate the files. Otherwise the ram is available for any other use.
2) If you put more on a tmpfs than you have available ram, it will fall back to using your swap space. In deciding what to put in the tmpfs, you probably won't be expecting it to need more ram than it can get. But having a smooth fallback (vs. failing) is nice in case you mis estimated the total use.
But, I also want to point out that you may have much less need for either tmpfs or ramfs than you think. Linux file caching usually works a lot better than you probably expect.
You might expect it would be a good idea to copy a bunch of important files from hdd to tmpfs when the OS boots and then use them from tmpfs from then on. That usually is wasted effort. It is more efficient to let the OS automatically copy them from hdd to cache on first use and keep them in cache as long as there is no more important use for that ram.
A tmpfs is much better for files that tend to exist for a short time and then get deleted. If you just rely on the cache, the files will usually stay in cache (so you don't lose time reading them from disk). But they (and their directory entries) will also usually get written to disk. So you waste time with lots of writes to disk to create and delete directory info and write data, all of which only gets used from cache, so none of the disk writes are read back. A tmpfs avoids all that. The file contents and the directory entries are only written to disk (to swap space) if you mis estimated it or your other your ram needs and don't have room for it in ram.