Skip to content

Introduce async fiber-based worker mode for IO-bound jobs#729

Open
seanharmer wants to merge 6 commits intorails:mainfrom
seanharmer:main
Open

Introduce async fiber-based worker mode for IO-bound jobs#729
seanharmer wants to merge 6 commits intorails:mainfrom
seanharmer:main

Conversation

@seanharmer
Copy link
Copy Markdown

It looks like I worked in this in parallel to #728 by pure chance. I'm pushing this PR purely as a data point for comparison. Feel free to take any pieces you think to be desirable and ignore the rest.

What changed?

  • Workers can now be configured with:
- queues: llm
      threads: 2
      concurrency_model: fiber
      fibers: 50
      polling_interval: 0.1

to specify the number of fibers per thread per worker process.

  • Refactors the Worker class to use an execution backend.
  • Moves existing thread-pool based approach into Pool subclass.
  • Implements a new async fiber-based backend.

Set 'moby' option to false for the Docker-in-Docker feature in the devcontainer configuration as Debian no longer supports it.
Implement validation for worker concurrency settings in the configuration, ensuring that the concurrency model is supported and that fibers are only set when using the fiber model. Update tests to cover new concurrency model behaviors and ensure proper error handling for unsupported configurations until such time
as they get implemented.
This commit introduces the ExecutionBackend class to encapsulate execution logic and capacity management. The Pool class now inherits from Worker::ExecutionBackend. Additionally, tests have been added to ensure the correct behavior of available capacity tracking and the execution backend's functionality.

A new fiber-aware execution backend will be added in a follow-up
commit.
Add support for fiber-based concurrency in the SolidQueue worker by introducing a new FiberPool class. Update the worker and configuration to handle fiber settings, ensuring proper validation and metadata reporting. Modify tests to validate the new functionality and ensure compatibility with existing features.

We make no attempt to find the least busy Runner (thread) within
a FibrePool yet. Work is simply distributed to the next Runner in
sequence.
Implement a test to verify that the FiberPool correctly returns false when in-flight work exceeds the shutdown timeout. This ensures that the pool behaves as expected under concurrent conditions and maintains accurate capacity tracking.

We do not try to cancel in-flight jobs. This is the same approach
as the existing thread-pool based backend. Solid queue already
manages orphaned jobs at the process level.
@seanharmer
Copy link
Copy Markdown
Author

Feel free to ignore and take #728.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant