Skip to content

Caplin: Add a request limiter#8868

Merged
Giulio2002 merged 7 commits intodevelfrom
feat/add-limitcheck-to-cl
Dec 1, 2023
Merged

Caplin: Add a request limiter#8868
Giulio2002 merged 7 commits intodevelfrom
feat/add-limitcheck-to-cl

Conversation

@bayram98
Copy link
Contributor

@bayram98 bayram98 commented Nov 30, 2023

This PR is to add the request rate limiter.

The solution is to count the request number for each peer for each minute, if the peer exceeds the limit, block the requests for a specified time.

Current limits:

  • Request limited to 5000 requests per minute for each handler.
  • Penalty blockage time 1-minute

@bayram98 bayram98 self-assigned this Nov 30, 2023
@bayram98 bayram98 linked an issue Nov 30, 2023 that may be closed by this pull request
@bayram98 bayram98 changed the title add cl request limiter Caplin: Add a request limiter Nov 30, 2023
Copy link
Collaborator

@Giulio2002 Giulio2002 left a comment

Choose a reason for hiding this comment

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

Overall LGTM, just few adjustments needed

@elee1766
Copy link
Contributor

I would replace ratelimiter with this

https://pkg.go.dev/golang.org/x/time/rate

@Giulio2002
Copy link
Collaborator

I would replace ratelimiter with this

https://pkg.go.dev/golang.org/x/time/rate

Agree, that would get rid of most of the responsibility on us to mantain.

@bayram98 bayram98 marked this pull request as ready for review December 1, 2023 12:14
@bayram98 bayram98 requested a review from Giulio2002 December 1, 2023 12:14
@Giulio2002 Giulio2002 merged commit e7e1bf4 into devel Dec 1, 2023
@Giulio2002 Giulio2002 deleted the feat/add-limitcheck-to-cl branch December 1, 2023 19:11
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.

Caplin: Add a bandwidth limiter

3 participants