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

More efficient response format #102

Open
springmeyer opened this issue Oct 24, 2018 · 1 comment
Open

More efficient response format #102

springmeyer opened this issue Oct 24, 2018 · 1 comment

Comments

@springmeyer
Copy link
Contributor

In profiling vtquery under load with @mapsam I recall seeing that the JSON response creation runs on the main event loop and takes a non-trivial amount of time to return as a JS object.

Given this fact there are several things we can consider that would speed up the response:

Async json generation in threadpool

We could generate the JSON response async inside the thread pool (so inside Execute() rather than on the main thread like is currently done (

void HandleOKCallback() override {
).

This would require serializing the JSON to a string and then passing the data back from the threadpool in the same way that we pass vector tiles back from the threadpool to the main thread in vtcomposite and vtshaver (as a node.Buffer).

Compressing the JSON response

Now that we're working with a string, we could also gzip compress the JSON string in the threadpool before sending back. This could help speed up the transfer of the data to clients.

@springmeyer
Copy link
Contributor Author

This would require serializing the JSON to a string

I've put forth a sample PR that does this at #103

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

No branches or pull requests

1 participant