[SERVER-85883] Allow extending arbitrary types with partitioned counters Created: 29/Jan/24  Updated: 05/Feb/24

Status: In Progress
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Amirsaman Memaripour Assignee: Amirsaman Memaripour
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-85877 Use restartable sequences to implemen... Backlog
Assigned Teams:
Service Arch
Sprint: Service Arch 2024-02-05, Service Arch 2024-02-19
Participants:

 Description   

Create CounterHolder, a new type that holds a collection of partitioned counters:

  • A derived type (i.e. ServiceContext) must extend CounterHolder, highlighting that it can be augmented with partitioned counters.
  • Counters can then be added to the derived type using a new API, which is very similar to that used for declaring decorations.
  • For simplicity, all counters are the same type (64-bit unsigned integer) and are initialized at zero.
  • The declared counters will be partitioned based on the number of virtual cores, which is decided at runtime, and packed into as few cache-lines as possible.
  • Counters can be defined in any compilation unit, however, their lifetime is bound to the parent object (e.g. ServiceContext) and may be packed into the same cache-line with counters from other compilation units.

Internally, CounterHolder uses Counter to manage individual counters (see SERVER-85877). Also, this is primarily designed for service-level counters (e.g. those on ServiceContext).


Generated at Thu Feb 08 06:58:51 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.