Skip to content

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

Merged
shreemaan-abhishek merged 26 commits into
apache:masterfrom
theweakgod:feat/add_redis_in_limit_req
Feb 22, 2024
Merged

feat: add redis and redis-cluster in limit-req#10874
shreemaan-abhishek merged 26 commits into
apache:masterfrom
theweakgod:feat/add_redis_in_limit_req

Conversation

@theweakgod

@theweakgod theweakgod commented Jan 29, 2024

Copy link
Copy Markdown
Contributor

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 force-pushed the feat/add_redis_in_limit_req branch from 620c52d to a56f254 Compare January 29, 2024 07:01
@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
Copy Markdown
Contributor

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

@theweakgod

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

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

Comment thread apisix/plugins/limit-req.lua
Comment thread apisix/plugins/limit-req.lua Outdated
elseif conf.policy == "redis" then

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ditto

Comment thread apisix/plugins/limit-req/limit-req-redis-cluster.lua
Comment thread apisix/plugins/limit-req/limit-req-redis.lua
Comment thread docs/en/latest/plugins/limit-req.md Outdated
| 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
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

conn?

Comment thread docs/en/latest/plugins/limit-req.md Outdated
| 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
Copy Markdown
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
Copy Markdown
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
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