pulsar icon indicating copy to clipboard operation
pulsar copied to clipboard

[improve][broker] Add gzip compression before http service response

Open xuesongxs opened this issue 3 years ago • 2 comments

Fixes #16321

xuesongxs avatar Jul 31 '22 04:07 xuesongxs

@xuesongxs Please provide a correct documentation label for your PR. Instructions see Pulsar Documentation Label Guide.

github-actions[bot] avatar Jul 31 '22 04:07 github-actions[bot]

@xuesongxs Please provide a correct documentation label for your PR. Instructions see Pulsar Documentation Label Guide.

github-actions[bot] avatar Jul 31 '22 05:07 github-actions[bot]

@asafm @tjiuming please review

lhotari avatar Aug 31 '22 05:08 lhotari

@xuesongxs please rebase changes

lhotari avatar Aug 31 '22 05:08 lhotari

Having gzip support for all http endpoints could be useful too. I wonder if it could be simply enabled for all by default. @codelipenghui wdyt?

lhotari avatar Aug 31 '22 05:08 lhotari

@addisonj please review

lhotari avatar Aug 31 '22 05:08 lhotari

Having gzip support for all http endpoints could be useful too. I wonder if it could be simply enabled for all by default. @codelipenghui wdyt?

I remember this PR and penghui said that not all the endpoints has a big response body, make all the endpoints output compressed response may lead to CPU usage increase

tjiuming avatar Aug 31 '22 08:08 tjiuming

for the tests, I remember the HTTP response code is always 302, so they didn't passed, does it fixed? and it's better to make sure the response body could parse to Prometheus Metrics successfully, current test only requires http code = 200.

tjiuming avatar Aug 31 '22 08:08 tjiuming

besides, over all LGTM

tjiuming avatar Aug 31 '22 08:08 tjiuming

@asafm @tjiuming please review

@lhotari Done. I suggested several changes.

asafm avatar Aug 31 '22 11:08 asafm

@lhotari Done. I suggested several changes.

@asafm great work on the review! Thanks

lhotari avatar Aug 31 '22 18:08 lhotari

Having gzip support for all http endpoints could be useful too. I wonder if it could be simply enabled for all by default. @codelipenghui wdyt?

I remember this PR and penghui said that not all the endpoints has a big response body, make all the endpoints output compressed response may lead to CPU usage increase

Can we enable conditional compression that only compresses payloads above a certain size?

michaeljmarshall avatar Sep 01 '22 05:09 michaeljmarshall

Can we enable conditional compression that only compresses payloads above a certain size?

Yes, that is supported in GzipHandler.

https://www.eclipse.org/jetty/javadoc/jetty-9/org/eclipse/jetty/server/handler/gzip/GzipHandler.html#setMinGzipSize(int)

lhotari avatar Sep 01 '22 05:09 lhotari

Can we enable conditional compression that only compresses payloads above a certain size?

Yes, that is supported in GzipHandler.

https://www.eclipse.org/jetty/javadoc/jetty-9/org/eclipse/jetty/server/handler/gzip/GzipHandler.html#setMinGzipSize(int)

That seems like a good indication to me that we should just enable it for all HTTP endpoints.

michaeljmarshall avatar Sep 01 '22 05:09 michaeljmarshall

Can we enable conditional compression that only compresses payloads above a certain size?

Yes, that is supported in GzipHandler. https://www.eclipse.org/jetty/javadoc/jetty-9/org/eclipse/jetty/server/handler/gzip/GzipHandler.html#setMinGzipSize(int)

That seems like a good indication to me that we should just enable it for all HTTP endpoints.

One interesting question here is if we experience any issues currently with other HTTP endpoints. In Prometheus, the shear response size of 300 MB is worth compressing since the issue with a timeout. I wonder which other endpoints have similar issues?

asafm avatar Sep 01 '22 07:09 asafm

The pr had no activity for 30 days, mark with Stale label.

github-actions[bot] avatar Oct 02 '22 02:10 github-actions[bot]

@xuesongxs - it looks like this PR stalled. It'd be great to move this along and get it merged. Do you plan on continuing work for this PR? Is the issue CI? Thanks!

michaeljmarshall avatar Oct 11 '22 19:10 michaeljmarshall

@xuesongxs - it looks like this PR stalled. It'd be great to move this along and get it merged. Do you plan on continuing work for this PR? Is the issue CI? Thanks!

I will continue to do this PR this week.

xuesongxs avatar Oct 12 '22 02:10 xuesongxs

@xuesongxs - it looks like something went wrong with your most recent commit. The diff is now very large.

michaeljmarshall avatar Oct 19 '22 01:10 michaeljmarshall

I created a new PR to replace it. https://github.com/apache/pulsar/pull/18102

From: Michael Marshall Date: 2022-10-19 09:42 To: apache/pulsar CC: xuesongxs; Mention Subject: Re: [apache/pulsar] [improve][broker] Add gzip compression support for /metrics endpoint (PR #16888) @xuesongxs - it looks like something went wrong with your most recent commit. The diff is now very large. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

xuesongxs avatar Oct 19 '22 06:10 xuesongxs