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

Reduce bandwidth when using preferRest #2082

Open
brettwillis opened this issue Jul 11, 2024 · 1 comment
Open

Reduce bandwidth when using preferRest #2082

brettwillis opened this issue Jul 11, 2024 · 1 comment
Assignees
Labels
api: firestore Issues related to the googleapis/nodejs-firestore API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@brettwillis
Copy link
Contributor

I recently discovered that the Firestore REST API serves JSON responses in a "pretty printed" format with newlines, indentation etc. I also discovered that the REST API also has a prettyPrint query parameter that can opt in to non-pretty printing format, see https://firestore.googleapis.com/$discovery/rest?version=v1.

I found that using ?prettyprint=0 can save up to 50% of the JSON response size (probably less when considering compression) due to the highly nested (and therefore indented) nature of Firestore response data structures.

However this may affect how the underlying libraries (gax?) do streaming parsing (if they do so?). I don't know enough about how the underlying I/O libraries are structured to know the impact or complexity, or even if you're not disabling pretty print already... I just did a quick search and couldn't find any reference to it.

I'll just leave this here for consideration.

@brettwillis brettwillis added priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels Jul 11, 2024
@product-auto-label product-auto-label bot added the api: firestore Issues related to the googleapis/nodejs-firestore API. label Jul 11, 2024
@MarkDuckworth MarkDuckworth self-assigned this Jul 11, 2024
@MarkDuckworth
Copy link
Contributor

Nice find. I did some testing an it looks like pretty print is used in the JSON responses. When setting $prettyPrint=0, the nodejs-firestore system tests pass. I haven't quantified the impact on response size and performance.

This should be controlled in the gax fallback implementation, so I'll get in touch with that team.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore Issues related to the googleapis/nodejs-firestore API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

2 participants