Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add subpool stats #1852

Merged
merged 3 commits into from
Apr 9, 2024
Merged

Add subpool stats #1852

merged 3 commits into from
Apr 9, 2024

Conversation

glbrntt
Copy link
Collaborator

@glbrntt glbrntt commented Apr 9, 2024

Modification:

It can be helpful to track the state of the connection pool as a whole over time to understand how heavily utilised it is. This is awkward to do at the moment because delegate functions are called on connection state changes. There's also no insight into how many RPCs are queued waiting for a stream.

Modifications:

  • Add a 'GRPCSubPoolStats' type capturing stats from each subpool. This includes:
    • counts of connections in each state
    • streams in use
    • streams which are free to use
    • number of rpcs waiting for a stream
  • Add a delegate method which is passed an array of subpool stats (one per subpool) and add a no-op default implementation.
  • Add configuration to determine how frequently stats are collected

Result:

More insight into pool stats

Modification:

It can be helpful to track the state of the connection pool as a whole
over time to understand how heavily utilised it is. This is awkward to
do at the moment because delegate functions are called on connection
state changes. There's also no insight into how many RPCs are queued
waiting for a stream.

Modifications:

- Add a 'GRPCSubPoolStats' type capturing stats from each subpool. This
  includes:
  - counts of connections in each state
  - streams in use
  - streams which are free to use
  - number of rpcs waiting for a stream
- Add a delegate method which is passed an array of subpool stats (one
  per subpool) and add a no-op default implementation.
- Add configuration to determine how frequently stats are collected

Result:

More insight into pool stats
Copy link
Collaborator

@gjcairo gjcairo left a comment

Choose a reason for hiding this comment

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

LGTM overall, just left a question and a nit

Sources/GRPC/ConnectionPool/GRPCChannelPool.swift Outdated Show resolved Hide resolved
Sources/GRPC/ConnectionPool/PoolManager.swift Show resolved Hide resolved
glbrntt and others added 2 commits April 9, 2024 11:28
@glbrntt glbrntt enabled auto-merge (squash) April 9, 2024 12:08
@glbrntt glbrntt merged commit 26e177e into grpc:main Apr 9, 2024
14 checks passed
@glbrntt glbrntt deleted the conn-pool-stats branch April 9, 2024 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/minor Adds new public API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pool.id uses ObjectIdentifier(connection) as the ID but that's not unique.
2 participants