首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Azure上运行的.net内核与Azure数据库之间的连接池问题

在Azure上运行的.net内核与Azure数据库之间的连接池问题
EN

Stack Overflow用户
提问于 2021-03-16 14:48:45
回答 1查看 985关注 0票数 1

因此,我们希望将我们的解决方案从Windows移到Linux。这个应用程序就在Azure前门后面,同样的代码在windows上运行的非常好,所有的默认设置都是这样。但是,当部署到Linux时,会导致非常高的响应时间。尝试更改健康检查协议(开始获取),但是没有运气(检查的路径是/)。当我们从AFD中删除应用程序时,它工作得很好,但我想我们无法复制高负载。数据库根本没有加载,它是S2。日志显示如下:

*

代码语言:javascript
复制
    Microsoft.EntityFrameworkCore.Database.Connection[20004]
    An error occurred using the connection to database 'blabla' on server 'blablabla.database.windows.net'.
    Microsoft.EntityFrameworkCore.Query[10100]
    An exception occurred while iterating over the results of a query for context type 'blablabla'.
    System.InvalidOperationException: Timeout expired.  The timeout period elapsed prior to obtaining a connection from the pool.  This may have occurred because all pooled connections were in use and max pool size was reached.
    at Microsoft.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
    at Microsoft.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
    at Microsoft.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
    at Microsoft.Data.SqlClient.SqlConnection.Open()
    at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenDbConnection(Boolean errorsExpected)
    at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open(Boolean errorsExpected)
    at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader(RelationalCommandParameterObject parameterObject)
    at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.Enumerator.InitializeReader(DbContext _, Boolean result)
    at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
    at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.Enumerator.MoveNext()
[40m[1m[33mwarn[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[22]
 Heartbeat took longer than "00:00:01" at ***. This could be caused by thread pool starvation.
[40m[1m[33mwarn[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[22]
Heartbeat took longer than "00:00:01" at ***. This could be caused by thread pool starvation.
[40m[1m[33mwarn[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[22]
Heartbeat took longer than "00:00:01" at ***. This could be caused by thread pool starvation.

想知道我们是否必须使用不同的SQL连接驱动程序?这是App,我相信这是由平台本身处理的。

谢谢!

EN

回答 1

Stack Overflow用户

发布于 2021-03-16 21:46:12

似乎您没有正确地处理连接,或者您正在执行弹性查询。由于对“碎片”进行了弹性查询,我们遇到了类似的问题。

这在您的DB设置上是不同的,因此尝试引用这个链接来了解什么是弹性查询。https://learn.microsoft.com/en-us/azure/azure-sql/database/elastic-query-overview本质上不应该从一个数据库中查询多个碎片,因为它打开了跨所有其他碎片的连接。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66657610

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档