Skip to content

Improving Performance on the API Gzip Handler #5347

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

Merged
merged 4 commits into from
May 15, 2023

Conversation

alanprot
Copy link
Member

@alanprot alanprot commented May 15, 2023

Same as prometheus/prometheus#12363

goos: linux
goarch: amd64
pkg: github.com/cortexproject/cortex/pkg/api
cpu: Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
                                 │   /tmp/old    │              /tmp/new               │
                                 │    sec/op     │    sec/op     vs base               │
_Compression/gzip-10-labels-32      74.58µ ± ∞ ¹   74.52µ ± ∞ ¹        ~ (p=1.000 n=5)
_Compression/gzip-100-labels-32     212.3µ ± ∞ ¹   122.9µ ± ∞ ¹  -42.08% (p=0.008 n=5)
_Compression/gzip-1K-labels-32     1261.6µ ± ∞ ¹   373.1µ ± ∞ ¹  -70.42% (p=0.008 n=5)
_Compression/gzip-10K-labels-32     9.830m ± ∞ ¹   2.117m ± ∞ ¹  -78.46% (p=0.008 n=5)
_Compression/gzip-100K-labels-32   109.47m ± ∞ ¹   19.51m ± ∞ ¹  -82.18% (p=0.008 n=5)
_Compression/gzip-1M-labels-32     1128.8m ± ∞ ¹   204.1m ± ∞ ¹  -81.92% (p=0.008 n=5)
geomean                             5.380m         1.751m        -67.46%
¹ need >= 6 samples for confidence interval at level 0.95

                                 │   /tmp/old    │               /tmp/new                │
                                 │ ContentLength │ ContentLength  vs base                │
_Compression/gzip-10-labels-32       171.0 ± ∞ ¹     171.0 ± ∞ ¹       ~ (p=1.000 n=5) ²
_Compression/gzip-100-labels-32      400.0 ± ∞ ¹     397.0 ± ∞ ¹  -0.75% (p=0.008 n=5)
_Compression/gzip-1K-labels-32      4.135k ± ∞ ¹    4.248k ± ∞ ¹  +2.73% (p=0.008 n=5)
_Compression/gzip-10K-labels-32     47.31k ± ∞ ¹    48.07k ± ∞ ¹  +1.61% (p=0.008 n=5)
_Compression/gzip-100K-labels-32    472.4k ± ∞ ¹    471.9k ± ∞ ¹  -0.11% (p=0.008 n=5)
_Compression/gzip-1M-labels-32      4.863M ± ∞ ¹    4.884M ± ∞ ¹  +0.44% (p=0.008 n=5)
geomean                             17.70k          17.81k        +0.65%
¹ need >= 6 samples for confidence interval at level 0.95
² all samples are equal

                                 │    /tmp/old    │               /tmp/new               │
                                 │      B/op      │     B/op       vs base               │
_Compression/gzip-10-labels-32      8.282Ki ± ∞ ¹   7.739Ki ± ∞ ¹   -6.56% (p=0.008 n=5)
_Compression/gzip-100-labels-32    11.922Ki ± ∞ ¹   9.452Ki ± ∞ ¹  -20.72% (p=0.008 n=5)
_Compression/gzip-1K-labels-32      31.73Ki ± ∞ ¹   10.05Ki ± ∞ ¹  -68.32% (p=0.008 n=5)
_Compression/gzip-10K-labels-32    267.84Ki ± ∞ ¹   26.86Ki ± ∞ ¹  -89.97% (p=0.008 n=5)
_Compression/gzip-100K-labels-32   3142.1Ki ± ∞ ¹   233.6Ki ± ∞ ¹  -92.56% (p=0.008 n=5)
_Compression/gzip-1M-labels-32     54.065Mi ± ∞ ¹   7.047Mi ± ∞ ¹  -86.97% (p=0.008 n=5)
geomean                             229.5Ki         56.72Ki        -75.28%
¹ need >= 6 samples for confidence interval at level 0.95

                                 │   /tmp/old   │              /tmp/new              │
                                 │  allocs/op   │  allocs/op    vs base              │
_Compression/gzip-10-labels-32      137.0 ± ∞ ¹    133.0 ± ∞ ¹  -2.92% (p=0.008 n=5)
_Compression/gzip-100-labels-32     152.0 ± ∞ ¹    145.0 ± ∞ ¹  -4.61% (p=0.008 n=5)
_Compression/gzip-1K-labels-32      188.0 ± ∞ ¹    181.0 ± ∞ ¹  -3.72% (p=0.008 n=5)
_Compression/gzip-10K-labels-32     571.0 ± ∞ ¹    559.0 ± ∞ ¹  -2.10% (p=0.008 n=5)
_Compression/gzip-100K-labels-32   4.351k ± ∞ ¹   4.217k ± ∞ ¹  -3.08% (p=0.008 n=5)
_Compression/gzip-1M-labels-32     43.32k ± ∞ ¹   42.31k ± ∞ ¹  -2.34% (p=0.008 n=5)
geomean                             865.8          838.7        -3.13%
¹ need >= 6 samples for confidence interval at level 0.95

What this PR does:

Which issue(s) this PR fixes:
Fixes #

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

alanprot added 2 commits May 15, 2023 10:20
Signed-off-by: Alan Protasio <[email protected]>
Signed-off-by: Alan Protasio <[email protected]>
Signed-off-by: Alan Protasio <[email protected]>
@alanprot alanprot changed the title Gzip Improving Performance on the API Gzip Handler May 15, 2023
Signed-off-by: Alan Protasio <[email protected]>
@alanprot alanprot marked this pull request as ready for review May 15, 2023 17:31
Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

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

Thanks

@alanprot alanprot enabled auto-merge (squash) May 15, 2023 17:37
@alanprot alanprot merged commit a69e50e into cortexproject:master May 15, 2023
@alanprot alanprot deleted the gzip branch May 15, 2023 17:56
@@ -12,6 +12,7 @@
* [ENHANCEMENT] Compactor: Exposing Thanos accept-malformed-index to Cortex compactor. #5334
* [ENHANCEMENT] Update Go version to 1.20.4. #5299
* [ENHANCEMENT] Log: Avoid expensive log.Valuer evaluation for disallowed levels. #5297
* [ENHANCEMENT] Improving Performance on the API Gzip Handler. #5347
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need the changelog? It should be an internal details and users don't need to know about that.

Copy link
Member Author

Choose a reason for hiding this comment

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

hummm... i think you are right... Should i remove in another PR now?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes you can update it in another pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants