2016-08-22 8 views
1

私はスタンダールS2 edition.In自分のアプリケーションのログを私は常に、このような形式の多くの例外を参照している紺碧内のデータベースがあります。AzureのSQLデータベース関連の例外

1.

System.Data.SqlClient.SqlException: The client was unable to establish a connection because of an error during connection initialization process before login. Possible causes include the following: the client tried to connect to an unsupported version of SQL Server; the server was too busy to accept new connections; or there was a resource limitation (insufficient memory or maximum allowed connections) on the server. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.) ---> System.ComponentModel.Win32Exception: An existing connection was forcibly closed by the remote host

2.

System.Data.Entity.Core.EntityException: The underlying provider failed on Open. ---> 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

System.Data.SqlClient.SqlException (0x80131904): The client was unable to establish a connection because of an error during connection initialization process before login. Possible causes include the following: the client tried to connect to an unsupported version of SQL Server; the server was too busy to accept new connections; or there was a resource limitation (insufficient memory or maximum allowed connections) on the server. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.) ---> System.ComponentModel.Win32Exception (0x80004005): An existing connection was forcibly closed by the remote host.

SqlAzureExecutionStrategyを使用するため、この例外はいくつかの再試行の後にスローされます。

azure portlaではさまざまなパフォーマンス指標が表示されていますが、問題はないようです。

問題を特定するにはどうすればよいですか?

+1

'問題を特定するにはどうすればいいですか?> Azure SQL DBでサポートケースを開きます。 –

+0

AzureSQLデータベースはアプリケーションコードと同じAzure Regionにありますか? Azure SQLデータベースに直接インターネット経由で接続していますか(デスクトップクライアントソフトウェアなどからですか?) – Dai

+0

また、azureのあなたのイベントログテーブルを確認してください。 – TheGameiswar

答えて

1

あなたのデータベースはあまりにも重い負荷がかかっているか、まだ実行中の、または接続を断念していないクエリがあると思います。

私が実行されているものを見るために、このクエリを使用

:あなたはまだここに実行しているクエリを持っているか、AzureのポータルでCPUの使用率に目を離さない場合

SELECT (SELECT TOP 1 SUBSTRING(s2.text,statement_start_offset/2+1 , 
    ((CASE WHEN statement_end_offset = -1 
    THEN (LEN(CONVERT(nvarchar(max),s2.text)) * 2) 
    ELSE statement_end_offset END) - statement_start_offset)/2+1)) AS sql_statement, 
    s1.* FROM sys.dm_exec_requests s1 
CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS s2 
ORDER BY 1 

を参照してください。

S2データベースは特に優れているわけではありませんので、多くの場合(小さなものでも)、それらを拒否している可能性があります。

あなたの再試行戦略は、問題を悪化させる可能性もありますが、すでに完了した時点でそれ以上のリクエストを投げている可能性があります。このような場合は、指数バックオフを使用してみてください。

0

3つはすべて、接続プーリング設計で説明できます。あなたはあなたの接続を再利用していますか、それとも自分の接続を開いているデータベースへのすべての呼び出しですか?各DBContextの最後に接続を終了していますか?データベースへのラウンドトリップ回数を最小限に抑えるために、あらゆる種類のキャッシュ層を実装していますか?

あなたのプーリングに問題があるかどうかを確認する方法です。ポータルから問題のデータベースに行き、Resource utilizationグラフを見て、editを押します。

Default resource graph

次に選択リストからセッション率と労働者の割合を追加し、[OK]を押します。

Resource graph choices

あなたのプーリングが問題であるならば、あなたはあなたのセッションと労働者の割合が高く、期間については100%で釘付けにすることができることを見つけることができます。 100%をヒットした場合、現在のセッションと作業者が終了するか、殺害されるまで、新しい接続を最大5分間拒否できます。

関連する問題