Improve MongoDB read model repopulation performance via BulkWriteAsync#1137
Improve MongoDB read model repopulation performance via BulkWriteAsync#1137Fariarx wants to merge 1 commit into
Conversation
|
Fariarx seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
|
Remove the need for approvals on builds as legacy v0 builds have been stopped (was using Windows Server). |
|
|
||
| var collection = _mongoDatabase.GetCollection<TReadModel>(readModelDescription.RootCollectionName.Value); | ||
| var filter = Builders<TReadModel>.Filter.In(readModel => readModel.Id, modelIds); | ||
| var results = await collection.Find(filter).ToListAsync(cancellationToken: cancellationToken); |
There was a problem hiding this comment.
| var results = await collection.Find(filter).ToListAsync(cancellationToken: cancellationToken); | |
| var results = await collection.Find(filter).ToListAsync(cancellationToken: cancellationToken).ConfigureAwait(false); |
|
|
||
| if (readModelContext.IsMarkedForDeletion) | ||
| { | ||
| await DeleteAsync(readModelUpdate.ReadModelId, c); |
There was a problem hiding this comment.
| await DeleteAsync(readModelUpdate.ReadModelId, c); | |
| await DeleteAsync(readModelUpdate.ReadModelId, c).ConfigureAwait(false); |
| x.ReadModelEnvelope.ReadModel) { IsUpsert = true }; | ||
|
|
||
| return replaceOneModel; | ||
| }), cancellationToken: c); |
There was a problem hiding this comment.
| }), cancellationToken: c); | |
| }), cancellationToken: c).ConfigureAwait(false); |
|
.review |
|
Findings
Next steps
Your friendly neighborhood AI |
|
@Fariarx let me know if the AI review has value and it seems there's a misalignment of your commit email and your GitHub user. Align those and submit the CLA ❤️ |
|
I'll fix it soon |
|
Hello there! We hope this message finds you well. We wanted to let you know that we have noticed that there has been As a result, we will be closing this pull request within the next seven days. If you still Thank you for your contributions and understanding. Best regards, |
Changes:
Impact:
Significantly accelerates read model repopulation in MongoDB.
Production proven:
This change has been running in production for over a year with excellent stability and 2-4x performance improvement for batches >1000 events during repopulation.