-
Notifications
You must be signed in to change notification settings - Fork 122
fix(datastore): Use a UnicastSubject instead of a ReplaySubject #2353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Address OOM problems related to unbounded, ever growing queues for subscription messages on long running apps
Looks like a nice fix |
Histrionic fun context that might be another bug. When this memory leak due to inbound mutation/create/delete models persisting together bit me, i tried to work around it and only one of two attempts were successful. First I tried tried to use the decorators to say no/disable subscribe however the result was the datastore online init would fail. The failure to init with subscription disabled is (or was) a bug as there is code indicating the state should be okay because outbound mutations and sync would still work. So that didn't work. My second trick was to override the subscription vtls to just reply unauthorized which the datastore accepted. So yay for this fix, no more hacks to prevent the leak. Ps, I also made sync always reply unauthorized because the app is literally push/append only operations. Making sync say unauthorized was fastest startup with many data models (16+). |
stating here that this only fixes half of what #2217 proposed, the SubscriptionProcessor problem. This doesn't close out the need to have predictable memory management in MutationOutbox. |
Nice work @manueliglesias |
Issue #, if available:
Closes: #2217
Description of changes:
Use a
UnicastSubject
instead of aReplaySubject
.Address OOM problems related to unbounded, ever growing queues for subscription messages on long running apps
How did you test these changes?
Hammered an API with mutations for a sustained period of 30 minutes and benchmarked on an emulator, look at how nice memory usage looks with the change.
After: (Using
UnicastSubject
)Documentation update required?
General Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.