Skip to content

Handle cluster mode for Puma#45

Merged
julienbourdeau merged 5 commits into
masterfrom
feat/cluster-mode
Dec 29, 2024
Merged

Handle cluster mode for Puma#45
julienbourdeau merged 5 commits into
masterfrom
feat/cluster-mode

Conversation

@julienbourdeau
Copy link
Copy Markdown
Owner

@julienbourdeau julienbourdeau commented Dec 29, 2024

It's recommended to use the debugbar with puma (or similar) running into a single process (single mode). If for some reason, you're stuck with using cluster mode in dev, this feature is for you. I think one good reason is to have a dev env as close as production as possible.

By default, all requests are stored in memory. Once you have multiple processes, each processes hold their list of request and isolated memories. This PR introduce a new way to store requests using Rails.cache so each process are accessing the same list.

The same way, ActionCable runs with async driver by default which holds the connections in memory. It's also incompatible with cluster mode, the cable.yml needs to be edited to use Redis, memcache or SolidCable.
I'd typically use the same configuration in development and production.

I'm displaying an error message because when I started working on the debugbar, I was using cluster mode locally and couldn't figure out why some requests "got lost". I probably wasted freaking hours on this!

CleanShot 2024-12-29 at 11 47 30@2x

@julienbourdeau julienbourdeau self-assigned this Dec 29, 2024
@julienbourdeau julienbourdeau marked this pull request as ready for review December 29, 2024 11:36
@julienbourdeau julienbourdeau merged commit 8c51ac1 into master Dec 29, 2024
@julienbourdeau julienbourdeau deleted the feat/cluster-mode branch December 29, 2024 17:43
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