2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

SQL Server 特定接続先から処理負荷を制限

Last updated at Posted at 2020-01-06

シチュエーション

1つのDBサーバを複数アプリが共有する。各アプリのデータベースは連携するので物理的に別DBサーバにしない。
あるアプリがたまにアバレル君になり、DB性能に大きく影響を与え他アプリが共倒れになる。
改善案で少しでもアプリ設計変更が含まれると却下される。

SQL Serverにリソース ガバナの導入

ここに書くとほぼコピペになるためリンク
https://matutak.hatenablog.com/entry/20100225/1267127110
古い記事だが、参考になった。
ありがとうございます。

  • ユーザー定義分類子関数例
  • master->プログラミング->関数->スカラー値関数 に作成
CREATE FUNCTION [dbo].[user_classifier]() RETURNS sysname
WITH SCHEMABINDING
AS
BEGIN

DECLARE @group_name AS sysname
set @group_name = SUSER_NAME()

select @group_name = (case when @group_name in ('app1','app2',...)
 then @group_name else 'default' end
)

return @group_name

END

Zabbixに監視追加

アバレル君を明確にする
テストプール名:app1

  • アイテム

  • 名前:Resource Pool Stats (app1)

  • タイプ:Zabbixエージェント(アクティブ)

  • キー:perf_counter["\SQLServer:Resource Pool Stats(app1)\CPU usage %"]

  • データ型:数値(浮動小数)

  • 単位:%

  • トリガー

  • 名前:{HOST.NAME}: checkプールが5分間平均で{ITEM.LASTVALUE}を超過

  • 条件式:{share-db:perf_counter["\SQLServer:Resource Pool Stats(app1)\CPU usage %"].avg(5m)}>50

2020-01-06 13.57.36 zabbix.hoege.com 2ce567e734fb.png

メモ

アバレルアプリを特定できたら会議がしやすくなった。

参考

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?