r4032 - trunk/varnish-cache/bin/varnishd

sky at projects.linpro.no sky at projects.linpro.no
Mon Apr 13 22:34:04 CEST 2009


Author: sky
Date: 2009-04-13 22:34:03 +0200 (Mon, 13 Apr 2009)
New Revision: 4032

Modified:
   trunk/varnish-cache/bin/varnishd/storage_file.c
Log:
Tell the kernel that we expect to use this memory randomly -- affects how it reads up to page cache. On linux I saw a 10-20x decrease in IO from reading the disk

Modified: trunk/varnish-cache/bin/varnishd/storage_file.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/storage_file.c	2009-04-12 17:13:05 UTC (rev 4031)
+++ trunk/varnish-cache/bin/varnishd/storage_file.c	2009-04-13 20:34:03 UTC (rev 4032)
@@ -417,6 +417,7 @@
 		p = mmap(NULL, sz, PROT_READ|PROT_WRITE,
 		    MAP_NOCORE | MAP_NOSYNC | MAP_SHARED, sc->fd, off);
 		if (p != MAP_FAILED) {
+			(void) madvise(p, sz, MADV_RANDOM);
 			(*sum) += sz;
 			new_smf(sc, p, off, sz);
 			return;



More information about the varnish-commit mailing list