是否可以使用 celery 来执行同步任务?
几乎同步也可以工作;基本上,我想将 Web 应用程序背后的数据访问和处理委托给大多数作业的任务队列。对于 celery 任务,我认为合理的最快延迟是多少?
更新(为了澄清)
我想为了清楚起见,我应该解释一下吞吐量——虽然很好——对我来说不是一个必要的问题;我暂时还不需要朝这个方向扩展。延迟是我目前评估的唯一标准。我很乐意使用 task.apply
如果这是唯一可行的方法,但我想把工作分担一下。
Nearly synchronous works, too; basically, I want to delegate the data access and processing behind a web app to a task queue for most jobs. What's the fastest latency that I can consider reasonable for celery tasks?
Update (for clarification)
I guess for clarity I should explain that throughput -- while nice -- is not a necessary issue for me; I won't be needing scaling in that direction for a while, yet. Latency is the only criterion that I'll be evaluating at the moment. I'm content to use task.apply
if that's the only way it'll work, but I'd like to farm the work out a bit.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当我说吞吐量时,我指的是从发送任务到执行任务的平均延迟。对于“往返”,我指的是发送任务、执行任务、发回结果和检索结果所需的平均时间。
正如我在评论中所说,我目前没有任何官方数据可以分享,但
与许多其他解决方案相比,正确的配置 Celery 延迟较低,但它仍然比本地执行函数带来更多的开销。这是设计任务粒度时需要考虑的事情[1]
我目前正在编写可能感兴趣的性能指南:
http://ask.github.com/celery/userguide/optimizing.html
欢迎提供反馈,并想了解您感兴趣的任何其他性能因素。
[1] http://celeryq.org/docs/userguide/tasks.html#capsularity
When I say
throughput
I mean the average latency from sending a task until it's been executed. Withroundtrip
I mean the average time it takes to send a task, executing it, sending the result back and retrieving the result.As I said in the comments I currently don't have any official numbers to share, but with
the right configuration Celery is low latency compared to many other solutions, but still it does come with more overhead than executing a function locally. This is something to take into account when designing the granularity of a task[1]
I'm currently writing a performance guide that may be of interest:
http://ask.github.com/celery/userguide/optimizing.html
Feedback welcome, and would like to know about any other performance factors you are interested in.
[1] http://celeryq.org/docs/userguide/tasks.html#granularity