Solid Queue 1.6.0 现已支持 Fiber 工作进程。
Solid Queue 1.6.0 now supports fiber workers

原始链接: https://github.com/rails/solid_queue/releases/tag/v1.6.0

此版本带来了一项备受期待的功能,感谢 @crmne 的贡献:现在不再需要为每个 worker 使用线程池来运行多线程任务,而是可以在单个 fiber reactor 线程上使用 fibers。 要使用此功能,只需在 worker 配置中指定 fibers 的数量而不是线程数,如下所示: ```yaml workers: - queues: "api*" fibers: 100 polling_interval: 0.05 ``` 该功能底层使用 Async,因此需要将其作为依赖项才能正常工作。此外,你需要在 Rails 中使用 fiber 隔离(`config.active_support.isolation_level = :fiber`)。这对于涉及 LLM 调用等 I/O 密集型工作负载非常有用。 **更新内容** * 添加 fiber worker 执行模式,由 @crmne 贡献于 #728 * 回滚测试中因任务线程被终止而泄露的事务,由 @rosa 贡献于 #773 * 记录如何更新动态循环任务,由 @wintan1418 贡献于 #777 **新贡献者** 完整更新日志:v1.5.1...v1.6.0

相关文章

原文

A long-awaited feature thanks to @crmne on this release: instead of using a thread pool to run jobs in multiple threads per works, you can now use fibers on a single fiber reactor thread. To use this, you just need to specify the number of fibers instead of the number of threads in your worker configuration, like this:

workers:
  - queues: "api*"
    fibers: 100
    polling_interval: 0.05

It uses Async under the hood, so you need to have that as a dependency for it to work. Also, you need to be using fiber isolation in Rails (config.active_support.isolation_level`` = :fiber).

This can be very useful for I/O-bound workloads, such as those involving LLM calls.

What's Changed

  • Add fiber worker execution mode by @crmne in #728
  • Roll back transactions leaked by killed job threads in tests by @rosa in #773
  • Document how to update dynamic recurring tasks by @wintan1418 in #777

New Contributors

Full Changelog: v1.5.1...v1.6.0

联系我们 contact @ memedata.com