Skip to content

Conversation

Cali0707
Copy link
Member

Resolves #6402

This PR adds much more explanation for how the EKB scaling works with and without KEDA

Signed-off-by: Calum Murray <cmurray@redhat.com>
Copy link

netlify bot commented Sep 25, 2025

Deploy Preview for knative ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 2124662
🔍 Latest deploy log https://app.netlify.com/projects/knative/deploys/68d58e6dfd40520008eed7ed
😎 Deploy Preview https://deploy-preview-6406--knative.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

knative-prow bot commented Sep 25, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Cali0707

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 25, 2025
@knative-prow knative-prow bot requested review from creydr and pierDipi September 25, 2025 18:48
@Cali0707
Copy link
Member Author

/cc @matzew

@knative-prow knative-prow bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 25, 2025
@knative-prow knative-prow bot requested a review from matzew September 25, 2025 18:48
@Cali0707
Copy link
Member Author

/cherry-pick release-1.19

@knative-prow-robot
Copy link
Contributor

@Cali0707: once the present PR merges, I will cherry-pick it on top of release-1.19 in a new PR and assign it to you.

In response to this:

/cherry-pick release-1.19

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@Cali0707
Copy link
Member Author

/cherry-pick release-1.18

@knative-prow-robot
Copy link
Contributor

@Cali0707: once the present PR merges, I will cherry-pick it on top of release-1.18 in a new PR and assign it to you.

In response to this:

/cherry-pick release-1.18

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

name: config-kafka-autoscaler
namespace: knative-eventing
data:
# What autoscaling class should be used. Can either be keda.autoscaling.knative.dev or dispabled.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# What autoscaling class should be used. Can either be keda.autoscaling.knative.dev or dispabled.
# What autoscaling class should be used. Can either be keda.autoscaling.knative.dev or deactivated.

Copy link
Member

Choose a reason for hiding this comment

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

(typo + inclusive language)

Copy link
Member Author

Choose a reason for hiding this comment

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

disabled is the key we are using in the code afaik - I just took it from the repo

Copy link
Member

Choose a reason for hiding this comment

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

+1 it is there since longer.

class: keda.autoscaling.knative.dev
# The period in seconds the autoscaler waits until it scales down
cooldown-period: "30"
# The lag that is used for scaling (1<->N)
Copy link
Member

Choose a reason for hiding this comment

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

This should probably have a unit?

cooldown-period: "30"
# The lag that is used for scaling (1<->N)
lag-threshold: "100"
# The maximum number of replicas to scale up to
Copy link
Member

Choose a reason for hiding this comment

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

This says "replicas", but the comment above talks about "Kafka consumers" (which I assume means threads reading from a shared consumer group)?

KEDA uses different lag thresholds to determine when to scale your Kafka components:
### Scaling from 0 to 1 (Activation)
- **Trigger**: When consumer lag exceeds the `activation-lag-threshold` (default: 0)
Copy link
Member

Choose a reason for hiding this comment

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

activation-lag-threshold doesn't seem to be in the above ConfigMap. Is this another key?

dispatcher_pods = ceil(total_consumers_for_resource_type / POD_CAPACITY)
```

Where `POD_CAPACITY` defaults to 20, meaning each dispatcher pod can handle up to 20 Kafka consumers.
Copy link
Member

Choose a reason for hiding this comment

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

In the example above, max-scale was set to 50, which seems like it would mean 3 dispatcher pods (the same as if the value were 60). Is there a practical difference between 41 and 60 here given the default value of POD_CAPACITY?

I ask because we had a few samples for Serving autoscaling where the end result was that a single request coming in for a scaled-down pod would sometimes cause 2 pods to start, because the pending request + the "spare capacity" factor ended up crossing the one-pod capacity threshold (i.e. the "spare capacity" number was exactly equal to "pod capacity", so ceil(200 + 1 / 200) => 2).


```bash
# List all consumer groups in your workload namespace
kubectl get consumergroups -n <your-namespace>
Copy link
Member

Choose a reason for hiding this comment

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

can we use the FQN of the resource, @Cali0707 ?

```

For example:
- 2 Triggers each with `min-scale: "40"` = 80 total consumers
Copy link
Contributor

Choose a reason for hiding this comment

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

Not rendered as a list. You probably need a blank line between the bulletpoint and the "For example:" header.

Screenshot From 2025-09-30 18-57-47

## Configure Autoscaling for a Resource

If you want to customize how KEDA scales a KafkaSource, trigger, or subscription you can set annotations on the resource:
If you want to customize how KEDA scales a KafkaSource, trigger, or subscription you can set annotations on the resource.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: here trigger, or subscription have a small first letter, but here a capital first letter :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Explain that KEDA Kafka Scaling for EKB scales consumers, not pods
5 participants