Skip to content

parcelset: add connection cache saturation counters and exhaustion alerting#7166

Open
Sanchit2662 wants to merge 3 commits intoTheHPXProject:masterfrom
Sanchit2662:feature/parcelport-connection-cache-saturation-counters
Open

parcelset: add connection cache saturation counters and exhaustion alerting#7166
Sanchit2662 wants to merge 3 commits intoTheHPXProject:masterfrom
Sanchit2662:feature/parcelport-connection-cache-saturation-counters

Conversation

@Sanchit2662
Copy link
Copy Markdown
Contributor

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.

…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>
@Sanchit2662 Sanchit2662 marked this pull request as ready for review April 11, 2026 10:28
@Sanchit2662 Sanchit2662 requested a review from hkaiser as a code owner April 11, 2026 10:28
@codacy-production
Copy link
Copy Markdown

codacy-production bot commented Apr 11, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

@StellarBot
Copy link
Copy Markdown

Can one of the admins verify this patch?

Copy link
Copy Markdown
Contributor

@hkaiser hkaiser left a comment

Choose a reason for hiding this comment

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

Signed-off-by: Sanchit2662 <sanchit2662@gmail.com>
@Sanchit2662 Sanchit2662 requested a review from hkaiser April 12, 2026 08:02
Copy link
Copy Markdown
Contributor

@hkaiser hkaiser left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@hkaiser hkaiser added this to the 2.0.0 milestone Apr 12, 2026
@hkaiser
Copy link
Copy Markdown
Contributor

hkaiser commented Apr 12, 2026

@Sanchit2662 Could you please address the clang-format issues reported?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants