21639: Tell the kernel to map in whole blocks with madvise
authorPeter Amstutz <peter.amstutz@curii.com>
Tue, 2 Apr 2024 13:19:34 +0000 (09:19 -0400)
committerPeter Amstutz <peter.amstutz@curii.com>
Tue, 2 Apr 2024 13:19:34 +0000 (09:19 -0400)
This increases cold cache performance from 150 MB/s to 400 MB/s

Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz@curii.com>

sdk/python/arvados/diskcache.py

index b0ae364c88d32ccc1c7a67bb6621035dc65d22e0..3749298210c3b87a5b2b89ec90d53f469c65a92f 100644 (file)
@@ -32,6 +32,8 @@ class DiskCacheSlot(object):
 
     def get(self):
         self.ready.wait()
+        if self.content is not None:
+            self.content.madvise(mmap.MADV_WILLNEED)
         return self.content
 
     def set(self, value):