Skip to content

[FLINK-19130] [core] Expose metrics for backpressure - #142

Closed
tzulitai wants to merge 9 commits into
apache:masterfrom
tzulitai:FLINK-19130
Closed

[FLINK-19130] [core] Expose metrics for backpressure#142
tzulitai wants to merge 9 commits into
apache:masterfrom
tzulitai:FLINK-19130

Conversation

@tzulitai

@tzulitai tzulitai commented Sep 4, 2020

Copy link
Copy Markdown
Contributor

This PR adds in total 2 new metrics related to backpressure:

  • Number of blocked addresses (per function type)
  • Number of inflight async operations (per function type + per operator)

We also rejected to add the following metric, since after some discussion it doesn't seem to add much value:

  • Number of accumulated records pre-flight in batch per function type.
    This was not added, with the assumption that users would really only want to care about that some address has reached the maximum request batch size and was being blocked.

Verification

I verified this by running the Python Greeter example, with the following modifications to let backpressure happen more easily:

  • Maximum batch size = 1
  • No delay between each generated message to have maximum input rate

You can see the following metric charts in the Flink Web UI:

image


Brief changelog

  • 78cbc19 Extends the FunctionTypeMetrics interface to include the new metrics, and adds a new FunctionDispatcherMetrics interface for per-operator metrics.
  • 6408866 Introduce a scoped-down interface FunctionTypeMetricsRepository and let StatefulFunctionsRepository extend it. Components that need to access function metrics will be passed this interface.
  • 0fbb17a preliminary extension to ObjectContainer DI utility so that we can share same instance across different object labels.
  • 6c77ca4 Wire-in the new metrics in AsyncSink to expose backpressure metrics.

This commit extends the FunctionTypeMetrics interface and introduces a
new FunctionDispatcherMetrics interface with a goal to expose the
following backpressure-related metrics:

- Number of blocked addresses (per function type)
- Number of inflight async ops (per function type + per-operator)
…ypeMetricsRepository

This commit introduces a new scoped-down interface
FunctionTypeMetricsRepository that the existing
StatefulFunctionsRepository now implements. This interface will be
provided to components that needs access to per-function metrics.
This extends the ObjectContainer to set alias keys that returns the same
instance. This is required for the StatefulFunctionsRepository, since we
want to share the same instance for different keys (depending on which
interface we expose to different components).
Now that we have multiple types of metrics with different scopes
(per-function / per-operator), this interface should be renamed to
convey that it is a factory specific for per-function scoped metrics.
@tzulitai

tzulitai commented Sep 4, 2020

Copy link
Copy Markdown
Contributor Author

Discussion point:

Strictly speaking, the per-operator inflight-async-ops metric is redundant, since most metric reporter systems commonly used by Flink (Prometheus / InfluxDB etc.) have a query language for aggregating metrics.
Therefore, the per-operator inflight-async-ops metric can be aggregated from the per-function ones.

@igalshilman what do you think about this?

As a preparation to expose FunctionTypeMetrics to functions for internal
axcess only, AsyncWaiter is renamed to a more general-purpose name
"InternalContext" so that it makes sense to add more internal-only
context methods there.
@tzulitai

tzulitai commented Sep 8, 2020

Copy link
Copy Markdown
Contributor Author

Update:
After another offline discussion with @igalshilman, we decided to still add metrics for backlog monitoring, per function type.
It's a rather low-hanging fruit to add, and would serve as a good starter for further exploring what auto-scalers might need.

@igalshilman igalshilman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @tzulitai, LGTM!

@tzulitai tzulitai closed this in 9c115e7 Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants