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

GraphQL: Compact network format #42

Open
lcdr opened this issue Jun 23, 2024 · 2 comments
Open

GraphQL: Compact network format #42

lcdr opened this issue Jun 23, 2024 · 2 comments

Comments

@lcdr
Copy link
Contributor

lcdr commented Jun 23, 2024

Currently GraphQL uses JSON as the network format. This works, but is inefficient, as each entry repeats its field names. Since the GraphQL client specifies the response structure, it already knows the field names. As long as there are no optional fields, this means we can transfer data in a much more compact manner by skipping field name serialization entirely and reconstructing them on the client.

In addition, in the case of arrays, we wouldn't need to send opening and closing braces and commas for each entry, since with a constant number of fields known in advance we can section the array on the client.

If we ever start supporting conditional fields we could still serialize those as standard JSON, resulting in a hybrid format that is both flexible and compact.

This would help reducing network overhead to something comparable to the SQL API's CSV format.

@Xiphoseer
Copy link
Collaborator

Just having gzip'ed responses should reduce most of the overhead of JSON repeating syntax/names. There's also BSON if that's not sufficient.

I'd prefer not to roll our own format

@lcdr
Copy link
Contributor Author

lcdr commented Jun 23, 2024

true but it annoys me that the server first does a bunch of work to serialize key names which are then sent over the network only for the client not to need them in the first place

anyway this is very low priority so i doubt i'll get to this in any case

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

2 participants