Skip to content

Support for async streaming in Solid Queue for AI response handling #596

@darkamenosa

Description

@darkamenosa

Hi folks!

I've been using Solid Queue in my Rails app and loving it so far. However, I've run into an interesting use case that I'd love to
discuss and potentially see supported.

I'm building an application that heavily relies on streaming responses from AI services (think ChatGPT, Claude, etc.). These AI responses can be quite lengthy and come in as continuous streams that need to be processed and forwarded to users in real-time.

Currently, from what I understand reading through the documentation and codebase, Solid Queue's thread-based model might have some limitations when it comes to handling these long-running streaming operations efficiently. The synchronous nature of job processing means that each streaming AI response essentially blocks a worker thread for the entire duration of the stream, which could be several seconds or even minutes for longer responses.

My current workaround involves spinning up multiple separate queue servers to increase concurrency and handle more simultaneous streams, but this feels like throwing hardware at what might be better solved architecturally.

I'm wondering if there are plans (or if it would even make sense) to add async/streaming support to Solid Queue? Something that could handle these long-running streaming operations without blocking worker threads would be amazing. Maybe using Ruby's Fiber scheduler or integrating with async gems?

Would love to hear your thoughts on:

  1. Whether this is something you've considered for Solid Queue's roadmap
  2. If there are better patterns I should be using for this use case
  3. Whether this aligns with Solid Queue's design philosophy

Thanks for all the great work on this gem! 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions