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

Set the minimum buffer size in Group::write() to be equal to the page size #7492

Merged
merged 1 commit into from
Mar 18, 2024

Conversation

tgoyne
Copy link
Member

@tgoyne tgoyne commented Mar 18, 2024

For encrypted files we always write data in page sized increments, so using a buffer smaller than the page size results in writing the same page multiple times. On arm64 Apple platforms, this was a problem for files between 16 KB and 4 MB.

… size

For encrypted files we always write data in page sized increments, so using a
buffer smaller than the page size results in writing the same page multiple
times. On arm64 Apple platforms, this was a problem for files between 16 KB and
4 MB.
@tgoyne tgoyne self-assigned this Mar 18, 2024
@cla-bot cla-bot bot added the cla: yes label Mar 18, 2024
@tgoyne tgoyne added the no-jira-ticket Skip checking the PR title for Jira reference label Mar 18, 2024
Copy link

Pull Request Test Coverage Report for Build thomas.goyne_238

Details

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • 76 unchanged lines in 13 files lost coverage.
  • Overall coverage increased (+0.002%) to 91.808%

Files with Coverage Reduction New Missed Lines %
src/realm/sync/network/network.cpp 1 89.86%
src/realm/array_blobs_big.cpp 2 98.72%
src/realm/array_string.cpp 2 85.25%
src/realm/collection_parent.cpp 2 92.48%
src/realm/object-store/shared_realm.cpp 2 93.05%
src/realm/util/file.cpp 3 81.02%
src/realm/util/serializer.cpp 3 90.03%
src/realm/sync/noinst/client_impl_base.cpp 4 85.64%
src/realm/sync/transform.cpp 4 64.61%
src/realm/util/assert.hpp 4 87.1%
Totals Coverage Status
Change from base Build 2137: 0.002%
Covered Lines: 242852
Relevant Lines: 264523

💛 - Coveralls

@tgoyne tgoyne requested a review from ironage March 18, 2024 18:18
Copy link
Contributor

@ironage ironage left a comment

Choose a reason for hiding this comment

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

I don't think we have tried to optimized Realm.write() for a long time and we are a bit blind here, but using the page size makes sense. Was it something that you observed yourself during manual profiling?
The change itself seems fine to me.

@tgoyne
Copy link
Member Author

tgoyne commented Mar 18, 2024

I was poking at the encryption code a bit to see how easy it'd be to remove the file id stuff. File::write() does some silly things so I checked if it was actually being used anywhere that it'd matter, and in the process noticed Group::write() was indirectly calling it with non-page-aligned sizes.

@tgoyne tgoyne merged commit cfbcb50 into master Mar 18, 2024
40 of 45 checks passed
@tgoyne tgoyne deleted the tg/write-buffer branch March 18, 2024 23:21
nirinchev added a commit that referenced this pull request Mar 22, 2024
* master:
  update release note
  prepare v14.4.0
  sets not allowed at storage level inside mixed (#7502)
  🔄 Synced file(s) with realm/ci-actions (#7481)
  RCORE-1982 Opening realm with cached user while offline results in fatal error and session does not retry connection (#7469)
  RCORE-2008 Bump baas version (#7499)
  RCORE-2027: Setting log callback should not override existing log level hierarchy (#7494)
  Derive correct ubuntu version on linuxmint (#7471)
  Include nested path in 'OutOfBounds' error message (#7489)
  fix depth for nested collections set to 4 in debug mode (#7486)
  Set the minimum buffer size in Group::write() to be equal to the page size (#7492)
  Update the parent's content version when bumping it in a nested collection (#7470)
  release notes
  core v14.3.0 (#7482)
  RCORE-2007 Added Resumption delay configuration to SyncClientTimeouts (#7441)
  Improve performance of aggregate operations on empty dictionaries (#7418)
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes no-jira-ticket Skip checking the PR title for Jira reference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants