Partition DynamicConsumerSupervisor to improve startup and shutdown times #3183
+40
−15
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.
This adds a supervisor layer where a
PartitionSupervisor
now carries theDynamicConsumerSupervisor.name(stack_id)
name and it starts a number ofDynamicConsumerSupervisor
processes to shard load between them. This change is transparent for the rest of the code that usesDynamicConsumerSupervisor
's public API.I've done some measurements by repeatedly starting Electric, waiting for it to start all consumer processes, then terminating it with the
SIGTERM
signal. I have done 5 attempts for the current implementation inmain
and for this PR, measure both the startup and shutdown time.The 1st attempt can be considered an outlier since timings have become consistent afterwards.
When a PartitionSupervisor is used, all processes shut down within 2-3 seconds and the rest of the shutdown time is dominated by the shape status table backup.