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 additional option to control the default_conn_delay option of the limit-conn plugin #4604

Merged
merged 22 commits into from
Jul 22, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
344701b
修复多个request-id产生的bug
zuiyangqingzhou Jun 24, 2021
18e2ded
Merge branch 'fix-request-id'
zuiyangqingzhou Jun 24, 2021
fe7df38
Merge branch 'apache:master' into master
zuiyangqingzhou Jun 27, 2021
ffe870e
1、request-id add prefix
zuiyangqingzhou Jun 27, 2021
9e02e21
Merge branch 'fix-request-id'
zuiyangqingzhou Jun 27, 2021
6f1efed
remove unnecessary logic
zuiyangqingzhou Jun 28, 2021
cdb3798
Merge branch 'fix-request-id'
zuiyangqingzhou Jun 28, 2021
2489318
fix the linter
zuiyangqingzhou Jun 30, 2021
83ef3f3
Merge branch 'apache:master' into master
zuiyangqingzhou Jun 30, 2021
08fef26
Merge branch 'fix-request-id'
zuiyangqingzhou Jun 30, 2021
c48ac1b
Merge branch 'apache:master' into master
zuiyangqingzhou Jul 4, 2021
e6ea846
Merge branch 'apache:master' into master
zuiyangqingzhou Jul 11, 2021
4a58f9c
Merge branch 'apache:master' into master
zuiyangqingzhou Jul 14, 2021
753a956
add additional option to control the default_conn_delay parameter
zuiyangqingzhou Jul 14, 2021
abfa56c
adjustment format
zuiyangqingzhou Jul 14, 2021
c54d2bc
adjustment format
zuiyangqingzhou Jul 14, 2021
3d3f9d5
Merge branch 'apache:master' into master
zuiyangqingzhou Jul 18, 2021
ba19219
Merge branch 'master' into optimize_conn_delay
zuiyangqingzhou Jul 18, 2021
0ee8e03
add test cases
zuiyangqingzhou Jul 18, 2021
00d716c
fix code style error
zuiyangqingzhou Jul 18, 2021
47dc329
fix code style error
zuiyangqingzhou Jul 19, 2021
bdedb6c
fix log phase conf param error
zuiyangqingzhou Jul 22, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/en/latest/plugins/limit-conn.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Limiting request concurrency plugin.
| conn | integer | required | | conn > 0 | the maximum number of concurrent requests allowed. Requests exceeding this ratio (and below `conn` + `burst`) will get delayed(the latency seconds is configured by `default_conn_delay`) to conform to this threshold. |
| burst | integer | required | | burst >= 0 | the number of excessive concurrent requests (or connections) allowed to be delayed. |
| default_conn_delay | number | required | | default_conn_delay > 0 | the latency seconds of request when concurrent requests exceeding `conn` but below (`conn` + `burst`). |
| delay_strict_mode | boolean | optional | false | [true,false] | enable the strict mode of the latency seconds. If you set this option to `true`, it will run strictly according to the latency seconds you set without additional calculation logic. |
| delay_strict_mode | boolean | optional | false | [true,false] | enable the strict mode of the latency seconds. If you set this option to `true`, it will run strictly according to the latency seconds you set without additional calculation logic. |
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the option name is not so straightforward but I didn't come out with a more proper one :(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

😂

Copy link
Member

Choose a reason for hiding this comment

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

What about only_use_default_delay?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

only_use_default_delay, use_default_conn_delay, apply_default_conn_delay, stint_default_conn_delay, Which of the four do you think is better, or do you have better suggestions?

Copy link
Member

Choose a reason for hiding this comment

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

I vote for the first one. What about others' opinions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tokers what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

Vote for the first one too, it's easy to understand.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I will change it to this one.
What about the test case I mentioned above? Any suggestions? @spacewander @tokers

Copy link
Member

Choose a reason for hiding this comment

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

You can take a look at the test in #4585

| key | object | required | | ["remote_addr", "server_addr", "http_x_real_ip", "http_x_forwarded_for", "consumer_name"] | to limit the concurrency level. <br />For example, one can use the host name (or server zone) as the key so that we limit concurrency per host name. Otherwise, we can also use the client address as the key so that we can avoid a single client from flooding our service with too many parallel connections or requests. <br /> Now accept those as key: "remote_addr"(client's IP), "server_addr"(server's IP), "X-Forwarded-For/X-Real-IP" in request header, "consumer_name"(consumer's username). |
| rejected_code | string | optional | 503 | [200,...,599] | returned when the request exceeds `conn` + `burst` will be rejected. |

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/latest/plugins/limit-conn.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ title: limit-conn
| conn | integer | required | | conn > 0 | 允许的最大并发请求数。超过 `conn` 的限制、但是低于 `conn` + `burst` 的请求,将被延迟处理。 |
| burst | integer | required | | burst >= 0 | 允许被延迟处理的并发请求数。 |
| default_conn_delay | number | required | | default_conn_delay > 0 | 默认的典型连接(或请求)的处理延迟时间。 |
| delay_strict_mode | boolean | optional | false | [true,false] | 延迟时间的严格模式. 如果设置为`true`的话,将会严格按照设置的时间来进行延迟
| delay_strict_mode | boolean | optional | false | [true,false] | 延迟时间的严格模式. 如果设置为`true`的话,将会严格按照设置的时间来进行延迟 |
| key | object | required | | ["remote_addr", "server_addr", "http_x_real_ip", "http_x_forwarded_for", "consumer_name"] | 用户指定的限制并发级别的关键字,可以是客户端 IP 或服务端 IP。<br />例如,可以使用主机名(或服务器区域)作为关键字,以便限制每个主机名的并发性。 否则,我们也可以使用客户端地址作为关键字,这样我们就可以避免单个客户端用太多的并行连接或请求淹没我们的服务。 <br />当前接受的 key 有:"remote_addr"(客户端 IP 地址), "server_addr"(服务端 IP 地址), 请求头中的"X-Forwarded-For" 或 "X-Real-IP", "consumer_name"(consumer 的 username)。 |
| rejected_code | string | optional | 503 | [200,...,599] | 当请求超过 `conn` + `burst` 这个阈值时,返回的 HTTP 状态码 |

Expand Down