From c623b256a3581e1093aae78ad3e974767cf97d55 Mon Sep 17 00:00:00 2001 From: jmorganca Date: Sat, 20 Dec 2025 18:13:00 -0800 Subject: [PATCH] better logs --- server/download.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/server/download.go b/server/download.go index e7523a890..81b4054c8 100644 --- a/server/download.go +++ b/server/download.go @@ -491,6 +491,8 @@ func (b *blobDownload) run(ctx context.Context, requestURL *url.URL, opts *regis } // Log progress periodically + // Page cache warning: if spread > 1GB, hasher may hit disk instead of RAM + const pageCacheWarningBytes = 1 << 30 // 1GB progressDone := make(chan struct{}) go func() { ticker := time.NewTicker(time.Second) @@ -498,9 +500,18 @@ func (b *blobDownload) run(ctx context.Context, requestURL *url.URL, opts *regis for { select { case <-ticker.C: - dl := int(b.Completed.Load() * 100 / b.Total) - h := int(sh.Hashed() * 100 / b.Total) - slog.Info(fmt.Sprintf("progress: downloaded %d%% | hashed %d%%", dl, h)) + downloaded := b.Completed.Load() + hashed := sh.Hashed() + dlPct := int(downloaded * 100 / b.Total) + hPct := int(hashed * 100 / b.Total) + spread := dlPct - hPct + spreadBytes := downloaded - hashed + + msg := fmt.Sprintf("progress: downloaded %d%% | hashed %d%% | spread %d%%", dlPct, hPct, spread) + if spreadBytes > pageCacheWarningBytes { + msg += fmt.Sprintf(" [WARNING: %.1fGB ahead, page cache pressure]", float64(spreadBytes)/(1<<30)) + } + slog.Info(msg) case <-progressDone: return }