-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Increase the default maximum context pool size #24849
Comments
1024 like the benchmarks? |
For completeness, we also discussed making this infinite by default (i.e. int.MaxValue). The issue with that is that if there's suddenly a spike due to some issue (e.g. a temporary network problem causes operations to block for a bit, and therefore many contexts get created), then the excess contexts will never be freed. |
What's the strategy for clearing the pool? |
@davidfowl at the moment, the only time the pool is cleared is if its disposed; in the typical usage scenario, the pool is a singleton, so it never gets cleared (here's the code). But note that unlike e.g. database connections, DbContexts are purely an in-memory thing, so keeping around e.g. 1024 for the entire application doesn't seem like a big problem. Are you thinking about this with dotnet/runtime#48567 in mind? |
We agreed in triage to make this 1024 so that we don't ship an unbounded pool by default. |
Based on findings from the TechEmpower perf work. We probably want a very high default which can then be tuned down if the application wants to reduce maximum memory at the expense of speed.
The text was updated successfully, but these errors were encountered: