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

Experiment with string interning on BlockMeta #3931

Closed
wants to merge 8 commits into from

Conversation

zalegrala
Copy link
Contributor

@zalegrala zalegrala commented Aug 1, 2024

What this PR does:

Here is a bit of experiment to see if we can reduce the size of memory that the poller consumes.

  • New intern package which will intern a string
  • Add UnmarshalJson on BlockMeta and CompactedBlockMeta

Which issue(s) this PR fixes:
Fixes #

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

pkg/intern/intern.go Outdated Show resolved Hide resolved
Copy link
Contributor

@javiermolinar javiermolinar left a comment

Choose a reason for hiding this comment

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

I know we are discussing moving from json to proto but this lib here claims to be more performant https://github.com/json-iterator/go
We already use it in some places

@@ -89,6 +90,28 @@ type CompactedBlockMeta struct {
CompactedTime time.Time `json:"compactedTime"`
}

func (b *CompactedBlockMeta) UnmarshalJSON(data []byte) error {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I experimented with the alias here as well, but the embedding throws it off. I think we keep the custom change without the alias here unless I missed something obvious.

@zalegrala
Copy link
Contributor Author

zalegrala commented Aug 8, 2024

We're not seeing the improvements we want to see here. The extra allocations are making us rethink our approach.

@zalegrala zalegrala marked this pull request as draft August 8, 2024 17:49
@zalegrala zalegrala closed this Aug 14, 2024
@zalegrala zalegrala deleted the blockMetaStringIntern branch August 14, 2024 19:25
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.

3 participants