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

[proxy] Fix dynamic rate limiter #7950

Merged
merged 4 commits into from
Jun 4, 2024
Merged

Conversation

khanova
Copy link
Contributor

@khanova khanova commented Jun 3, 2024

Problem

There was a bug in dynamic rate limiter, which exhausted CPU in proxy and proxy wasn't able to accept any connections.

Summary of changes

  1. if self.available > 1 -> if self.available >= 1
  2. remove timeout_at to use just timeout
  3. remove potential infinite loops which can exhaust CPUs.

Checklist before requesting a review

  • I have performed a self-review of my code.
  • If it is a core feature, I have added thorough tests.
  • Do we need to implement analytics? if so did you add the relevant metrics to the dashboard?
  • If this PR requires public announcement, mark it with /release-notes label and add several sentences in this section.

Checklist before merging

  • Do not forget to reformat commit message to not include the above checklist

@khanova khanova requested a review from a team as a code owner June 3, 2024 23:36
Copy link
Member

@sharnoff sharnoff left a comment

Choose a reason for hiding this comment

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

Left some comments - not familiar with the code, feel free to adopt / ignore as needed.

Approving to avoid timezone blockage.

proxy/src/rate_limiter/limit_algorithm.rs Outdated Show resolved Hide resolved
proxy/src/rate_limiter/limit_algorithm.rs Show resolved Hide resolved
proxy/src/rate_limiter/limit_algorithm.rs Outdated Show resolved Hide resolved
proxy/src/rate_limiter/limit_algorithm.rs Show resolved Hide resolved
@khanova khanova enabled auto-merge (squash) June 4, 2024 00:37
Copy link

github-actions bot commented Jun 4, 2024

3174 tests run: 3035 passed, 0 failed, 139 skipped (full report)


Flaky tests (1)

Postgres 16

Code coverage* (full report)

  • functions: 31.4% (6558 of 20860 functions)
  • lines: 48.4% (50803 of 104958 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
e9f699a at 2024-06-04T01:14:29.353Z :recycle:

@khanova khanova merged commit 00032c9 into main Jun 4, 2024
64 checks passed
@khanova khanova deleted the proxy-fix-dynamic-rate-limiter branch June 4, 2024 04:07
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