🚀 Add Adaptive Polling Feature to SolidQueue#624
Closed
rafael-pissardo wants to merge 10 commits into
Closed
Conversation
ee1b3f7 to
8641c9e
Compare
8641c9e to
3b6d1cb
Compare
…id_queue into feat/adpative-poller
Member
|
Hey @rafael-pissardo, thanks for this. I'm in favour of this feature but this code is a monkey-patch on top of Solid Queue, so I think it'd fit better as a separate gem 🤔 It seems also to be mostly AI-generated, with a totally different style, different file structure and conventions. I'm definitely not against AI-generated code where it makes sense, but I'm not willing to maintain 2500+ generated lines of code. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves: #625
🚀 SolidQueue Adaptive Polling
Adaptive Polling is a feature that automatically optimizes SolidQueue's memory and CPU consumption by dynamically adjusting worker polling intervals based on current workload.
📊 Benefits
🔧 How It Works
The system continuously monitors:
Based on these metrics, it:
⚙️ Configuration
Basic Setup
In your Rails application that uses the SolidQueue gem, add to
config/application.rborconfig/environments/production.rb:Advanced Configuration
In your Rails application, create a file
config/initializers/solid_queue_adaptive_polling.rb:🌟 Recommended Configurations
Production (Aggressive)
Staging (Balanced)
Development (Conservative)
📈 Monitoring
The system automatically logs information about its operation:
Startup Logs
Operation Logs (Debug)
Worker Statistics
🔬 How to Test
1. Test Environment
2. Simulate Load
3. Simulate Idle
🐛 Troubleshooting
Issue: Polling too slow
Issue: Polling too fast
Issue: Slow adaptation
🔧 Advanced Per-Worker Configuration
For different configurations per worker, use YAML configuration:
📚 Detailed Algorithm
System States
Adaptation Logic
🚨 Considerations
📦 Installation and Setup
Ensure your application is using SolidQueue with the version that includes Adaptive Polling
Create an initializer in your application:
# In your Rails application touch config/initializers/solid_queue_adaptive_polling.rbConfigure based on the example file:
examples_adaptive_polling_config.rbin the gem to see all optionsRestart your application to apply the configurations
Monitor the logs to verify it's working:
For complete example configurations, see the
examples_adaptive_polling_config.rbfile included in the gem.