Skip to content

Non-forking implementation #679

@headius

Description

@headius

Hello! I would like to offer my help making modifications to Solid Queue to support executing in-process using threads rather than out-of-process as a fork.

There's many issues with using fork:

  • Impossible to support on JRuby and TruffleRuby, as well as on Windows
  • Wastes system resources on CRuby by creating additional processes with their own working sets, GCs, and JITs.

The primary reason for using forks here is to get parallelism, which can be achieved easily by using threads on JRuby and TruffleRuby. The logic you have for starting up, managing, and terminating forked processes can be modified to do the same with threads, and no additional processes would be needed.

I have started playing with patches locally that swap calls to fork for calls to Thread.new with appropriate thread management code, and there's not really even that many places that would need to be changed. The bulk of the logic is all signals and waitpid, which map pretty easily to Thread#kill, Thread#raise, and Thread#join (or just let it die quietly).

Could we collaborate on this? I could start hacking on a branch this week.

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