UbuntuThis forum is for the discussion of Ubuntu Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150
Rep:
obviously a ram disk is going to be faster than a mechanical drive, but whatever you use in the ram dksk is not available to programs so may cause more use of swap, also if you need to save the data after power down you will need to write it out to a 'real' disk all of which takes time, it's swi ngs and roundabouts really
obviously a ram disk is going to be faster than a mechanical drive, but whatever you use in the ram dksk is not available to programs so may cause more use of swap, also if you need to save the data after power down you will need to write it out to a 'real' disk all of which takes time, it's swi ngs and roundabouts really
I am aware of that.
A browser cache never needs to be saved.
I have 8 Gb of ram, of which only 2 Gb is ever used.
A ram disk is even faster than a SSD drive.
When burning CD/DVDs I notice that CPU usage is very high, but I think the burner program uses RAM for it's cache.
tmpfs is incredibly fast. I even blogged a how-to on customizing boot scripts to load the entire OS into a tmpfs ramdisk. It's faster than any SSD. And it honestly does NOT slow down a system if you have swap. tmpfs can be offloaded into swap space, which reduces the performance of any files offloaded down to the level of normal files on a normal partition...but this is not really worse than the performance had those files been on a normal partition in the first place.
The differences in performance are more subtle. Basically, a normal file on a normal partition will receive writes at some point when the drive is free to accept the updates. In all cases, writes first go to the RAM cached file. If it's backed by a normal partition, then this update will be written to disk eagerly...as early as convenient. After being written to disk, the cached portion is marked as clean (so it can be flushed from RAM at any instant to make way for something else needing RAM).
tmpfs is basically just a RAM cache with no disk file system backing it. As such, there's nothing to write updates to. Its files can never be marked clean. But they can be offloaded into swap...not eagerly, though. It'll only get offloaded at the last second, when the RAM is needed. This may cause a noticeable speed bump as whatever needs the RAM waits for it. So maybe you'll notice some slower performance. Maybe. But once it is offloaded into swap, that RAM is now available. As long as the offloaded files aren't accessed again, it just sits on swap not impairing performance at all. Just like any normal file just sitting on disk.
Now, there's the question - "Where is it?" when you look at the output of "free". Unfortunately, the data returned by "free" does not account for tmpfs in a neat way. The problem is that tmpfs is implemented as a file cache that just happens to not have a normal file system backing it. As such, it's included in with "cache". But everything else in "cache" is not really used up in a way that makes the RAM unavailable. Normally, "cache" is nothing but blocks that are either clean or will be clean soon enough. Any clean blocks can be dumped from RAM in a flash.
But tmpfs breaks that assumption. Any tmpfs cache will NEVER be clean. They will ALWAYS be dirty, because there just isn't any backing file system.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.