parcelset: add connection cache saturation counters and exhaustion alerting#7166
Open
Sanchit2662 wants to merge 3 commits intoTheHPXProject:masterfrom
Open
Conversation
…erting
Add three new connection cache statistics accessible via HPX performance counters and a throttled LPT_(warning) log when the parcelport connection pool is fully checked out:
- /parcelport/count/<pp>/cache-reservation-failures: counts get_or_reserve()
calls that returned false due to pool saturation (distinct from normal cache misses which do not cause parcel deferral)
- /parcelport/count/<pp>/cache-connections: current tracked connection count
- /parcelport/count/<pp>/cache-max-connections: configured pool maximum
Extends connection_cache_statistics_type enum with three new enumerators (values 5-7) and wires them through parcelport_impl and the performance counter registry. Emits a throttled warning (at most once per 5 s) via
LPT_(warning) whenever pool exhaustion occurs.
Signed-off-by: Sanchit2662 <sanchit2662@gmail.com>
Up to standards ✅🟢 Issues
|
|
Can one of the admins verify this patch? |
hkaiser
reviewed
Apr 11, 2026
Contributor
hkaiser
left a comment
There was a problem hiding this comment.
Very nice!
Could you please add related documentation as well? Likely somewhere here: https://github.com/STEllAR-GROUP/hpx/blob/0db92d07520bc003fa0a106186f175b603fe8cb9/docs/sphinx/manual/optimizing_hpx_applications.rst?plain=1#L1493-L1524
Signed-off-by: Sanchit2662 <sanchit2662@gmail.com>
hkaiser
approved these changes
Apr 12, 2026
Contributor
|
@Sanchit2662 Could you please address the clang-format issues reported? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
So I was looking through the HPX parcelport code and found something that's been quietly broken for a while. When the connection cache gets completely full (like all connections are checked out and there's no space left), the code just silently gives up and defers the parcel. No log, no counter, nothing. You'd have no idea it happened unless you were staring at the source.
The thing that annoyed me is that there's already a cache-misses counter, but it counts two completely different things together. A "miss" when a locality is seen for the first time is totally normal and fine. But a "miss" because the pool is exhausted and a parcel had to be deferred? That's a real problem and it should have its own counter. Mixing them together makes the metric basically useless for debugging saturation.
So what I did was add a separate reservation_failures counter that only goes up when get_or_reserve() returns false due to actual pool exhaustion. That way you can watch it and know for sure whether you're hitting the connection limit or not.
I also added two more counters, cache-connections and cache-max-connections, so you can just check how many connections are currently tracked vs. how many are allowed. If cache-connections == cache-max-connections and cache-reservation-failures is climbing, you know to bump hpx.max_connections in your ini file.
On top of that, I added a warning log that fires when the pool exhausts, but it's throttled to at most once every 5 seconds so it doesn't spam the logs if things are bad for a while.
All the new counters show up under /parcelport/count//cache-reservation-failures, /parcelport/count//cache-connections, and /parcelport/count//cache-max-connections, following the same naming pattern as the existing ones.
This originally came from issue #713 back in 2013 where someone asked for connection cache monitoring. The basic counters were added then, but this specific gap was never filled.