The problem with disk based /tmp is not that tmpfs or ext3 is faster perse. It's about when they want to do I/O:
- Ext3 sooner or later wants to write all data to disk, this might be because of dirty memory limits or because some application does a sync like call or sync on rename. But it *wants* to be on a disk.
- Tmpfs has no desire to be on disk. Sure, if the system is under memory pressure it is a candidate to being written to disk, but that's about the only case that it ever happens. And any data that is written to disk doesn't need the indexing on disk to retrieve it, just the in-memory indexing which is volatile, just as you expect from a temporary filesystem.
And you can tune a lot about ext3, but at it's core it wants to make sure an always valid structure on disk exists. You can't make it ignore any sync requests, you can't tell it to not bother updating the free-space (you want it to be empty each time it's mounted, so why bother keeping track of which blocks are free?).
> Why do you use tmpfs then? You can just use regular disk. Have you noticed some speedup because of using tmpfs?
I don't know about you, but disk I/O is one of the biggest bottlenecks on our systems. And trying to prevent any for of I/O unless really necessary really helps overall system performance. So yes, we do.
> Nobody does fsync in /tmp, so nobody bothers. :)
Oh? Most software is oblivious to where they write or how their writes might affect performance. And often software is rightfully written to be "correct" (power fail safe) but are in some cases used in a different capacity than was originally imagined. And some tools call 'sync' (like "dpkg" and probably "rpm" too), which sync *all* filesystems mounted.
> That's why ext3 is better. Replaying ext3 journal is faster than creating a new filesystem.
You know what is faster than replaying a journal and than performing (effectively) 'rm -rf' on it? Never creating a filesystem in the first place. Swap space never has to be recreated it's assumed to be unused on fresh boot.
Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds