简体   繁体   English

使用 Argo Workflows 创建队列系统

[英]Creating a queue system with Argo Workflows

I am trying to figure out how to set up a work queue with Argo .我想弄清楚如何使用Argo设置工作队列 The Argo Workflows are computationally expensive. Argo 工作流的计算成本很高。 We need to plan for many simultaneous requests.我们需要为许多并发请求做计划。 The workflow items are added to the work queue via HTTP requests.工作流项目通过 HTTP 请求添加到工作队列中。

The flow can be demonstrated like this:流程可以这样演示:

client  
  => hasura # user authentication  
    => redis # work queue
      => argo events # queue listener
        => argo workflows 
          => redis + hasura # inform that workflow has finished
            => client 

I have never build a K8s cluster that exceeds its resources.我从未构建过超出其资源的 K8s 集群。 Where do I limit the execution of workflows?我在哪里限制工作流的执行? Or does Argo Events and Workflows limit these according to the resources in the cluster?或者 Argo 事件和工作流是否根据集群中的资源限制这些?

The above example could probably be simplified to the following, but the problem is what happens if the processing queue is full ?上面的例子可能可以简化为以下内容,但问题是如果处理队列已满会发生什么?

client
  => argo events # HTTP request listener
    => argo workflows

Argo Workflows has no concept of a queue, so it has no way of knowing when the queue is full. Argo Workflows 没有队列的概念,因此无法知道队列何时已满。 If you need queue control, that should happen before submitting workflows.如果您需要队列控制,那应该在提交工作流之前发生。

Once the workflows are submitted, there are a number of ways to limit resource usage.提交工作流后,有多种方法可以限制资源使用。

  1. Pod resources - each Workflow step is represented by a Kubernetes Pod. Pod 资源- 每个工作流步骤都由一个 Kubernetes Pod 表示。 You can set resource requests and limits just like you would with a Pod in a Deployment.您可以像在 Deployment 中使用 Pod 一样设置资源请求和限制。
  2. Step parallelism limit - within a Workflow, you can limit the number of steps running concurrently. 步骤并行限制- 在工作流中,您可以限制同时运行的步骤数。 This can help when a step is particularly resource-intensive.当某个步骤特别需要资源时,这会有所帮助。
  3. Workflow parallelism limit - you can limit the number of workflows running concurrently by configuring them to us a semaphore. 工作流并行限制- 您可以通过将它们配置给我们一个信号量来限制并发运行的工作流的数量。

There are a number of other performance optimizations like setting Workflow and Pod TTLs and offloading YAML for large Workflows to a DB instead of keeping them on the cluster .还有许多其他性能优化,例如设置工作流和 Pod TTL 以及将大型工作流的 YAML 卸载到数据库而不是将它们保留在集群上

As far as I know, there is no way to set a Workflow limit so that Argo will reject additional Workflow submissions until more resources are available.据我所知,没有办法设置工作流限制,以便 Argo 拒绝额外的工作流提交,直到有更多资源可用。 This is a problem if you're worried about Kubernetes etcd filling up with too many Workflow definitions.如果您担心 Kubernetes etcd 会填满太多工作流定义,这将是一个问题。

To keep from blowing up etcd, you'll need another app of some kind sitting in from of Argo to queue Workflows submissions until more resources become available.为了避免炸毁 etcd,您需要另一个来自 Argo 的应用程序来排队工作流提交,直到有更多资源可用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM