mmap'd file vs. swap

Brian Smith brian at
Mon May 5 21:19:29 CEST 2008

My understanding is that Varnish uses a mmap'd file, but it doesn't re-use 
the file's contents when it is restarted. Why does Varnish use a mmap'd file 
instead of just using regular virtual memory (swap) directly? I would think 
that the operating system would be more eager to write the data to the 
mmap'd file than it would be to write to swap; on a system where the hot 
cache entries can be stored on disk, it would seem that the swap-based 
method would be superior.

(I ask because I am trying to decide which method to use for a back-end 
system, not to be critical of Varnish's design.)

Thank you,

More information about the varnish-dev mailing list