Skip to content

Cache miss rate in registry due to use of WeakMap.get(Object) #684

@jdmarshall

Description

@jdmarshall

The optimization in #549 looks up labels by object.

Map and WeakMap keys that are not strings rely on object identity, so any two Metrics with the same labels will hit different keys, resulting in more eviction of old values, which could easily happen with count and sum metrics.

The tendency to make defensive copies of data structures in the code is likely exacerbating this miss rate.

It may be best to pull this code out, fix the issue, and then use the exact same code for util.hashObject()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions