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

[Maps] gzip mvt tiles #121819

Closed
wants to merge 10 commits into from
Closed

Conversation

thomasneirynck
Copy link
Contributor

@thomasneirynck thomasneirynck commented Dec 21, 2021

Closes #121822, part of #116150

this PR is identical to #122223, except it explicitly unpacks the ES response-stream to a buffer, rather than just passing it along.

This introduces gzipping in the Kibana Server. This can already be used to validate client behavior in the browser. Ideally, Elasticsearch gzip the response. Added gzipping by Elasticsearch 484e0d5

blocked by #119791

@thomasneirynck thomasneirynck added enhancement New value added to drive a business result [Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation v8.1.0 labels Dec 21, 2021
@thomasneirynck thomasneirynck marked this pull request as ready for review December 27, 2021 17:01
@thomasneirynck thomasneirynck requested a review from a team as a code owner December 27, 2021 17:01
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-gis (Team:Geo)

expect(resp.headers['content-disposition']).to.be('inline');
expect(resp.headers['content-type']).to.be('application/x-protobuf');
expect(resp.headers['cache-control']).to.be('public, max-age=3600');

const jsonTile = new VectorTile(new Protobuf(resp.body));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the .body-getter already transparently unzips the response. Removing the gzip content-encoding header will (correctly) break the functional tests because the contents are indeed gzipped.

@thomasneirynck thomasneirynck added release_note:enhancement and removed enhancement New value added to drive a business result labels Dec 27, 2021
x-pack/plugins/maps/server/mvt/util.ts Outdated Show resolved Hide resolved
}
);
return tile.body as unknown as Buffer;
return await collectStream(tile.body as Iterable<Buffer>);
Copy link
Member

Choose a reason for hiding this comment

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

Are you doing anything server side with this data? If not, it's more performant to directly pipe the client response body stream into the kibana response stream, as it's much more memory efficient.

Copy link
Contributor Author

@thomasneirynck thomasneirynck Jan 3, 2022

Choose a reason for hiding this comment

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

@nreese made the same suggestion offline.

The main reason for collecting the stream here to be able to read out the content-length, and return it in the response-header. The previous implementation did this, although may not be necessary agreed.

I'm ignorant of the true impact of just piping the result, so I've put up separate PR with this change (#122223)

  • most of the streams are only 1-3 chunks anyway.
  • not sure impact on client-side (I'm not sure if TMS allows for streamed http-responses).
  • not sure about other Kibana-internals (it's possible that the wrapper-library unpacks the stream anyway)
  • not sure about impact on test-coverage

So, to keep this PR smallish, I'd prefer handling the streaming-refactor in isolation (in PR #122223)

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@thomasneirynck
Copy link
Contributor Author

Closing in favor of #122223, which no longer includes unpacking the stream. There don't seem to be any ill side-effects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation release_note:enhancement v8.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Maps] gzip mvt tiles
4 participants