-
Notifications
You must be signed in to change notification settings - Fork 112
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 support for scaling based on Nakadi #636
Conversation
b0cd05f
to
5b574b5
Compare
5b574b5
to
8db240c
Compare
selector: | ||
matchLabels: | ||
type: nakadi | ||
subscription-id: "708095f6-cece-4d02-840e-ee488d710b29" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think subscription is uniquely identified by the owning_application
, event_types
and consumer_group
https://nakadi.io/manual.html#creating-subscriptions so maybe (as a future improvement) this metric handler could also support these three fields and figure out subscription id by listing subscriptions https://nakadi.io/manual.html#getting-and-listing-subscriptions
This could be handy to define the same logical subscription (same owning_application
, event_types
and consumer_group
) in staging and production environments (instead of templating subscription-id value).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jFYI: this could be a feature improvement but not prioritized for now. But it's simple to add later even if we don't do it in the first iteration.
423c640
to
cc0557a
Compare
cc0557a
to
ac8ddaf
Compare
ac8ddaf
to
917a2db
Compare
3d88292
to
1160fe8
Compare
👍 |
537d1a3
to
998d1f1
Compare
Signed-off-by: Mikkel Oscar Lyderik Larsen <mikkel.larsen@zalando.de>
998d1f1
to
4aeebc8
Compare
👍 |
kind: Deployment | ||
name: custom-metrics-consumer | ||
minReplicas: 0 | ||
maxReplicas: 8 # should match number of partitions for the event type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we can improve it in the future that autoscaler does that on its own. it is possible to know number of partitions for Subscription
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then we need some abstraction on top of HPA to hide this setting for users. Not saying we should not, but it's more complex than what we can implement with the native resource.
|
||
`unconsumed-events` - is the total number of unconsumed events over all | ||
partitions. When using this `metric-type` you should also use the target | ||
`averageValue` which indicates the number of events which can be handled per |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is that really per pod or per the whole the stack? so if I have 2 pods and average number goes beyond 30 then a pod is added. it means it is 30 per 2 pods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is how you define it. The autoscaler will always scale higher rather than lower. So if the averageTarget is 30 and you have 31 unconsumed events, it will scale to 2 pods, but it will not scale higher until 61 unconsumed events where it then needs 3 pods.
Co-authored-by: Andrey <andrey.dyachkov@gmail.com> Signed-off-by: Mikkel Oscar Lyderik Larsen <mikkel.larsen@zalando.de>
e0040bb
to
43dd2e9
Compare
👍 |
1 similar comment
👍 |
This adds support for scaling based on Nakadi subscriptions by utilizing the nakadi stats api: https://nakadi.io/manual.html#/subscriptions/subscription_id/stats_get
It's possible to define an HPA like below:
To scale on either
consumer-lag-seconds
orunconsumed-events
.Fix #5
TODO