Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Change global behavior #219

Merged
merged 6 commits into from
Feb 21, 2024
Merged

Conversation

thrawn01
Copy link
Contributor

@thrawn01 thrawn01 commented Feb 10, 2024

Purpose

To change how GLOBAL behavior operates. Previously, the owner of the rate limit would broadcast the computed result of the rate limit to other peers, and the computed result from the owner is returned to clients who submit hits to a peer. However, after some great feed back on #218 and #216 It has become clear that we should instead allow the local peers to compute the result of the request based on the hits broadcast by the owning peer.

In the new behavior a peer will compute the result of the rate limit request and immediately return that computed result. This means that the non owning peer will compute the result with the current Remaining value it currently has in it's cache. To put it another way, the peer cache will no longer hold the computed result from the owner.

In order to facilitate this change, I've added many more tests around global functionality which should help ensure we don't break behavior going forward.

Implementation

  • The global broadcaster will now use the new DRAIN_OVER_LIMIT behavior when accepting peer rate limits. This allows many peers to send a burst of hits to the owner while still updating the remaining even if the requested hits is more that is available. See Fix global mode #218 (comment)
  • Added Tests to ensure the "do not update remaining if requesting more than is remaining" semantic does not change.
  • Added cluster.ListNonOwningDaemons() to assist in global testing
  • Added cluster.FindOwningDaemon() to assist in global testing
  • Added waitForBroadcast() to functional testing suite tools so we can remove the sleep statements.
  • Moved newStaticBuilder() to daemon.go
  • Added MustClient() and Client() to gubernator.Daemon to make it easier to find and send RPC requests to a daemon instance.
  • RESET_REMAINING now works correctly with global behavior
  • Fixed an issue where the peer that received the rate limit would broadcast the rate limit to all peers instead of waiting for the owning peer to broadcast.
  • Now correctly populating Daemon.InstanceID and Added InstanceID to the Instance
  • Bumped Lint Version
  • Misc Test fixes and improvements. TestLeakyBucketGregorian should no longer occasionally fail the test suite.

This PR replaces #218 and #216 but keeps the commits from those PR's

Thank you to these wonderful people, for giving great feed back and working on this!

@thrawn01 thrawn01 requested a review from Baliedge as a code owner February 10, 2024 03:10
This was referenced Feb 10, 2024
@thrawn01 thrawn01 force-pushed the change-global-behavior branch 3 times, most recently from d7826ab to 6ad0c64 Compare February 10, 2024 03:58
Copy link
Contributor

@Baliedge Baliedge left a comment

Choose a reason for hiding this comment

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

Needs to fix merge conflict and recommend applying @miparnisari's documentation change.

@thrawn01 thrawn01 force-pushed the change-global-behavior branch from ac5921e to d96b675 Compare February 21, 2024 02:39
@thrawn01
Copy link
Contributor Author

@Baliedge rebased and ready to merge ❤️

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants