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

Oplogtoredis: performance improvements by raw oplog processing #84

Merged
merged 19 commits into from
Oct 2, 2024

Conversation

eparker-tulip
Copy link
Contributor

@eparker-tulip eparker-tulip commented Sep 27, 2024

Oplogtoredis receives the oplog entries, unmarshals the metadata layer for filtering/sharding, then unmarshals the payload and constructs an object that is then marshalled into JSON.

This PR skips the payload unmarshalling, and instead extracts the needed values directly from the bson.Raw object, using the methods provided with https://pkg.go.dev/go.mongodb.org/mongo-driver/bson . This is expected to be much more CPU/memory efficient than the former intermediate step of unmarshalling to a go object.

@eparker-tulip eparker-tulip changed the title Oplogtoredis Oplogtoredis: performance improvements by raw processing and parallelization Sep 27, 2024
@eparker-tulip eparker-tulip changed the title Oplogtoredis: performance improvements by raw processing and parallelization Oplogtoredis: performance improvements by raw oplog processing Sep 27, 2024
Copy link
Contributor

@sannivasreddy sannivasreddy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done. I'm excited to see the performance gains we get with this. I've left a couple of comments.

lib/oplog/tail.go Outdated Show resolved Hide resolved
lib/oplog/oplog_v2_converter.go Show resolved Hide resolved
lib/oplog/oplogEntry.go Outdated Show resolved Hide resolved
lib/oplog/oplogEntry.go Outdated Show resolved Hide resolved
Copy link
Member

@torywheelwright torywheelwright left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good so far as I can tell by eye. testing will be key.

lib/oplog/oplogEntry.go Outdated Show resolved Hide resolved
lib/oplog/oplogEntry.go Outdated Show resolved Hide resolved
lib/oplog/tail.go Show resolved Hide resolved
lib/oplog/oplogEntry.go Outdated Show resolved Hide resolved
@eparker-tulip eparker-tulip merged commit 0646efb into master Oct 2, 2024
8 checks passed
@eparker-tulip eparker-tulip deleted the eparker.performance branch October 2, 2024 20:59
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.

4 participants