0

我对队列中的服务处理任务的扩展规则有疑问。假设我们有非常简单和常见的情况:

  • 服务 以每秒约 100 个任务的速率将任务推送到队列
  • 服务 B 以每秒约 20 个任务的速度处理任务

使用 keda 扩展服务 B 看起来很简单:

  • 基于队列配置触发器
  • 将 queueLenth 设置为某个随机值(?),例如 10

但在现实世界中,由于这样的流程,我们的副本数量一直在上下跳跃 5 左右:

  1. 如果我们有 5 个副本 - 队列为空
  2. 如果队列为空 - 缩小
  3. 如果我们有 4 个副本 - 队列增长非常快
  4. keda 设置 5 个或更多副本,因为队列可能非常大
  5. 转到第 1 步

是不是普遍问题。有可能解决吗?

目前我们可以用keda开发的最好的是:

spec:
  advanced:
    horizontalPodAutoscalerConfig:
      behavior:
        scaleDown:
          policies:
          - periodSeconds: 600
            type: Pods
            value: 1
          stabilizationWindowSeconds: 1200
        scaleUp:
          policies:
          - periodSeconds: 1200
            type: Pods
            value: 1
          stabilizationWindowSeconds: 1
  maxReplicaCount: 10
  minReplicaCount: 1
  pollingInterval: 30
  scaleTargetRef:
    envSourceContainerName: celery
    name: celery
  triggers:
  - metadata:
      queueName: celery
      listLength: "2"
    type: redis
4

0 回答 0