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

RCORE-2007 Added Resumption delay configuration to SyncClientTimeouts #7441

Merged
merged 9 commits into from
Mar 15, 2024

Conversation

michael-wb
Copy link
Contributor

@michael-wb michael-wb commented Mar 11, 2024

What, How & Why?

Added values to the SyncClientTimeouts for configuring the SyncSession resumption delay. This work was pulled from the recommendations posted for PR #7365 and separated out into its own pull request since that design is being reworked.

☑️ ToDos

  • 📝 Changelog update
  • 🚦 Tests (or not relevant)
  • C-API, if public C++ API changed
  • bindgen/spec.yml, if public C++ API changed

@michael-wb michael-wb self-assigned this Mar 11, 2024
@cla-bot cla-bot bot added the cla: yes label Mar 11, 2024
@michael-wb michael-wb changed the title Added Resumption delay configuration to SyncClientTimeouts RCORE-2007 Added Resumption delay configuration to SyncClientTimeouts Mar 11, 2024
Copy link

coveralls-official bot commented Mar 11, 2024

Pull Request Test Coverage Report for Build michael.wilkersonbarker_985

Details

  • 66 of 68 (97.06%) changed or added relevant lines in 4 files are covered.
  • 735 unchanged lines in 40 files lost coverage.
  • Overall coverage decreased (-0.3%) to 91.812%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/realm/object-store/sync/impl/sync_client.hpp 8 10 80.0%
Files with Coverage Reduction New Missed Lines %
src/realm/index_string.hpp 1 93.68%
src/realm/object-store/impl/list_notifier.cpp 1 99.0%
src/realm/table_ref.hpp 1 55.81%
test/object-store/audit.cpp 1 99.93%
test/object-store/object.cpp 1 98.85%
src/realm/array_string.cpp 2 85.25%
src/realm/cluster.cpp 2 77.52%
src/realm/object-store/sync/sync_session.cpp 2 93.65%
src/realm/sync/network/http.hpp 2 82.41%
src/realm/sync/noinst/server/server_history.cpp 2 67.94%
Totals Coverage Status
Change from base Build 2130: -0.3%
Covered Lines: 242868
Relevant Lines: 264527

💛 - Coveralls

@michael-wb michael-wb requested review from jbreams and tgoyne March 11, 2024 17:54
src/realm/sync/noinst/client_impl_base.cpp Outdated Show resolved Hide resolved
src/realm/sync/protocol.hpp Outdated Show resolved Hide resolved
src/realm/object-store/sync/sync_manager.hpp Show resolved Hide resolved
bindgen/spec.yml Outdated Show resolved Hide resolved
bindgen/spec.yml Outdated Show resolved Hide resolved
@@ -74,6 +74,16 @@ struct SyncClient {
c.pong_keepalive_timeout = config.timeouts.pong_keepalive_timeout;
if (config.timeouts.fast_reconnect_limit > 1000)
c.fast_reconnect_limit = config.timeouts.fast_reconnect_limit;
if (config.timeouts.resumption_delay_interval >= 1000)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we want to make the default values the floor rather than just the default? Tbh, I've always been skeptical of trying to force these arbitrary "sensible" ceilings. I'm def for threading this value down to the client but I'd be more in favor of just using whatever the client has passed in.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Even though it's the default value, the floor values are meant to prevent spamming the server too much. I don't think it would be reasonable to have a bunch of clients trying to reconnect every 250ms with a max retry of 2 secs... I chose 1 second and 30 seconds as a reasonable tradeoff of allowing lower values without spamming the server too much.

tbh - I should use the floor values instead of the defaults if the passed in value is lower than the floor.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed most of the checks - SyncClient will now throw an InvalidArgument exception if the multiplier is less than 1 or the divisor is less than 0. Also added an info debug that will print if the resumption delay interval is less than 1 second.

Copy link
Member

Choose a reason for hiding this comment

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

Setting a minimum value was done at the request of the (pre-acquisition) server team. Some of our original users liked to set very stupid values for every single value we let them set and this resulted in a lot of wasted support effort when everything broke due to nonsensical settings.

The current server team wants the reconnect jitter to still exist, so exposing a setting to effectively turn it off seems questionable?

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 agree with requiring at least minimum values to avoid spamming the server too much. Should we make the minimum jitter 2 so it can't be disabled - or we could just force it to always be 4 and ignore the configured value.

On the other hand, perhaps it would be better to not make these values configurable to avoid the risk of breaking sync reconnects?

Copy link
Member

Choose a reason for hiding this comment

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

We'd actually need a maximum value; smaller numbers increase the jitter. I think that field in particular doesn't make much sense to be adjustable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks - updated the delay_jitter_divisor value so it is no longer configurable.

@michael-wb michael-wb requested a review from jbreams March 11, 2024 21:25
@michael-wb michael-wb merged commit be38196 into master Mar 15, 2024
33 of 39 checks passed
@michael-wb michael-wb deleted the mwb/configurable-retry-timers branch March 15, 2024 02:14
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 14, 2024
@michael-wb michael-wb linked an issue May 24, 2024 that may be closed by this pull request
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Resumption delay configuration to SyncClientTimeouts
4 participants