ruby-shoryuken / shoryuken

A super efficient Amazon SQS thread based message processor for Ruby
Other
2.05k stars 279 forks source link

Thread vs Process | Performance Bottleneck #764

Closed pranjal-wego closed 7 months ago

pranjal-wego commented 7 months ago

We're using the MRI Ruby Interpreter which uses a shared Global Interpreter Lock. Consequently, only one thread truly runs at any given time.

From what I have read through all the issues and in the codebase, my understanding is that all workers and their concurrencies are facilitated using Ruby threads and not processes. Due to this, our setup of 3 groups with one queue each is not able to utilise more than one core of CPU and is creating a performance bottleneck.

Is there any way that multiple group workers can run in their own processes rather than in their own threads, so that multiple cpu cores can be utilised for processing? Can the parent shoryuken process spawn child processes for each group?

phstc commented 7 months ago

Can the parent shoryuken process spawn child processes for each group?

It was not designed to spawn multiple processes. A single Shoryuken process won't spawn up child processes. But you can spin up multiple Shoryuken processes.