Skip to content

Override Time in CacheLib for Accurate Benchmarking #377

@hazelnut-99

Description

@hazelnut-99

Hi!

I'm benchmarking different slab rebalance strategies in CacheLib and noticed that several components are time-dependent:

  1. PoolRebalancer wakes up periodically (default: 1s).
  2. LRU tail age checker relies on time

I was trying to figure out ways to 1) implement a mock timer that ticks according to the trace time 2) override the concept of time in CacheLib with the mock timer.

After reading the code, it feels like all time-relate functionalities in cachelib use real wall clock time via std::chrono, and the current implementation doesn’t seem to support override timer easily.

Does anyone have suggestions on how to approach this? (I think it'd help with testing TTL-related logics as well.

Cheers!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions