Skip to content

Conversation

@lhotari
Copy link
Member

@lhotari lhotari commented Apr 17, 2024

Motivation

gzip compression is now enabled by default for the /metrics endpoint. To further optimize /metrics endpoint
performance, this PR adds sharing of the gzip compressed result with the in progress results so that concurrent requests will share the result of a single gzip compression task.
This is a follow up on #22494 and ensures that gzip compression doesn't add extra load when multiple clients are making requests to the /metrics endpoint and requesting gzip encoding.

Modifications

  • refactor solution to asynchronously compress the Netty buffer
  • add helper for compressing a Netty buffer in GZIP format using JVM's default java.util.zip.Deflater class and nio ByteBuffer support that has been added in Java 11.

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

@lhotari lhotari self-assigned this Apr 17, 2024
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Apr 17, 2024
@lhotari
Copy link
Member Author

lhotari commented Apr 17, 2024

Test results with load_test_gzip.js and the test setup described in #22494:

❯ k6 run load_test_gzip.js

          /\      |‾‾| /‾‾/   /‾‾/
     /\  /  \     |  |/  /   /  /
    /  \/    \    |     (   /   ‾‾\
   /          \   |  |\  \ |  (‾)  |
  / __________ \  |__| \__\ \_____/ .io

     execution: local
        script: load_test_gzip.js
        output: -

     scenarios: (100.00%) 1 scenario, 100 max VUs, 10m30s max duration (incl. graceful stop):
              * default: 10000 iterations shared among 100 VUs (maxDuration: 10m0s, gracefulStop: 30s)


     data_received..................: 28 GB  184 MB/s
     data_sent......................: 1.1 MB 7.3 kB/s
     http_req_blocked...............: avg=40.25µs min=0s    med=1µs    max=5.21ms   p(90)=1µs     p(95)=2µs
     http_req_connecting............: avg=33.44µs min=0s    med=0s     max=3.6ms    p(90)=0s      p(95)=0s
     http_req_duration..............: avg=1.52s   min=1.14s med=1.51s  max=2.08s    p(90)=1.59s   p(95)=1.63s
       { expected_response:true }...: avg=1.52s   min=1.14s med=1.51s  max=2.08s    p(90)=1.59s   p(95)=1.63s
     http_req_failed................: 0.00%  ✓ 0         ✗ 10000
     http_req_receiving.............: avg=12.07ms min=330µs med=2.53ms max=485.87ms p(90)=15.82ms p(95)=34.2ms
     http_req_sending...............: avg=3.99µs  min=1µs   med=3µs    max=2.78ms   p(90)=6µs     p(95)=8µs
     http_req_tls_handshaking.......: avg=0s      min=0s    med=0s     max=0s       p(90)=0s      p(95)=0s
     http_req_waiting...............: avg=1.51s   min=1.13s med=1.5s   max=1.97s    p(90)=1.57s   p(95)=1.61s
     http_reqs......................: 10000  65.558846/s
     iteration_duration.............: avg=1.52s   min=1.14s med=1.51s  max=2.08s    p(90)=1.59s   p(95)=1.63s
     iterations.....................: 10000  65.558846/s
     vus............................: 100    min=100     max=100
     vus_max........................: 100    min=100     max=100


running (02m32.5s), 000/100 VUs, 10000 complete and 0 interrupted iterations
default ✓ [======================================] 100 VUs  02m32.6s/10m0s  10000/10000 shared iters

@lhotari lhotari requested a review from dao-jun April 17, 2024 08:41
@Technoboy- Technoboy- added this to the 3.3.0 milestone Apr 17, 2024
@Technoboy- Technoboy- merged commit 94f6c7c into apache:master Apr 17, 2024
lhotari added a commit that referenced this pull request Apr 17, 2024
…sharing/caching compressed result (#22521)

(cherry picked from commit 94f6c7c)

# Conflicts:
#	pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java
lhotari added a commit that referenced this pull request Apr 17, 2024
…sharing/caching compressed result (#22521)

(cherry picked from commit 94f6c7c)

# Conflicts:
#	pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java
lhotari added a commit that referenced this pull request Apr 17, 2024
…sharing/caching compressed result (#22521)

(cherry picked from commit 94f6c7c)

# Conflicts:
#	pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java
lhotari added a commit that referenced this pull request Apr 18, 2024
…sharing/caching compressed result (#22521)

(cherry picked from commit 94f6c7c)
mukesh-ctds pushed a commit to datastax/pulsar that referenced this pull request Apr 19, 2024
…sharing/caching compressed result (apache#22521)

(cherry picked from commit 94f6c7c)

# Conflicts:
#	pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java
(cherry picked from commit 212b85f)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Apr 23, 2024
…sharing/caching compressed result (apache#22521)

(cherry picked from commit 94f6c7c)

# Conflicts:
#	pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java
(cherry picked from commit 212b85f)
hanmz pushed a commit to hanmz/pulsar that referenced this pull request Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants