Skip to content
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

perf: reduce GC pressure by avoiding EJSON.clone #14

Merged
merged 9 commits into from
Nov 26, 2024

Conversation

alisnic
Copy link

@alisnic alisnic commented Sep 20, 2024

After some loading testing efforts in our production app, we spotted in our memory profiles that EJSON.clone was one of the biggest sources of heap allocations. We started experimenting with removing some of them and see whether something breaks.

The change I submitted was tested on a e2e suite with 800+ tests and 3000+ unit tests and we didn't spot any issues so far.

I cannot say I fully understand the implications of these changes, but from what I've seen LocalCollection from meteor core does a bunch of clones on modifications anyway, so redis-oplog does not need to clone stuff when issuing callbacks.

@alisnic alisnic changed the title perf: Reduce GC pressure by avoiding EJSON.clone perf: reduce GC pressure by avoiding EJSON.clone Sep 20, 2024
@alisnic
Copy link
Author

alisnic commented Sep 26, 2024

cc @StorytellerCZ

@StorytellerCZ
Copy link
Member

LGTM, but we need to get the tests going first. 😞

@alisnic
Copy link
Author

alisnic commented Sep 27, 2024

@StorytellerCZ they fail because redis oplog source has class static functions which are not supported by bundlers in old Meteor versions I assume. will try to remove 1.x from test matrix and see how 2.x tests run

can you approve workflow or maybe somehow make it so I can test changes to CI without waiting for workflow approval?

@alisnic
Copy link
Author

alisnic commented Oct 14, 2024

@StorytellerCZ I fixed the CI. Problem was that we need to use chai version 4.x, newer versions have dependencies with static class syntax.

@alisnic
Copy link
Author

alisnic commented Oct 21, 2024

ping @StorytellerCZ

@StorytellerCZ
Copy link
Member

Let's see if we can run the tests on the branch.

@StorytellerCZ StorytellerCZ merged commit f77fe3e into Meteor-Community-Packages:master Nov 26, 2024
16 checks passed
@StorytellerCZ
Copy link
Member

Will merge upstream and release shortly.

@alisnic alisnic deleted the perf-fixes branch December 5, 2024 12:18
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.

2 participants