-
Notifications
You must be signed in to change notification settings - Fork 12
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
Ensure backpressure is maintained in streams #71
Comments
I just had a quick look at it. I see two places where there might be a significant problems with backpressure:
|
Indeed, unless the streaming profile is enabled, the full JSON-LD document is stored in memory before processing can start. This is because without the streaming profile (which mandates that certain JSON keys come in specific orders), the following situation could occur:
Since the context in the example above comes at the end, the meaning of all preceding entries could be different. So that is why buffering must take place. Just pinging @wouterbeek and @LaurensRietveld on this as well, as this will have an impact on the bounty's resolution. I.e., if the streaming profile is not explicitly enabled, full buffering will take place, and memory issues can still arise. |
Hi @rubensworks and @Tpt , having to explicitly enable the streaming profile in order to properly (without buffering fully) stream through the jsonld is fine from our end |
There may be some places where we are not adhering to Node's backpressure conventions with regards to streams.
Concretely, we seem to be creating new streams (such as
Readable
,PassThrough
andTransform
), andpush
-ing into them (via a'data'
handler on another stream). Node handles backpressuring via the return value ofpush
, which we are ignoring in this manner.A better solution would be to simply
pipe
instead of callingpush
on each data element.Related to rubensworks/rdf-parse.js@269c757
Related to #66
The text was updated successfully, but these errors were encountered: