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

Streamingfeatures #40

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

Streamingfeatures #40

wants to merge 4 commits into from

Conversation

bitner
Copy link
Contributor

@bitner bitner commented Jul 25, 2022

Test to see if performance can be gained and memory usage minimized by using cursors and streaming response for all outputs.

@bitner
Copy link
Contributor Author

bitner commented Jul 25, 2022

@vincentsarago This is super ugly right now, but looks possibly very promising.

This separates out the count to a separate query and by default will just use an estimated count for the numberMatched total.

For returning GeoJson and GeoJsonSeq, rather than creating the FeatureCollection on the database, it gets the Features as just straight text and returns them directly as a streaming response using a cursor so that it can grab data a chunk at a time. For GeoJson, it just returns the FeatureCollection wrapper before and after yielding the Features. Right now, it doesn't have any of the link stuff in there, so it is just taking geojson as text from the database and directly yielding it rather than decoding/encoding the json -- adding the links back in will probably add a chunk of the overhead.

Using the countries sample dataset, it returns the geojson of all countries (http://localhost:8000/collections/public.countries/items?f=geojson&limit=1000) in 270ms while on master, the same query takes 6.86 seconds.

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

Successfully merging this pull request may close these issues.

1 participant