-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Fully buffer XML, JSON, and Razor request and ViewComponentResultExecutor response bodies #6397
Comments
@rynowak, thoughts? |
Lets discuss this with @DamianEdwards and @Tratcher. We discussed making this configurable so that it would blow up if it went above some threshold by default and it could be configurable per request otherwise. |
We may have enough control over razor to make it do smarter async flushing rather than full buffering. E.g. FlushAsync between tags if the buffer is more than 75% full. |
Offline design notes from @danroth27 and @davidfowl: |
I hope this doesn't get used as an excuse to continue allowing Razor to do sync writes/flushes. Buffering is a decent mitigation, but not nearly as good as top-to-bottom async I/O. |
@halter73 do you have a (non-glib) proposal for what that looks like? For context, we already do something internally that might map pretty well to pipelines. If it is a good fit, and all 3.0 users can run on pipelines then I'd like to see what it would take to migrate Razor. |
@rynowak pipelines are available in a few places now for you to start prototyping with. |
The sync IO change has been merged with a few local opt-outs for things like the XML serilaizer. These should still be addressed. |
* Buffer writes from sources of synchronous writes Fixes #6397
Is your feature request related to a problem? Please describe.
Sync IO is a frequent source of thread pool starvation. As such #5120 bans sync IO operations for each server by default. Unfortunately the MVC XML and JSON serializers and deserializers rely on sync IO, as does the Razor view engine.
Describe the solution you'd like
Fully buffer the request and response bodies for the XML, Newtonsoft.JSON, and Razor scenarios. The new JSON APIs for 3.0 should provide async implementations. The current implementations already rely on partial buffering, but perform sync IO if those buffers fill/drain.
This has a frequently requested side benefit of allowing the app to recover from response serialization errors and return a meaningful error message.
Here are a few example test failures:
@davidfowl @mkArtakMSFT @pranavkm
The text was updated successfully, but these errors were encountered: