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

Internally use StreamAsync for FindAsync() #24641

Closed
Eli-Black-Work opened this issue Apr 13, 2021 · 3 comments
Closed

Internally use StreamAsync for FindAsync() #24641

Eli-Black-Work opened this issue Apr 13, 2021 · 3 comments
Labels
closed-out-of-scope This is not something that will be fixed/implemented and the issue is closed. customer-reported

Comments

@Eli-Black-Work
Copy link

It seems there's a well-known problem where EFCore is very slow when doing FindAsync() on a table that involves a VARCHAR(MAX) column. (#22331)

After reading dotnet/SqlClient#593 (comment), it looks like the ADO.NET StreamAsync methods are faster than the Async methods.

Does EFCore use ADO.NET internally? If it does, could the EFCore team modify FindAsync() to internally use StreamAsync, so that FindAsync() has decent performance even when selecting columns of type VARCHAR(MAX)?

Thanks, and sorry for the newbie question 🙂

@roji
Copy link
Member

roji commented Apr 13, 2021

While it's technically possible to modify EF Core's materialization to use GetTextReader and GetStream for the problematic field types, this would have affect other relational provider as well (not just SQL Server), and may slow down access to small values of VARCHAR(MAX) (we'd have to check this).

We generally try to avoid working around issues and bugs in lower layers (SqlClient in this case) - the recommended workaround is to not use async I/O (e.g. call Find instead of FindAsync) until SqlClient fix the issue on their side.

@ajcvickers
Copy link
Contributor

Discussed in triage and agreed this is not a direction we want to go.

@ajcvickers ajcvickers added closed-out-of-scope This is not something that will be fixed/implemented and the issue is closed. and removed type-enhancement labels Apr 19, 2021
@Eli-Black-Work
Copy link
Author

Ya, I didn't think about the fact that this would affect other providers. Thanks for the responses 🙂

Would still like to see this get fixed in SqlClient, of course 🙂 We had fixed a bunch of async-related warnings in VS and then lost a couple of days trying to figure out why our DB-related code had slowed to a crawl.

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-out-of-scope This is not something that will be fixed/implemented and the issue is closed. customer-reported
Projects
None yet
Development

No branches or pull requests

3 participants