Skip to content

Conversation

alco
Copy link
Member

@alco alco commented Sep 26, 2025

This adds a supervisor layer where a PartitionSupervisor now carries the DynamicConsumerSupervisor.name(stack_id) name and it starts a number of DynamicConsumerSupervisor processes to shard load between them. This change is transparent for the rest of the code that uses DynamicConsumerSupervisor'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 in main and for this PR, measure both the startup and shutdown time.

Attempt 1 Attempt 2 Attempt 3 Attempt 4 Attempt 5
PartitionSupervisor startup 28.8s 12.5s 11.8s 11.0s 11.8s
DynamicSupervisor startup 20.6s 20.0s 20.0s 19.7s 20.5s
Attempt 1 Attempt 2 Attempt 3 Attempt 4
PartitionSupervisor shutdown 4.8s 10.1s 11.0s 11.0s
DynamicSupervisor shutdown 27.0s 27.4s 28.2s 28.6s

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.

Copy link

codecov bot commented Sep 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.85%. Comparing base (71ee26d) to head (f3656d2).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3183      +/-   ##
==========================================
- Coverage   77.00%   76.85%   -0.16%     
==========================================
  Files         175      175              
  Lines        9260     9264       +4     
  Branches      295      296       +1     
==========================================
- Hits         7131     7120      -11     
- Misses       2127     2142      +15     
  Partials        2        2              
Flag Coverage Δ
elixir 75.51% <100.00%> (-0.15%) ⬇️
elixir-client 73.87% <ø> (ø)
packages/experimental 87.73% <ø> (-1.23%) ⬇️
packages/react-hooks 86.48% <ø> (ø)
packages/typescript-client 93.49% <ø> (ø)
packages/y-electric 55.12% <ø> (ø)
postgres-140000 75.59% <100.00%> (-0.11%) ⬇️
postgres-150000 ?
postgres-170000 75.62% <100.00%> (?)
sync-service 75.68% <100.00%> (-0.17%) ⬇️
typescript 85.79% <ø> (-0.17%) ⬇️
unit-tests 76.85% <100.00%> (-0.16%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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