Advanced
With Puma in cluster mode
If you must use Puma in cluster mode in development, the configuration is a bit more complex.
It's recommended to use the debugbar with an application server running into a single process (Puma single mode).
If for some reason, you're stuck with using cluster mode in dev, this feature is for you. I guess one good reason to run in cluster mode in dev is to be as close as possible as production.
By default, all requests made are stored in memory. Once you have multiple processes, each processes hold their own list of requests and isolated memories.
We need to store requests somewhere shared. The debugbar relies on Rails.cache
to share the list. Keep in mind that if you're using the memory store,
you'll run into the same issue! Feel free to use any persistent cache store like Redis, Memcache, SolidCable or simply the file store.
1# config/environments/development.rb2Rails.application.configure do3 # ...4 config.cache_store = :file_store, Rails.root.join("tmp/cache") 5end
The same way, ActionCable runs with async driver by default which holds the connections in memory. So once your debugbar is connected to one node, you'll only see all the requests but the push is only triggered once you hit this node. You can use the Redis or SolidCable adapter to share the connections between all the nodes. I'd typically use the same configuration in development and production.
1# config/cable.yml2development:3 adapter: solid_cable4 connects_to:5 database:6 writing: cable7 polling_interval: 0.1.seconds8 message_retention: 10.minutes
If the debugbar detects that Puma runs in cluster mode, it will check the rest of the config and display a warning in the logs.