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

proxy: use buffer pool to copy response #2228

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

AlexanderYastrebov
Copy link
Member

@AlexanderYastrebov AlexanderYastrebov commented Feb 13, 2023

goos: linux
goarch: amd64
pkg: github.com/zalando/skipper/proxy
cpu: Intel(R) Core(TM) i5-8350U CPU @ 1.70GHz
                           │ /tmp/BenchmarkCopyStream.old │    /tmp/BenchmarkCopyStream.new     │
                           │            sec/op            │   sec/op     vs base                │
CopyStream/size_100-8                       2662.5n ± 13%   163.8n ± 3%  -93.85% (p=0.000 n=10)
CopyStream/size_1000-8                      2696.5n ±  6%   163.8n ± 0%  -93.93% (p=0.000 n=10)
CopyStream/size_10000-8                     2842.0n ±  6%   163.8n ± 0%  -94.24% (p=0.000 n=10)
CopyStream/size_100000-8                    2731.0n ±  2%   163.8n ± 0%  -94.00% (p=0.000 n=10)
CopyStream/size_1000000-8                   2760.5n ±  1%   163.9n ± 0%  -94.06% (p=0.000 n=10)
CopyStream/size_10000000-8                  2678.0n ±  3%   163.9n ± 3%  -93.88% (p=0.000 n=10)
geomean                                      2.728µ         163.8n       -94.00%

                           │ /tmp/BenchmarkCopyStream.old │    /tmp/BenchmarkCopyStream.new    │
                           │             B/op             │    B/op     vs base                │
CopyStream/size_100-8                        8208.00 ± 0%   16.00 ± 0%  -99.81% (p=0.000 n=10)
CopyStream/size_1000-8                       8208.00 ± 0%   16.00 ± 0%  -99.81% (p=0.000 n=10)
CopyStream/size_10000-8                      8208.00 ± 0%   16.00 ± 0%  -99.81% (p=0.000 n=10)
CopyStream/size_100000-8                     8208.00 ± 0%   16.00 ± 0%  -99.81% (p=0.000 n=10)
CopyStream/size_1000000-8                    8208.00 ± 0%   16.00 ± 0%  -99.81% (p=0.000 n=10)
CopyStream/size_10000000-8                   8208.00 ± 0%   16.00 ± 0%  -99.81% (p=0.000 n=10)
geomean                                      8.016Ki        16.00       -99.81%

                           │ /tmp/BenchmarkCopyStream.old │    /tmp/BenchmarkCopyStream.new    │
                           │          allocs/op           │ allocs/op   vs base                │
CopyStream/size_100-8                          2.000 ± 0%   1.000 ± 0%  -50.00% (p=0.000 n=10)
CopyStream/size_1000-8                         2.000 ± 0%   1.000 ± 0%  -50.00% (p=0.000 n=10)
CopyStream/size_10000-8                        2.000 ± 0%   1.000 ± 0%  -50.00% (p=0.000 n=10)
CopyStream/size_100000-8                       2.000 ± 0%   1.000 ± 0%  -50.00% (p=0.000 n=10)
CopyStream/size_1000000-8                      2.000 ± 0%   1.000 ± 0%  -50.00% (p=0.000 n=10)
CopyStream/size_10000000-8                     2.000 ± 0%   1.000 ± 0%  -50.00% (p=0.000 n=10)
geomean                                        2.000        1.000       -50.00%

See also golang/go#58452 golang/go#58446

@szuecs
Copy link
Member

szuecs commented Mar 24, 2023

@AlexanderYastrebov what is missing to finish this?

@github-advanced-security
Copy link

You have successfully added a new GoKart configuration .github/workflows/pr.yaml:gokart. As part of the setup process, we have scanned this repository and found 1 existing alert. Please check the repository Security tab to see all alerts.

@AlexanderYastrebov
Copy link
Member Author

AlexanderYastrebov commented Mar 26, 2023

what is missing to finish this?

Similar change in stdlib golang/go#58452 was rolled back due to golang/go#58446 which is fixed now and is scheduled for 1.21. I was not sure if we should proceed or maybe wait until 1.21. Feature-wise it is complete.

@szuecs
Copy link
Member

szuecs commented Mar 26, 2023

Ok then let's wait for 1.21

@RomanZavodskikh
Copy link
Member

👍

@AlexanderYastrebov AlexanderYastrebov added major moderate risk, for example new API, small filter changes that have no risk like refactoring or logs and removed do-not-merge labels Jan 10, 2024
Signed-off-by: Alexander Yastrebov <alexander.yastrebov@zalando.de>
```
goos: linux
goarch: amd64
pkg: github.com/zalando/skipper/proxy
cpu: Intel(R) Core(TM) i5-8350U CPU @ 1.70GHz
                           │ /tmp/BenchmarkCopyStream.old │    /tmp/BenchmarkCopyStream.new     │
                           │            sec/op            │   sec/op     vs base                │
CopyStream/size_100-8                       2662.5n ± 13%   163.8n ± 3%  -93.85% (p=0.000 n=10)
CopyStream/size_1000-8                      2696.5n ±  6%   163.8n ± 0%  -93.93% (p=0.000 n=10)
CopyStream/size_10000-8                     2842.0n ±  6%   163.8n ± 0%  -94.24% (p=0.000 n=10)
CopyStream/size_100000-8                    2731.0n ±  2%   163.8n ± 0%  -94.00% (p=0.000 n=10)
CopyStream/size_1000000-8                   2760.5n ±  1%   163.9n ± 0%  -94.06% (p=0.000 n=10)
CopyStream/size_10000000-8                  2678.0n ±  3%   163.9n ± 3%  -93.88% (p=0.000 n=10)
geomean                                      2.728µ         163.8n       -94.00%

                           │ /tmp/BenchmarkCopyStream.old │    /tmp/BenchmarkCopyStream.new    │
                           │             B/op             │    B/op     vs base                │
CopyStream/size_100-8                        8208.00 ± 0%   16.00 ± 0%  -99.81% (p=0.000 n=10)
CopyStream/size_1000-8                       8208.00 ± 0%   16.00 ± 0%  -99.81% (p=0.000 n=10)
CopyStream/size_10000-8                      8208.00 ± 0%   16.00 ± 0%  -99.81% (p=0.000 n=10)
CopyStream/size_100000-8                     8208.00 ± 0%   16.00 ± 0%  -99.81% (p=0.000 n=10)
CopyStream/size_1000000-8                    8208.00 ± 0%   16.00 ± 0%  -99.81% (p=0.000 n=10)
CopyStream/size_10000000-8                   8208.00 ± 0%   16.00 ± 0%  -99.81% (p=0.000 n=10)
geomean                                      8.016Ki        16.00       -99.81%

                           │ /tmp/BenchmarkCopyStream.old │    /tmp/BenchmarkCopyStream.new    │
                           │          allocs/op           │ allocs/op   vs base                │
CopyStream/size_100-8                          2.000 ± 0%   1.000 ± 0%  -50.00% (p=0.000 n=10)
CopyStream/size_1000-8                         2.000 ± 0%   1.000 ± 0%  -50.00% (p=0.000 n=10)
CopyStream/size_10000-8                        2.000 ± 0%   1.000 ± 0%  -50.00% (p=0.000 n=10)
CopyStream/size_100000-8                       2.000 ± 0%   1.000 ± 0%  -50.00% (p=0.000 n=10)
CopyStream/size_1000000-8                      2.000 ± 0%   1.000 ± 0%  -50.00% (p=0.000 n=10)
CopyStream/size_10000000-8                     2.000 ± 0%   1.000 ± 0%  -50.00% (p=0.000 n=10)
geomean                                        2.000        1.000       -50.00%
```

Signed-off-by: Alexander Yastrebov <alexander.yastrebov@zalando.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
major moderate risk, for example new API, small filter changes that have no risk like refactoring or logs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants