因此,我们希望将我们的解决方案从Windows移到Linux。这个应用程序就在Azure前门后面,同样的代码在windows上运行的非常好,所有的默认设置都是这样。但是,当部署到Linux时,会导致非常高的响应时间。尝试更改健康检查协议(开始获取),但是没有运气(检查的路径是/)。当我们从AFD中删除应用程序时,它工作得很好,但我想我们无法复制高负载。数据库根本没有加载,它是S2。日志显示如下:
*
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,我相信这是由平台本身处理的。
谢谢!
发布于 2021-03-16 21:46:12
似乎您没有正确地处理连接,或者您正在执行弹性查询。由于对“碎片”进行了弹性查询,我们遇到了类似的问题。
这在您的DB设置上是不同的,因此尝试引用这个链接来了解什么是弹性查询。https://learn.microsoft.com/en-us/azure/azure-sql/database/elastic-query-overview本质上不应该从一个数据库中查询多个碎片,因为它打开了跨所有其他碎片的连接。
https://stackoverflow.com/questions/66657610
复制相似问题