solid_queue icon indicating copy to clipboard operation
solid_queue copied to clipboard

Re-institute async mode

Open joshleblanc opened this issue 2 months ago • 5 comments

This is less of a "this is ready to be merged", and more of an effort to reinvigorate conversation around this feature. I cobbled this together as a proof of concept because I simply couldn't use the multi-process approach on the server I'm trying to deploy to. This is related to #343, and tries to naively reimplement this

I originally stumbled on this feature because I was testing Kamal on a 1GB VPS. The initial deploy would work, however there wasn't enough resource headroom for the second deploy. I narrowed this down to SQ using ~100MB per process, essentially taking up half the available memory on the system.

image

After implementing this change, I saw the application memory drop from ~700MB to ~270MB.

image

The usage is simply placing this in puma.rb

if ENV["SOLID_QUEUE_IN_PUMA"]
  plugin :solid_queue
  solid_queue_mode :async
end

I currently have this deployed to a 1GB droplet - the application is running quickly, background jobs are running, and redeploys are succeeding

joshleblanc avatar Sep 28 '25 20:09 joshleblanc

@joshleblanc thanks for this amazing job! I installed the fork in an app hosted on Heroku that servers webhooks from a live application. I've run it as a separate process though (as a worker). My Procfile:

web: bin/rails server -p $PORT -e $RAILS_ENV
worker: bin/jobs --mode=async

So far it looks very good:

image

I used to run the worker before without recurring jobs because it would consume all RAM. Now, even with recurring jobs it takes ~2x less RAM! Thanks for sharing this work!

ka8725 avatar Oct 11 '25 15:10 ka8725

I'd like to help get this finished up, so that non-forking implementations like JRuby can use Solid Queue. Is it complete enough that I could try to run on JRuby now and see what's missing? Do you have an example I could try?

headius avatar Nov 05 '25 21:11 headius

See #679 for my recent request to have a non-forking implementation.

headius avatar Nov 05 '25 21:11 headius

Just give me a bit.more time on the JEP-380 socket PR. I can talk to Cruby, C, or any other language using jruby as the layer via Linux Sockets.

Separation of concerns. Let both interpreters run as independent processes and communicate via unix sockets and message pack.

I should having it ready by this evening/tomorrow morning.

CufeHaco avatar Nov 05 '25 21:11 CufeHaco

https://github.com/CufeHaco/solid-queue-jruby https://github.com/CufeHaco/solid-queue-jruby/blob/main/BENCHMARKS.md

20251110_051426.jpg

20251110_051429.jpg

20251110_051431.jpg

Screenshot_20251110_051532_GitHub.jpg

Screenshot_20251110_051550_GitHub.jpg

CufeHaco avatar Nov 10 '25 10:11 CufeHaco