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

feat: add redis and redis-cluster in limit-req #10874

Merged

Conversation

theweakgod
Copy link
Contributor

@theweakgod theweakgod commented Jan 29, 2024

Description

Fixes #10501 (#10501)
Add options for redis and redis-cluster in the limit-req plugin, and use redis as the counter.

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

@theweakgod theweakgod changed the title Feat/add redis in limit req feat:add redis in limit req Jan 29, 2024
@theweakgod theweakgod changed the title feat:add redis in limit req feat: add redis and redis-cluster in limit-req Jan 29, 2024
@shreemaan-abhishek
Copy link
Contributor

I would suggest working on this only after redis support for limit-conn is merged.

@theweakgod
Copy link
Contributor Author

I would suggest working on this only after redis support for limit-conn is merged.

Yeah, I think so.

@shreemaan-abhishek shreemaan-abhishek marked this pull request as draft January 31, 2024 04:59
@shreemaan-abhishek
Copy link
Contributor

@theweakgod we may start working on this now. Please make changes carefully and diligently considering the code review we did for limit-conn. Your cooperation is highly appreciated <3

@theweakgod
Copy link
Contributor Author

@theweakgod we may start working on this now. Please make changes carefully and diligently considering the code review we did for limit-conn. Your cooperation is highly appreciated <3

ok

@theweakgod theweakgod marked this pull request as ready for review February 8, 2024 06:13
@theweakgod
Copy link
Contributor Author

@shreemaan-abhishek @monkeyDluffy6017 I'm ready for the review.

elseif conf.policy == "redis" then

core.log.info("create new limit-req redis plugin instance")

Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

| allow_degradation | boolean | False | false | | When set to `true` enables Plugin degradation when the Plugin is temporarily unavailable and allows requests to continue. |
| Name | Type | Required | Default | Valid values | Description |
|--------------------------|---------| -------- |-------------|-----------------------------------| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| conn | integer | True | | conn > 0 | Maximum number of concurrent requests allowed. Requests exceeding this ratio (and below `conn` + `burst`) will be delayed (configured by `default_conn_delay`). |
Copy link
Contributor

Choose a reason for hiding this comment

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

conn?

| Name | Type | Required | Default | Valid values | Description |
|--------------------------|---------| -------- |-------------|-----------------------------------| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| conn | integer | True | | conn > 0 | Maximum number of concurrent requests allowed. Requests exceeding this ratio (and below `conn` + `burst`) will be delayed (configured by `default_conn_delay`). |
| burst | integer | True | | burst >= 0 | Number of additional concurrent requests allowed to be delayed per second. If the number exceeds this hard limit, they will get rejected immediately. |
Copy link
Contributor

Choose a reason for hiding this comment

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

please check the docs, it has unrelated changes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@shreemaan-abhishek shreemaan-abhishek merged commit 1439b13 into apache:master Feb 22, 2024
45 of 47 checks passed
shreemaan-abhishek added a commit that referenced this pull request Feb 23, 2024
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.

feat: centralized counter for limit conn and limit req
3 participants