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

Streaming/chunked API (and others) response #128

Open
joetsoi opened this issue Feb 12, 2015 · 3 comments
Open

Streaming/chunked API (and others) response #128

joetsoi opened this issue Feb 12, 2015 · 3 comments

Comments

@joetsoi
Copy link

joetsoi commented Feb 12, 2015

see ckan/ckan#1847, currently the response string is fully constructed before sending it, we could do something along the lines of using an iterator to send responses so we don't end up eating large chunks of memory when sending large api responses and perhaps sending these as chunked responses?

@aliceh75
Copy link

This would be quite useful given that API consumers can be quite slow. One of our own tools streams the response from the API and processes it on the go. This means that the CKAN server has to keep the entire response in memory until the end of the processing (which in our case takes about 30 seconds for 5,000 rows).

An iterator approach with chunked responses (and/or websockets) would alleviate this.

@joetsoi
Copy link
Author

joetsoi commented Jul 7, 2015

https://stackoverflow.com/questions/6886283/how-i-can-i-lazily-read-multiple-json-objects-from-a-file-stream-in-python
https://en.wikipedia.org/wiki/JSON_Streaming

we'll have to push this to an api v4, as our output is a single json object, we'd have to redfine our output to be a list of json objects.

@wardi
Copy link
Contributor

wardi commented Jul 9, 2015

Absolutely, I'd love to see a streaming (input and output) version of our API based on newline-delimited JSON. It could be backwards compatible for old clients by requiring a prefix sent by the client like '{"streaming":true}\n'

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

3 participants