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

docs: Add redis-streams streamLength documentation #1094

Merged
merged 1 commit into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 35 additions & 3 deletions content/docs/2.11/scalers/redis-cluster-streams.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ Redis 5.0 introduced [Redis Streams](https://redis.io/topics/streams-intro) whic

One of its features includes [`Consumer Groups`](https://redis.io/topics/streams-intro#consumer-groups), that allows a group of clients to co-operate consuming a different portion of the same stream of messages.

This specification describes the `redis-cluster-streams` trigger that scales based on the *Pending Entries List* (see [`XPENDING`](https://redis.io/commands/xpending)) for a specific Consumer Group of a Redis Stream and supports Redis Cluster topology.
There are two ways to configure `redis-streams` trigger:
1. Based on the *Pending Entries List* (see [`XPENDING`](https://redis.io/commands/xpending)) for a specific Consumer Group of a Redis Stream
2. Based on the *Stream Length* (see [`XLEN`](https://redis.io/commands/xlen))


```yaml
Expand All @@ -25,8 +27,9 @@ triggers:
usernameFromEnv: REDIS_USERNAME # optional (can also use authenticationRef)
passwordFromEnv: REDIS_PASSWORD # optional (can also use authenticationRef)
stream: my-stream # Required - name of the Redis Stream
consumerGroup: my-consumer-group # Required - name of consumer group associated with Redis Stream
pendingEntriesCount: "10" # Required - number of entries in the Pending Entries List for the specified consumer group in the Redis Stream
consumerGroup: my-consumer-group # optional - name of consumer group associated with Redis Stream
pendingEntriesCount: "10" # optional - number of entries in the Pending Entries List for the specified consumer group in the Redis Stream
streamLength: "50" # optional - Redis stream length, alternative to pendingEntriesCount scaler trigger
enableTLS: "false" # optional
unsafeSsl: "false" # optional
# Alternatively, you can use existing environment variables to read configuration from:
Expand Down Expand Up @@ -55,7 +58,9 @@ triggers:

- `stream` - Name of the Redis Stream.
- `consumerGroup` - Name of the Consumer group associated with Redis Stream.
> Setting the `consumerGroup` causes the scaler to operate on `pendingEntriesCount`. Lack of `consumerGroup` will cause the scaler to be based on `streamLength`
- `pendingEntriesCount` - Threshold for the number of `Pending Entries List`. This is the average target value to scale the workload. (Default: `5`, Optional)
- `streamLength` - Threshold for stream length, alternative average target value to scale workload. (Default: `5`, Optional)
- `enableTLS` - Allow a connection to Redis using tls. (Values: `true`, `false`, Default: `false`, Optional)
- `unsafeSsl` - Used for skipping certificate check e.g: using self signed certs. (Values: `true`,`false`, Default: `false`, Optional, This requires `enableTLS: true`)

Expand Down Expand Up @@ -150,3 +155,30 @@ spec:
authenticationRef:
name: keda-redis-stream-triggerauth # name of the TriggerAuthentication resource
```

#### Using `streamLength`

To scale based on redis stream `XLEN` don't set `consumerGroup`. Example:

```yaml
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: redis-streams-scaledobject
namespace: default
spec:
scaleTargetRef:
name: redis-streams-consumer
pollingInterval: 20
cooldownPeriod: 200
maxReplicaCount: 10
minReplicaCount: 1
triggers:
- type: redis-cluster-streams
metadata:
addressesFromEnv: REDIS_ADDRESSES
usernameFromEnv: REDIS_USERNAME # name of the environment variable in the Deployment
passwordFromEnv: REDIS_PASSWORD # name of the environment variable in the Deployment
stream: my-stream
streamLength: "50"
```
39 changes: 36 additions & 3 deletions content/docs/2.11/scalers/redis-sentinel-streams.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ Redis 5.0 introduced [Redis Streams](https://redis.io/topics/streams-intro) whic

One of its features includes [`Consumer Groups`](https://redis.io/topics/streams-intro#consumer-groups), that allows a group of clients to co-operate consuming a different portion of the same stream of messages.

This specification describes the `redis-sentinel-streams` trigger that scales based on the *Pending Entries List* (see [`XPENDING`](https://redis.io/commands/xpending)) for a specific Consumer Group of a Redis Stream and supports a Redis Sentinel setup.
There are two ways to configure `redis-streams` trigger:
1. Based on the *Pending Entries List* (see [`XPENDING`](https://redis.io/commands/xpending)) for a specific Consumer Group of a Redis Stream
2. Based on the *Stream Length* (see [`XLEN`](https://redis.io/commands/xlen))


```yaml
Expand All @@ -25,8 +27,9 @@ triggers:
usernameFromEnv: REDIS_USERNAME # optional (can also use authenticationRef)
passwordFromEnv: REDIS_PASSWORD # optional (can also use authenticationRef)
stream: my-stream # Required - name of the Redis Stream
consumerGroup: my-consumer-group # Required - name of consumer group associated with Redis Stream
pendingEntriesCount: "10" # Required - number of entries in the Pending Entries List for the specified consumer group in the Redis Stream
consumerGroup: my-consumer-group # optional - name of consumer group associated with Redis Stream
pendingEntriesCount: "10" # optional - number of entries in the Pending Entries List for the specified consumer group in the Redis Stream
streamLength: "50" # optional - Redis stream length, alternative to pendingEntriesCount scaler trigger
enableTLS: "false" # optional
unsafeSsl: "false" # optional
# Alternatively, you can use existing environment variables to read configuration from:
Expand Down Expand Up @@ -59,7 +62,9 @@ triggers:
- `sentinelMaster` - The name of the master in Sentinel to get the Redis server address for.
- `stream` - Name of the Redis Stream.
- `consumerGroup` - Name of the Consumer group associated with Redis Stream.
> Setting the `consumerGroup` causes the scaler to operate on `pendingEntriesCount`. Lack of `consumerGroup` will cause the scaler to be based on `streamLength`
- `pendingEntriesCount` - Threshold for the number of `Pending Entries List`. This is the average target value to scale the workload. (Default: `5`, Optional)
- `streamLength` - Threshold for stream length, alternative average target value to scale workload. (Default: `5`, Optional)
- `enableTLS` - Allow a connection to Redis using tls. (Values: `true`, `false`, Default: `false`, Optional)
- `unsafeSsl` - Used for skipping certificate check e.g: using self signed certs. (Values: `true`,`false`, Default: `false`, Optional, This requires `enableTLS: true`)

Expand Down Expand Up @@ -157,3 +162,31 @@ spec:
authenticationRef:
name: keda-redis-stream-triggerauth # name of the TriggerAuthentication resource
```

#### Using `streamLength`

To scale based on redis stream `XLEN` don't set `consumerGroup`. Example:

```yaml
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: redis-streams-scaledobject
namespace: default
spec:
scaleTargetRef:
name: redis-streams-consumer
pollingInterval: 20
cooldownPeriod: 200
maxReplicaCount: 10
minReplicaCount: 1
triggers:
- type: redis-sentinel-streams
metadata:
addressesFromEnv: REDIS_ADDRESSES
usernameFromEnv: REDIS_USERNAME # name of the environment variable in the Deployment
passwordFromEnv: REDIS_PASSWORD # name of the environment variable in the Deployment
stream: my-stream
streamLength: "50"
sentinelMaster: "mymaster"
```
38 changes: 35 additions & 3 deletions content/docs/2.11/scalers/redis-streams.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ Redis 5.0 introduced [Redis Streams](https://redis.io/topics/streams-intro) whic

One of its features includes [`Consumer Groups`](https://redis.io/topics/streams-intro#consumer-groups), that allows a group of clients to co-operate consuming a different portion of the same stream of messages.

This specification describes the `redis-streams` trigger that scales based on the *Pending Entries List* (see [`XPENDING`](https://redis.io/commands/xpending)) for a specific Consumer Group of a Redis Stream.
There are two ways to configure `redis-streams` trigger:
1. Based on the *Pending Entries List* (see [`XPENDING`](https://redis.io/commands/xpending)) for a specific Consumer Group of a Redis Stream
2. Based on the *Stream Length* (see [`XLEN`](https://redis.io/commands/xlen))


```yaml
Expand All @@ -25,8 +27,9 @@ triggers:
usernameFromEnv: REDIS_USERNAME # optional (can also use authenticationRef)
passwordFromEnv: REDIS_PASSWORD # optional (can also use authenticationRef)
stream: my-stream # Required - name of the Redis Stream
consumerGroup: my-consumer-group # Required - name of consumer group associated with Redis Stream
pendingEntriesCount: "10" # Required - number of entries in the Pending Entries List for the specified consumer group in the Redis Stream
consumerGroup: my-consumer-group # optional - name of consumer group associated with Redis Stream
pendingEntriesCount: "10" # optional - number of entries in the Pending Entries List for the specified consumer group in the Redis Stream
streamLength: "50" # optional - Redis stream length, alternative to pendingEntriesCount scaler trigger
enableTLS: "false" # optional
unsafeSsl: "false" # optional
databaseIndex: "0" # optional
Expand Down Expand Up @@ -56,7 +59,9 @@ triggers:

- `stream` - Name of the Redis Stream.
- `consumerGroup` - Name of the Consumer group associated with Redis Stream.
> Setting the `consumerGroup` causes the scaler to operate on `pendingEntriesCount`. Lack of `consumerGroup` will cause the scaler to be based on `streamLength`
- `pendingEntriesCount` - Threshold for the number of `Pending Entries List`. This is the average target value to scale the workload. (Default: `5`, Optional)
- `streamLength` - Threshold for stream length, alternative average target value to scale workload. (Default: `5`, Optional)
- `databaseIndex` - The Redis database index. Defaults to `0` if not specified.
- `enableTLS` - Allow a connection to Redis using tls. (Values: `true`, `false`, Default: `false`, Optional)
- `unsafeSsl` - Used for skipping certificate check e.g: using self signed certs. (Values: `true`,`false`, Default: `false`, Optional, This requires `enableTLS: true`)
Expand Down Expand Up @@ -152,3 +157,30 @@ spec:
authenticationRef:
name: keda-redis-stream-triggerauth # name of the TriggerAuthentication resource
```

#### Using `streamLength`

To scale based on redis stream `XLEN` don't set `consumerGroup`. Example:

```yaml
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: redis-streams-scaledobject
namespace: default
spec:
scaleTargetRef:
name: redis-streams-consumer
pollingInterval: 20
cooldownPeriod: 200
maxReplicaCount: 10
minReplicaCount: 1
triggers:
- type: redis-streams
metadata:
addressFromEnv: REDIS_HOST
usernameFromEnv: REDIS_USERNAME # name of the environment variable in the Deployment
passwordFromEnv: REDIS_PASSWORD # name of the environment variable in the Deployment
stream: my-stream
streamLength: "50"
```