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

Support configuring MaxConcurrentStreams for http2 #14169

Merged
merged 6 commits into from
Jul 12, 2022

Conversation

ahrtr
Copy link
Member

@ahrtr ahrtr commented Jun 27, 2022

Continue to work on 14081 .

Related issues:

Benchmark test result:

Note I only created some concurrent streams, and there is no any traffic. The test were performed on a Linux VM with 8GiB memory and 4 CPUs (Intel(R) Xeon(R) CPU E5-2680 v4 @ 2.40GHz).

It seems the memory used by concurrent streams isn't very high, it's about 90MB for 1000 concurrent streams, and 108MB for 2000 concurrent streams.

0 stream

# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 1.7567744e+07
# HELP process_virtual_memory_bytes Virtual memory size in bytes.
# TYPE process_virtual_memory_bytes gauge
process_virtual_memory_bytes 1.1481223168e+10
# HELP process_virtual_memory_max_bytes Maximum amount of virtual memory available in bytes.
# TYPE process_virtual_memory_max_bytes gauge
process_virtual_memory_max_bytes 1.8446744073709552e+19

# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
# TYPE process_cpu_seconds_total counter
process_cpu_seconds_total 0.44

0_stream.txt

3 streams

# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 1.994752e+07
# HELP process_virtual_memory_bytes Virtual memory size in bytes.
# TYPE process_virtual_memory_bytes gauge
process_virtual_memory_bytes 1.1481223168e+10
# HELP process_virtual_memory_max_bytes Maximum amount of virtual memory available in bytes.
# TYPE process_virtual_memory_max_bytes gauge
process_virtual_memory_max_bytes 1.8446744073709552e+19

# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
# TYPE process_cpu_seconds_total counter
process_cpu_seconds_total 1.55

3_stream.txt

100 streams

# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 2.7332608e+07
# HELP process_virtual_memory_bytes Virtual memory size in bytes.
# TYPE process_virtual_memory_bytes gauge
process_virtual_memory_bytes 1.1481485312e+10
# HELP process_virtual_memory_max_bytes Maximum amount of virtual memory available in bytes.
# TYPE process_virtual_memory_max_bytes gauge
process_virtual_memory_max_bytes 1.8446744073709552e+19

# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
# TYPE process_cpu_seconds_total counter
process_cpu_seconds_total 0.69

100_streams.txt

1000 streams

# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 9.1369472e+07
# HELP process_virtual_memory_bytes Virtual memory size in bytes.
# TYPE process_virtual_memory_bytes gauge
process_virtual_memory_bytes 1.1552464896e+10
# HELP process_virtual_memory_max_bytes Maximum amount of virtual memory available in bytes.
# TYPE process_virtual_memory_max_bytes gauge
process_virtual_memory_max_bytes 1.8446744073709552e+19

# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
# TYPE process_cpu_seconds_total counter
process_cpu_seconds_total 1.68

1000_streams.txt

2000 streams

# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 1.0809344e+08
# HELP process_virtual_memory_bytes Virtual memory size in bytes.
# TYPE process_virtual_memory_bytes gauge
process_virtual_memory_bytes 1.155272704e+10
# HELP process_virtual_memory_max_bytes Maximum amount of virtual memory available in bytes.
# TYPE process_virtual_memory_max_bytes gauge
process_virtual_memory_max_bytes 1.8446744073709552e+19

# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
# TYPE process_cpu_seconds_total counter
process_cpu_seconds_total 1.83

2000_streams.txt

@codecov-commenter
Copy link

codecov-commenter commented Jun 27, 2022

Codecov Report

Merging #14169 (8b6c8b4) into main (248f072) will decrease coverage by 0.18%.
The diff coverage is 77.14%.

@@            Coverage Diff             @@
##             main   #14169      +/-   ##
==========================================
- Coverage   75.40%   75.21%   -0.19%     
==========================================
  Files         455      456       +1     
  Lines       36859    36892      +33     
==========================================
- Hits        27792    27749      -43     
- Misses       7335     7395      +60     
- Partials     1732     1748      +16     
Flag Coverage Δ
all 75.21% <77.14%> (-0.19%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
server/config/config.go 79.76% <ø> (ø)
server/embed/serve.go 60.08% <40.00%> (-0.91%) ⬇️
server/etcdmain/grpc_proxy.go 58.89% <60.00%> (+0.01%) ⬆️
pkg/flags/uint32.go 100.00% <100.00%> (ø)
server/embed/config.go 73.64% <100.00%> (+0.06%) ⬆️
server/embed/etcd.go 75.14% <100.00%> (+0.14%) ⬆️
server/etcdmain/config.go 86.23% <100.00%> (+0.11%) ⬆️
server/etcdserver/api/v3rpc/grpc.go 91.42% <100.00%> (ø)
client/v3/leasing/util.go 88.33% <0.00%> (-10.00%) ⬇️
client/pkg/v3/fileutil/lock_linux.go 72.22% <0.00%> (-8.34%) ⬇️
... and 20 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 248f072...8b6c8b4. Read the comment docs.

@ahrtr
Copy link
Member Author

ahrtr commented Jun 28, 2022

cc @ptabor @serathius @spzala Please take a look.

The fix may also need to be cherry picked to 3.5.

Copy link
Member

@spzala spzala left a comment

Choose a reason for hiding this comment

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

@ahrtr thanks, nice work. I have few nits.

pkg/flags/uint32.go Outdated Show resolved Hide resolved
pkg/flags/uint32.go Show resolved Hide resolved
pkg/flags/uint32.go Show resolved Hide resolved
server/config/config.go Outdated Show resolved Hide resolved
server/embed/etcd.go Show resolved Hide resolved
tests/e2e/v3_curl_maxstream_test.go Outdated Show resolved Hide resolved
tests/e2e/v3_curl_maxstream_test.go Outdated Show resolved Hide resolved
@ahrtr ahrtr force-pushed the http_max_stream_20220628 branch from f672f28 to 3167e05 Compare July 5, 2022 02:17
@ahrtr
Copy link
Member Author

ahrtr commented Jul 5, 2022

@spzala Resolved all your comments, PTAL, thx.

server/embed/config.go Outdated Show resolved Hide resolved
杨金珏 and others added 4 commits July 6, 2022 03:43
There is no update on the original PR (see below) for more then 2
weeks. So Benjamin(@ahrtr) continues to work on the PR. The first
step is to rebase the PR, because there are lots of conflicts with
the main branch.

The change to go.mod and go.sum reverted, because they are not needed.
The e2e test cases are also reverted, because they are not correct.

```
etcd-io#14081
```

Signed-off-by: nic-chen <chenjunxu6@gmail.com>
Signed-off-by: Benjamin Wang <wachao@vmware.com>
The golang buildin package `flag` doesn't support `uint32` data
type, so we need to support it via the `flag.Var`.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
The default max stream is 250 in http2. When there are more then
250 streams, the client side may be blocked until some previous
streams are released. So we need to support configuring a larger
`MaxConcurrentStreams`.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
Signed-off-by: Benjamin Wang <wachao@vmware.com>
@ahrtr ahrtr force-pushed the http_max_stream_20220628 branch from 3167e05 to 063db88 Compare July 6, 2022 08:16
server/etcdmain/help.go Outdated Show resolved Hide resolved
pkg/flags/uint32_test.go Outdated Show resolved Hide resolved
Copy link
Member

@spzala spzala left a comment

Choose a reason for hiding this comment

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

lgtm
Thanks @ahrtr

ahrtr added 2 commits July 7, 2022 04:51
… max value for each client.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
Signed-off-by: Benjamin Wang <wachao@vmware.com>
@ahrtr
Copy link
Member Author

ahrtr commented Jul 6, 2022

lgtm Thanks @ahrtr

Thanks @spzala .

cc @serathius Do you have any other comments on this? I only updated some messages (a vs each) since your last review.

serathius
serathius previously approved these changes Jul 7, 2022
@serathius serathius dismissed their stale review July 7, 2022 08:05

Last question

Copy link
Member

@serathius serathius left a comment

Choose a reason for hiding this comment

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

Talked with @wojtek-t and we concluded this change is ok for main and backport to v3.5

@ahrtr ahrtr merged commit 9c4fe12 into etcd-io:main Jul 12, 2022
@nic-chen
Copy link
Contributor

Thank you all for making this change, it helps a lot for Apache APISIX users!

@tangcong tangcong mentioned this pull request Jul 20, 2022
25 tasks
openshift-cherrypick-robot pushed a commit to openshift-cherrypick-robot/etcd that referenced this pull request Oct 7, 2022
…each client can open at a time

Also refer to etcd-io#14169 (comment)

Signed-off-by: Benjamin Wang <wachao@vmware.com>
tjungblu pushed a commit to tjungblu/etcd that referenced this pull request Jul 26, 2023
…each client can open at a time

Also refer to etcd-io#14169 (comment)

Signed-off-by: Benjamin Wang <wachao@vmware.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

6 participants