[arvados] updated: 2.7.0-6012-g222b45df0a
git repository hosting
git at public.arvados.org
Mon Feb 26 21:29:21 UTC 2024
Summary of changes:
sdk/go/arvados/fs_collection.go | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
via 222b45df0a30dad5189599d7942271c63f46f72d (commit)
from 1dcde0921ddb62ae1a4ea01bc9d5179c6a994882 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 222b45df0a30dad5189599d7942271c63f46f72d
Author: Tom Clegg <tom at curii.com>
Date: Mon Feb 26 16:28:07 2024 -0500
18961: Hold off multiple pre-fetch for 10 seconds, not forever.
In the keep-web usage pattern, the "don't pre-fetch this block again"
flag prevents the prefetch mechanism from working more than once on a
collectionfs that is kept in memory for a long time and used
repeatedly.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>
diff --git a/sdk/go/arvados/fs_collection.go b/sdk/go/arvados/fs_collection.go
index c3a210faa3..875a942210 100644
--- a/sdk/go/arvados/fs_collection.go
+++ b/sdk/go/arvados/fs_collection.go
@@ -645,7 +645,7 @@ func (fn *filenode) Read(p []byte, startPtr filenodePtr) (n int, ptr filenodePtr
}
if ss, ok := fn.segments[ptr.segmentIdx].(storedSegment); ok {
ss.locator = fn.fs.refreshSignature(ss.locator)
- ss.didRead = true
+ ss.didRead = time.Now()
fn.segments[ptr.segmentIdx] = ss
}
@@ -1227,6 +1227,10 @@ var (
// At runtime this is a no-op. Test cases replace this func
// with a call to Add(1).
profAdd1 = func(*atomic.Int64) {}
+
+ // Don't pre-fetch a block if we already tried to read it this
+ // recently.
+ prefetchHoldDuration = 10 * time.Second
)
// Prefetch file data based on expected future usage.
@@ -1284,12 +1288,12 @@ func (dn *dirnode) prefetch(fn *filenode, name string, ptr filenodePtr) {
}
if next, ok := fn.segments[inext].(storedSegment); !ok {
todo -= fn.segments[inext].Len()
- } else if next.didRead {
+ } else if !next.didRead.IsZero() && time.Since(next.didRead) < prefetchHoldDuration {
todo -= next.size
lastlocator = next.locator
} else {
profAdd1(&prefetchReadCurrent)
- next.didRead = true
+ next.didRead = time.Now()
fn.segments[inext] = next
go next.ReadAt([]byte{}, 0)
todo -= next.size
@@ -1340,13 +1344,13 @@ func (dn *dirnode) prefetch(fn *filenode, name string, ptr filenodePtr) {
if next.locator == lastlocator {
// we already subtracted this block's
// size from todo
- } else if next.didRead {
+ } else if !next.didRead.IsZero() && time.Since(next.didRead) < prefetchHoldDuration {
// someone already fetched this
// segment
todo -= next.size
} else {
profAdd1(&prefetchReadNext)
- next.didRead = true
+ next.didRead = time.Now()
fn.segments[inext] = next
go next.ReadAt([]byte{}, 0)
todo -= next.size
@@ -1937,10 +1941,10 @@ type storedSegment struct {
offset int // position of segment within the stored block
length int // bytes in this segment (offset + length <= size)
- // set when we first try to read from this segment, and
+ // Set when we first try to read from this segment, and
// checked before pre-fetch, to avoid unnecessary cache
- // thrashing
- didRead bool
+ // thrashing. See prefetchHoldDuration.
+ didRead time.Time
}
func (se storedSegment) Len() int {
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list