Rails 实时处理后台作业

发布于 2025-01-08 10:15:26 字数 262 浏览 3 评论 0原文

我在heroku cedar-stack 上使用了hirefire-gem 和Delayed-Job 3,它在招聘/解雇方面工作得很好,但工作执行的性能很糟糕。在本地启动后台作业并在 UI 中查看结果大约需要 5-8 秒,在 Heroku 上大约需要 25-30 秒(!)。

作业的处理时间与本地/部署的时间大致相同,但雇用工人(扩展、扩大、启动......)似乎需要很多时间(?)。

这是一个常见问题吗?有解决方案吗(rake 任务等)?

多谢。 最好的,菲尔

I use hirefire-gem with Delayed-Job 3 on heroku cedar-stack and it is working pretty good in terms of hiring/firing but performance of the job execution is terrible. firing up the background job and seeing the results in the UI takes about 5-8 seconds locally and about 25-30 seconds (!) on heroku.

Processing time of the jobs is about the same locally/deployed but hiring workers (scaling, up, starting, ...) seems to take a lot of time(?).

is that a common issue? is there a solution (rake tasks, etc.)?

Thanks a lot.
Best, Phil

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

彡翼 2025-01-15 10:15:26

这是因为您的工作人员并不是一直在运行,而是为每项单独的工作而旋转。滞后是代码启动时间。

如果您有全职测功机,则作业几乎应该立即处理。

It's down to the fact that your worker isn't running all the time but spinning up for each individual job. The lag is the code start-up time.

If you have a full time dyno the jobs should process almost instantaneously.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文