Update metrics tracking and enhance cache eviction strategies
Release Tag / release (push) Successful in 34s
Release Tag / release (push) Successful in 34s
- Added metrics for bytes saved from cache to improve performance insights. - Updated cache eviction strategies in MemoryFS and DiskFS to include metrics tracking for hits and evictions. - Enhanced README.md with updated garbage collection algorithm descriptions and recommendations for cache usage. - Introduced new madviseSequential functionality for improved memory access hints on Unix systems. - Adjusted validation configuration in examples to better reflect realistic usage scenarios.
This commit is contained in:
@@ -179,6 +179,17 @@ func New(address string, memorySize string, diskSize string, diskPath, upstream,
|
||||
metrics: metrics.NewMetrics(),
|
||||
}
|
||||
|
||||
// Wire metrics into TieredCache so promotions are counted.
|
||||
c.SetMetrics(sc.metrics)
|
||||
|
||||
// Wire metrics into the concrete storage tiers (MemoryFS / DiskFS) so per-tier hits and evictions are counted.
|
||||
if m != nil {
|
||||
m.SetMetrics(sc.metrics)
|
||||
}
|
||||
if d != nil {
|
||||
d.SetMetrics(sc.metrics)
|
||||
}
|
||||
|
||||
// Wire the request processor (constructor injection of interfaces for the owned wrappers + vfs + client + scalars).
|
||||
// Done after all fields including wrappers are set; before attach goroutines (no impact on lifecycle paths).
|
||||
sc.processor = newRequestProcessor(sc)
|
||||
@@ -209,12 +220,16 @@ func New(address string, memorySize string, diskSize string, diskPath, upstream,
|
||||
sc.wg.Add(1)
|
||||
go func() {
|
||||
defer sc.wg.Done()
|
||||
t0 := time.Now()
|
||||
_ = d.Size()
|
||||
select {
|
||||
case <-sc.shutdownCh:
|
||||
return
|
||||
default:
|
||||
c.SetSlow(dgc)
|
||||
logger.Logger.Info().
|
||||
Dur("attach_delay", time.Since(t0)).
|
||||
Msg("Disk slow tier attached (mixed mode); prior traffic was memory-only")
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user