Skip to content

Conversation

@michaeljmarshall
Copy link
Member

Fixes #16584

Motivation

With the RangeCache, it is hard to reason about its behavior other than cache hits/misses or the cache's size hitting the limit and triggering a size based eviction. This PR adds 3 new metrics to help provide additional insight into the cache's behavior. It adds pulsar_ml_cache_inserted_entries_total, pulsar_ml_cache_evicted_entries_total, and pulsar_ml_cache_entries.

Modifications

  • Add new metrics for cache insertion, eviction, and current number of entries.
  • Add new methods to the ManagedLedgerFactoryMXBean interface.
  • Update several method return values in the RangeCache.
  • Update tests.

Verifying this change

This change is covered by modified tests that already existed.

Does this pull request potentially affect one of the following parts:

There is a breaking change to the RangeCache class for the clear and the evictLEntriesBeforeTimestamp methods. The previous result was a long, and now it is a Pair<Integer, Long>. The new result matches the same style as evictLeastAccessedEntries. Given that this class is only meant for use within the broker, I think it is reasonable to break these methods. I will send a note to the mailing list.

Documentation

  • doc

@michaeljmarshall michaeljmarshall added doc Your PR contains doc changes, no matter whether the changes are in markdown or code files. type/feature The PR added a new feature or issue requested a new feature area/broker component/stats labels Aug 24, 2022
@michaeljmarshall michaeljmarshall added this to the 2.12.0 milestone Aug 24, 2022
@michaeljmarshall michaeljmarshall self-assigned this Aug 24, 2022
Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work!

@lhotari lhotari requested a review from hangc0276 August 24, 2022 08:29
@michaeljmarshall michaeljmarshall merged commit e3b2540 into apache:master Aug 24, 2022
@michaeljmarshall michaeljmarshall deleted the instrument-cache-activity branch August 24, 2022 21:00
Nicklee007 pushed a commit to Nicklee007/pulsar that referenced this pull request Aug 29, 2022
…#17248)

Fixes apache#16584

### Motivation

With the `RangeCache`, it is hard to reason about its behavior other than cache hits/misses or the cache's size hitting the limit and triggering a size based eviction. This PR adds 3 new metrics to help provide additional insight into the cache's behavior. It adds `pulsar_ml_cache_inserted_entries_total`, `pulsar_ml_cache_evicted_entries_total`, and `pulsar_ml_cache_entries`.

### Modifications

* Add new metrics for cache insertion, eviction, and current number of entries.
* Add new methods to the `ManagedLedgerFactoryMXBean` interface.
* Update several method return values in the `RangeCache`.
* Update tests.

### Verifying this change

This change is covered by modified tests that already existed.

### Does this pull request potentially affect one of the following parts:

There is a breaking change to the `RangeCache` class for the `clear` and the `evictLEntriesBeforeTimestamp` methods. The previous result was a `long`, and now it is a `Pair<Integer, Long>`. The new result matches the same style as `evictLeastAccessedEntries`. Given that this class is only meant for use within the broker, I think it is reasonable to break these methods. I will send a note to the mailing list.

### Documentation
  
- [x] `doc`
@Technoboy- Technoboy- modified the milestones: 2.12.0, 2.11.0 Oct 13, 2022
Technoboy- pushed a commit that referenced this pull request Oct 13, 2022
Fixes #16584

### Motivation

With the `RangeCache`, it is hard to reason about its behavior other than cache hits/misses or the cache's size hitting the limit and triggering a size based eviction. This PR adds 3 new metrics to help provide additional insight into the cache's behavior. It adds `pulsar_ml_cache_inserted_entries_total`, `pulsar_ml_cache_evicted_entries_total`, and `pulsar_ml_cache_entries`.

### Modifications

* Add new metrics for cache insertion, eviction, and current number of entries.
* Add new methods to the `ManagedLedgerFactoryMXBean` interface.
* Update several method return values in the `RangeCache`.
* Update tests.

### Verifying this change

This change is covered by modified tests that already existed.

### Does this pull request potentially affect one of the following parts:

There is a breaking change to the `RangeCache` class for the `clear` and the `evictLEntriesBeforeTimestamp` methods. The previous result was a `long`, and now it is a `Pair<Integer, Long>`. The new result matches the same style as `evictLeastAccessedEntries`. Given that this class is only meant for use within the broker, I think it is reasonable to break these methods. I will send a note to the mailing list.

### Documentation
  
- [x] `doc`
congbobo184 pushed a commit that referenced this pull request Nov 17, 2022
Fixes #16584

With the `RangeCache`, it is hard to reason about its behavior other than cache hits/misses or the cache's size hitting the limit and triggering a size based eviction. This PR adds 3 new metrics to help provide additional insight into the cache's behavior. It adds `pulsar_ml_cache_inserted_entries_total`, `pulsar_ml_cache_evicted_entries_total`, and `pulsar_ml_cache_entries`.

* Add new metrics for cache insertion, eviction, and current number of entries.
* Add new methods to the `ManagedLedgerFactoryMXBean` interface.
* Update several method return values in the `RangeCache`.
* Update tests.

This change is covered by modified tests that already existed.

There is a breaking change to the `RangeCache` class for the `clear` and the `evictLEntriesBeforeTimestamp` methods. The previous result was a `long`, and now it is a `Pair<Integer, Long>`. The new result matches the same style as `evictLeastAccessedEntries`. Given that this class is only meant for use within the broker, I think it is reasonable to break these methods. I will send a note to the mailing list.

- [x] `doc`

(cherry picked from commit e3b2540)
@congbobo184 congbobo184 added release/2.9.4 cherry-picked/branch-2.9 Archived: 2.9 is end of life labels Nov 17, 2022
congbobo184 pushed a commit that referenced this pull request Dec 7, 2022
Fixes #16584

With the `RangeCache`, it is hard to reason about its behavior other than cache hits/misses or the cache's size hitting the limit and triggering a size based eviction. This PR adds 3 new metrics to help provide additional insight into the cache's behavior. It adds `pulsar_ml_cache_inserted_entries_total`, `pulsar_ml_cache_evicted_entries_total`, and `pulsar_ml_cache_entries`.

* Add new metrics for cache insertion, eviction, and current number of entries.
* Add new methods to the `ManagedLedgerFactoryMXBean` interface.
* Update several method return values in the `RangeCache`.
* Update tests.

This change is covered by modified tests that already existed.

There is a breaking change to the `RangeCache` class for the `clear` and the `evictLEntriesBeforeTimestamp` methods. The previous result was a `long`, and now it is a `Pair<Integer, Long>`. The new result matches the same style as `evictLeastAccessedEntries`. Given that this class is only meant for use within the broker, I think it is reasonable to break these methods. I will send a note to the mailing list.

- [x] `doc`

(cherry picked from commit e3b2540)
momo-jun added a commit to momo-jun/pulsar that referenced this pull request Dec 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/broker cherry-picked/branch-2.9 Archived: 2.9 is end of life cherry-picked/branch-2.10 doc Your PR contains doc changes, no matter whether the changes are in markdown or code files. release/2.9.4 release/2.10.3 type/feature The PR added a new feature or issue requested a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Broker Cache Entry Eviction Rate Metric

8 participants