简体   繁体   English

在 sidekiq 中创建工作和子工作的正确策略是什么?

[英]Whats the right strategy of when to create jobs and sub jobs in sidekiq?

So I have a system that receives messages from devices and then it goes through 3 different servers and countless of services are run on each job.所以我有一个系统,它从设备接收消息,然后通过 3 个不同的服务器,每个作业都运行着无数的服务。 From an architecture perspective, whats certain considerations in using sidekiq to make my program async?从架构的角度来看,使用 sidekiq 使我的程序异步有哪些注意事项? Are there downsides to making sub processes run using sidekiq.使用 sidekiq 使子进程运行有缺点吗? Any advice?有什么建议吗?

architecture(system design) should be based on the problems you are trying to solve.体系结构(系统设计)应该基于您要解决的问题。 if your services are design to unique business domains and if they are async compatible then you can spawn sub jobs for each service.如果您的服务是为独特的业务领域设计的,并且它们是异步兼容的,那么您可以为每个服务生成子作业。 but if not or your need flexible transactions among services then job per request is the right choice.但如果不是,或者您需要在服务之间进行灵活的交易,那么按请求工作是正确的选择。 so you may have both of these implementations in your system based on the requirements.因此,您可能会根据需要在系统中同时拥有这两种实现。

The upside to making your program async with sidekiq is that it is easy and produces good reporting in case of an error.使您的程序与 sidekiq 异步的好处是它很容易,并且在出现错误时会生成良好的报告。 The downsides of using sidekiq for this task is that there is a lot of overhead creating and executing the jobs.将 sidekiq 用于此任务的缺点是创建和执行作业的开销很大。 This could become such a problem that it represents the majority of the resources used.这可能会成为一个问题,以至于它代表了所用资源的大部分。

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

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