Add ability to use queues to manage parallelism#9
Conversation
One potential problem we have with batch processing is that any one slow item will clog up the whole batch. This pr implements a queueing method instead, where we keep N queues that each have their own workers. There's still a chance of individual items backlogging a queue, but we can try increased concurrency here to reduce the chances of that happening <!-- Describe your PR here. -->
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||
User description
PR #9
PR Type
Enhancement
Description
Implement thread-queue-parallel processing mode using fixed queue pool
Add OffsetTracker for safe offset management across partitions
Create OrderedQueueWorker and FixedQueuePool for concurrent group processing
Add SimpleQueueProcessingStrategy with automatic offset committing
Integrate queue-based consumer into ResultsStrategyFactory
Add comprehensive tests for queue consumer and offset tracking
Diagram Walkthrough
File Walkthrough
__init__.py
Add thread-queue-parallel mode to CLI optionssrc/sentry/consumers/init.py
all modes
queue_consumer.py
Implement queue-based parallel processing infrastructuresrc/sentry/remote_subscriptions/consumers/queue_consumer.py
partition
order
assignment
automatic commits
result_consumer.py
Integrate queue-based strategy into results factorysrc/sentry/remote_subscriptions/consumers/result_consumer.py
ResultsStrategyFactory
test_queue_consumer.py
Add comprehensive tests for queue consumertests/sentry/remote_subscriptions/consumers/test_queue_consumer.py
processing
processing and offset commits
test_results_consumer.py
Add thread-queue-parallel consumer tests and Kafka integrationtests/sentry/uptime/consumers/test_results_consumer.py
within subscriptions
processing
behavior
test