-
Notifications
You must be signed in to change notification settings - Fork 74
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
GZIP Support #345
Comments
This is mainly for gRPC transcoding to gzip compress the JSON response. is that right? Hi @PiotrSikora @lizan Does Nginx support GZIP compression in Response? If no, how easy to add it? |
@qiwzhang it does ( |
If you are using custom nginx.conf adding |
I've tried many variations of this and have not been able to get this to work. One attempt:
I expect this to work, am I missing something? |
We never try it. Hi @mangchiandjjoe Could you try it? |
The default value of gzip_types is "text/html"
$ curl -v -H "Accept-Encoding: gzip" "http://127.0.0.1:8090/shelves"
|
Could you please check your backend is returning "Content-Type" header? |
The backed is grpc so I'm not setting any content to type. |
nginx requires content-type header to enable gzip compression. https://github.com/nginx/nginx/blob/master/src/http/modules/ngx_http_gzip_filter_module.c#L257
|
What does this mean for gRPC? From my end, i've added the gzip headers but the gRPC transcoding to JSON is never gzipped by nginx. |
The content type for transcoding is set to application/json. I don’t think we set content-length but use chunked encoding, I think setting length for transcoding might work. It will be only for unary calls, does that solves your problem? |
That does solve my problem. |
This would greatly help me as well, any thoughts on when this might be available? @lizan Is there any chance gzip could work for streaming calls as well or is there a technical reason that can't be done? |
@lizan Is it possible to add gzip support in start_esp now? I just learned that GCP LB won't handle gzip compression. So ESP as the application frontend should do this. |
At current state, just adding "gzip on" only works for HTTP backend. |
A small gRPC response gets bloated for over 20x in size due to JSON and the lacking of compression. Could you evaluate the efforts needed for adding such support? We can help that out if this won't stand in the way of the esp dev roadmap. |
Would you be open to PR adding a startup |
Yes, we will appreciate your contribution. Please go ahead. |
Cool, as a quick fix I just made the origin server add to do the gzipping. Will circle back to this when we have time. If anyone else wants to pick it up in the meantime 👍 |
@lizan What does "setting length for transcoding" mean specifically? Is that a nginx option? |
No, it is in the ESP proto to json response transcoding code. It currently doesn't set it. It is not easy, data flow wise, it writes response headers first, then do body translation, so at the time of writing headers, content-length is not known. |
I can't find any docs around enabling this or support for this? Am I missing a hidden feature or does endpoints just not do this? It would be a huge improvement if transcoded JSON responses were compressed. Thanks!
The text was updated successfully, but these errors were encountered: