Skip to content

Conversation

@sleepyStick
Copy link
Contributor

@sleepyStick sleepyStick commented Oct 23, 2025

PYTHON-5518

Summary

_BACKOFF_INITIAL, _BACKOFF_MAX, and the growth rate have now been experimented with using the previous with_transaction benchmark and values are chosen based on what experimentally did the best.

Changes in this PR

  • added tests for the backoff in with_transaction

  • changed _BACKOFF_INITIAL, _BACKOFF_MAX, and the growth rate

  • graph.py was the file used to analyze the various _BACKOFF_INITIAL, _BACKOFF_MAX, and the growth rate values against each other

  • withTransaction.py was the benchmarking script
    happy to remove them or put them elsewhere but since this is just merging into the backpressure branch, i figured it was fine to keep for now?

Testing Plan

prose test

Screenshots (optional)

Checklist

Checklist for Author

  • Did you update the changelog (if necessary)?
  • Is the intention of the code captured in relevant tests?
  • If there are new TODOs, has a related JIRA ticket been created?

Checklist for Reviewer {@primary_reviewer}

  • Does the title of the PR reference a JIRA Ticket?
  • Do you fully understand the implementation? (Would you be comfortable explaining how this code works to someone else?)
  • Have you checked for spelling & grammar errors?
  • Is all relevant documentation (README or docstring) updated?

Focus Areas for Reviewer (optional)

@sleepyStick sleepyStick marked this pull request as ready for review November 12, 2025 21:45
@sleepyStick sleepyStick requested a review from a team as a code owner November 12, 2025 21:45
@sleepyStick sleepyStick requested review from NoahStapp and removed request for a team November 12, 2025 21:45
@sleepyStick sleepyStick changed the title PYTHON-5562: Investigate default values for withTransaction backoff parameters PYTHON-5581: withTransaction API retries too frequently Nov 12, 2025
@sleepyStick sleepyStick changed the title PYTHON-5581: withTransaction API retries too frequently PYTHON-5518: withTransaction API retries too frequently Nov 12, 2025
@NoahStapp
Copy link
Contributor

@sleepyStick is this ready for review?

@sleepyStick
Copy link
Contributor Author

@sleepyStick is this ready for review?

yes? the spec for these changes are still in review -- if the spec is good/doesn't have any more changes, then this is ready for review?

async def test_transaction_backoff(self):
client = async_client_context.client
coll = client[self.db.name].test
# patch random to make it deterministic
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 need random to be deterministic here? Can you expand this comment with a short motivation?

@@ -0,0 +1,111 @@
from __future__ import annotations
Copy link
Member

Choose a reason for hiding this comment

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

We don't want to add this file do we?

@@ -0,0 +1,82 @@
from __future__ import annotations
Copy link
Member

Choose a reason for hiding this comment

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

We don't want to add this file do we?

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