Temporary files: RAM or disk?
Temporary files: RAM or disk?
Posted Jun 7, 2012 13:15 UTC (Thu) by njs (subscriber, #40338)In reply to: Temporary files: RAM or disk? by giraffedata
Parent article: Temporary files: RAM or disk?
Posted Jun 7, 2012 13:28 UTC (Thu)
by Jonno (subscriber, #49613)
[Link]
I find that if I have two processes with large working sets causing swaping, and kill one them, doing a swapoff will get the other one performant again much faster than letting it swap in only the stuff it needs as it needs it.
Posted Jun 7, 2012 15:44 UTC (Thu)
by giraffedata (guest, #1954)
[Link] (1 responses)
Good information.
That's probably a good reason to use a regular filesystem instead of tmpfs for large temporary files.
I just checked, and the only readahead tmpfs does is the normal swap readahead, which consists of reading an entire cluster of pages when one of the pages is demanded. A cluster of pages is pages that were swapped out at the same time, so they are likely to be re-referenced at the same time and are written at the same spot on the disk. But this strategy won't effect streaming, like typical filesystem readahead.
And the kernel default size of the cluster is 8 pages. You can control it with /proc/sys/vm/page-cluster, though. I would think on a system with multi-gigabyte processes, a much larger value would be optimal.
Posted Jun 11, 2012 14:51 UTC (Mon)
by kleptog (subscriber, #1183)
[Link]
Posted Jun 7, 2012 21:36 UTC (Thu)
by quotemstr (subscriber, #45331)
[Link] (1 responses)
Windows 8 will do that for modern applications. http://blogs.msdn.com/b/b8/archive/2012/04/17/reclaiming-...
Posted Jun 8, 2012 0:15 UTC (Fri)
by giraffedata (guest, #1954)
[Link]
When njh says "hack" I think it means something an intelligent user can invoke to override the normal system paging strategy because he knows a process is going to be faulting back much of its memory anyway.
The Windows 8 thing is automatic, based on an apparently pre-existing long-term scheduling facility. Some applications get long-term scheduled out, aka "put in the background," aka "suspended," mainly so devices they are using can be powered down and save battery energy. But there is a new feature that also swaps all the process' memory out when it gets put in the background, and the OS takes care to put all the pages in one place. Then, when the process gets brought back to the foreground, the OS brings all those pages back at once, so the process is quickly running again.
This of course requires applications that explicitly go to sleep, as opposed to just quietly not touching most of their memory for a while, and then suddenly touching it all again.
Temporary files: RAM or disk?
Temporary files: RAM or disk?
At least on our compute servers (running some vaguely recent Ubuntu, IIRC), swap-in is definitely not doing successful readahead
Temporary files: RAM or disk?
Temporary files: RAM or disk?
Temporary files: RAM or disk?
I've often wished for some hack that would just do a sequential read through the swap file to load one process back into memory
Windows 8 will do that for modern applications.