DB2負載管理(WLM)(一)
目的:
測試DB2負載管理(WLM,對不同操作分配不同代理優先順序,在超過指定CPU資源後仍未完成的,降低優先順序,類似於Oracle的ResourceManager);本指令碼摘錄自DB2安裝目錄admin_scripts/wlmtiersdefault.db2。
版本:Windows DB2 Express-C V9.7
說明:由於該版本不支援該特性,抱錯SQL8029N 找不到所請求功能的有效許可證金鑰,沒有測試.
操作:
使用sqllib/misc/wlmevmon.ddl建立WLM事件監視器;
需要許可權DBADM或WLMADM;
步驟:
1,建立服務類,層次關係如下:
------------WLM_TIERS
-- +----------+-----------+
-- | | |
--WLM_SHORT WLM_MEDIUM WLM_LONG
connect to sample@
-- Create service superclass WLM_TIERS
CREATE SERVICE CLASS WLM_TIERS@
-- Create service subclasses WLM_SHORT, WLM_MEDIUM, WLM_LONG
CREATE SERVICE CLASS WLM_SHORT UNDER WLM_TIERS@
CREATE SERVICE CLASS WLM_MEDIUM UNDER WLM_TIERS@
CREATE SERVICE CLASS WLM_LONG UNDER WLM_TIERS@
2,建立服務類重新影射閾值
--WLM_SHORT --> WLM_MEDIUM --> WLM_LONG
-- Create thresholds to remap activities from WLM_SHORT to WLM_MEDIUM
-- to WLM_LONG service subclasses based on processor time used in service class
CREATE THRESHOLD WLM_TIERS_REMAP_SHORT_TO_MEDIUM FOR
SERVICE CLASS WLM_SHORT UNDER WLM_TIERS ACTIVITIES
ENFORCEMENT DATABASE PARTITION WHEN
CPUTIMEINSC > 10 SECONDS CHECKING EVERY 5 SECONDS
REMAP ACTIVITY TO WLM_MEDIUM@
CREATE THRESHOLD WLM_TIERS_REMAP_MEDIUM_TO_LONG FOR
SERVICE CLASS WLM_MEDIUM UNDER WLM_TIERS ACTIVITIES
ENFORCEMENT DATABASE PARTITION WHEN
CPUTIMEINSC > 10 SECONDS CHECKING EVERY 5 SECONDS
REMAP ACTIVITY TO WLM_LONG@
3,建立工作類集,工作動作集
-- Create work class set WLM_TIERS_WCS to identify activities
-- that can be remapped by CPUTIMEINSC threshold.
CREATE WORK CLASS SET WLM_TIERS_WCS
( WORK CLASS WLM_DML_WC WORK TYPE DML,
WORK CLASS WLM_CALL_WC WORK TYPE CALL,
WORK CLASS WLM_OTHER_WC WORK TYPE ALL )@
-- Create work action set WLM_TIERS_WAS to map activities that
-- can be remapped by CPUTIMEINSC threshold to service subclass
-- WLM_SHORT. All other activities are mapped to service subclass
-- WLM_MEDIUM and will not get remapped.
--DML-->WLM_SHORT
--CALL-->WLM_SHORT
--OTHER-->WLM_MEDIUM
CREATE WORK ACTION SET WLM_TIERS_WAS FOR SERVICE CLASS WLM_TIERS
USING WORK CLASS SET WLM_TIERS_WCS
( WORK ACTION WLM_DML_WA ON WORK CLASS WLM_DML_WC
MAP ACTIVITY TO WLM_SHORT,
WORK ACTION WLM_CALL_WA ON WORK CLASS WLM_CALL_WC
MAP ACTIVITY TO WLM_SHORT,
WORK ACTION WLM_OTHER_WC ON WORK CLASS WLM_OTHER_WC
MAP ACTIVITY TO WLM_MEDIUM )@
4,設定不同服務類代理優先順序
-- Create a stored procedure to determine operating system and to set service
-- class agent priorities. The operating system must be determined before
-- setting agent priority because the range of values for agent
-- priority differs between Windows and UNIX operating systems.
-- Service class properties:
--
-- Service Class Agent Priority Prefetch Priority
-- (UNIX / Win)
-- ---------------------------------------------------
-- WLM_SHORT -10 / 3 High
-- WLM_MEDIUM 0 / 0 Medium
-- WLM_LONG 10 / -3 Low
-- Default System -15 / 5 High
-- Default Maint. 15 / -5 Low
CREATE PROCEDURE checkPlatformAndSetAgentPriority()
LANGUAGE SQL
--------------------------------------------------------
-- SQL Stored Procedure checkPlatformAndSetAgentPriority
--------------------------------------------------------
BEGIN
DECLARE isWindows VARCHAR(256);
DECLARE stmt VARCHAR(300);
SELECT os_name INTO isWindows
FROM SYSIBMADM.ENV_SYS_INFO
WHERE UCASE(os_name) LIKE '%WIN%' OR UCASE(os_name) LIKE '%NT%';
-- #PROPERTY# (UNIX) Set agent priority for service classes on UNIX
-- operating systems. A lower numeric value means higher priority. A higher
-- numeric value means lower priority. The valid range for agent priority on
-- UNIX is -20 to 20.
IF isWindows IS NULL
THEN
SET stmt = 'ALTER SERVICE CLASS WLM_SHORT UNDER WLM_TIERS AGENT PRIORITY -10';
PREPARE s1 FROM stmt;
EXECUTE s1;
COMMIT;
SET stmt = 'ALTER SERVICE CLASS WLM_MEDIUM UNDER WLM_TIERS AGENT PRIORITY 0';
PREPARE s1 FROM stmt;
EXECUTE s1;
COMMIT;
SET stmt = 'ALTER SERVICE CLASS WLM_LONG UNDER WLM_TIERS AGENT PRIORITY 10';
PREPARE s1 FROM stmt;
EXECUTE s1;
COMMIT;
SET stmt = 'ALTER SERVICE CLASS SYSDEFAULTSYSTEMCLASS AGENT PRIORITY -15 ';
PREPARE s1 FROM stmt;
EXECUTE s1;
COMMIT;
SET stmt = 'ALTER SERVICE CLASS SYSDEFAULTMAINTENANCECLASS AGENT PRIORITY 15';
PREPARE s1 FROM stmt;
EXECUTE s1;
COMMIT;
-- #PROPERTY# (Windows) Set agent priority for service classes on Windows
-- operating systems. A higher numeric value means higher priority. A lower
-- numeric value means lower priority. The valid range for agent priority on
-- Windows is -6 to 6.
ELSE
SET stmt = 'ALTER SERVICE CLASS WLM_SHORT UNDER WLM_TIERS AGENT PRIORITY 3';
PREPARE s1 FROM stmt;
EXECUTE s1;
COMMIT;
SET stmt = 'ALTER SERVICE CLASS WLM_MEDIUM UNDER WLM_TIERS AGENT PRIORITY 0';
PREPARE s1 FROM stmt;
EXECUTE s1;
COMMIT;
SET stmt = 'ALTER SERVICE CLASS WLM_LONG UNDER WLM_TIERS AGENT PRIORITY -3';
PREPARE s1 FROM stmt;
EXECUTE s1;
COMMIT;
SET stmt = 'ALTER SERVICE CLASS SYSDEFAULTSYSTEMCLASS AGENT PRIORITY 5 ';
PREPARE s1 FROM stmt;
EXECUTE s1;
COMMIT;
SET stmt = 'ALTER SERVICE CLASS SYSDEFAULTMAINTENANCECLASS AGENT PRIORITY -5';
PREPARE s1 FROM stmt;
EXECUTE s1;
COMMIT;
END IF;
END@
-- Call the checkPlatformAndSetAgentPriority stored procedure to
-- set agent priorities for service classes
CALL checkPlatformAndSetAgentPriority()@
-- Drop the checkPlatformAndSetAgentPriority stored procedure
DROP PROCEDURE checkPlatformAndSetAgentPriority@
5,設定不同服務類預取(PREFETCH)優先順序
-- #PROPERTY# Set prefetch priority for service classes. Valid values for
-- prefetch priority are HIGH, MEDIUM, LOW or DEFAULT (MEDIUM).
ALTER SERVICE CLASS WLM_SHORT UNDER WLM_TIERS PREFETCH PRIORITY HIGH@
ALTER SERVICE CLASS WLM_MEDIUM UNDER WLM_TIERS PREFETCH PRIORITY MEDIUM@
ALTER SERVICE CLASS WLM_LONG UNDER WLM_TIERS PREFETCH PRIORITY LOW@
ALTER SERVICE CLASS SYSDEFAULTSYSTEMCLASS PREFETCH PRIORITY HIGH@
ALTER SERVICE CLASS SYSDEFAULTMAINTENANCECLASS PREFETCH PRIORITY LOW@
6,建立服務類重新影射閾值並記錄事件監視器日誌
-- #PROPERTY# Set the maximum in service class processor time before
-- remapping and the checking period. The maximum in service class processor
-- time determines how much processor time an activity can consume in
-- a service class before being remapped to the target service class.
-- For example, if you want an activity to remain in service class
-- WLM_SHORT for a shorter period before being remapped to WLM_MEDIUM,
-- decrease the CPUTIMEINSC threshold value for WLM_TIERS_REMAP_SHORT_TO_MEDIUM.
-- The checking period determines how long to wait between checks for threshold
-- violation. For serial ESE instances, set the checking period to be
-- the same as the processor time before remap. For DPF or SMP instances,
-- set a lower value for the checking period than the processor time
-- before remap.
--
-- When one of these thresholds is violated and an activity is remapped
-- to the next service subclass, an event monitor record is written to
-- the threshold violations event monitor. This way, you can see
-- how many activities are moved between the tiers service subclasses.
-- Logging an event monitor record incurs a small performance cost. Once
-- the system is tuned and the threshold violation event monitor records
-- are no longer needed, simply remove the 'LOG EVENT MONITOR RECORD'
-- clause from the ALTER THRESHOLD statements.
ALTER THRESHOLD WLM_TIERS_REMAP_SHORT_TO_MEDIUM WHEN
CPUTIMEINSC > 10 SECONDS CHECKING EVERY 5 SECONDS
REMAP ACTIVITY TO WLM_MEDIUM LOG EVENT MONITOR RECORD@
ALTER THRESHOLD WLM_TIERS_REMAP_MEDIUM_TO_LONG WHEN
CPUTIMEINSC > 10 SECONDS CHECKING EVERY 5 SECONDS
REMAP ACTIVITY TO WLM_LONG LOG EVENT MONITOR RECORD@
7,啟用工作負載管理器
-- Alter SYSDEFAULTUSERWORKLOAD to map workload to WLM_TIERS service class
ALTER WORKLOAD SYSDEFAULTUSERWORKLOAD SERVICE CLASS WLM_TIERS@
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/18922393/viewspace-702325/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- DB2負載管理(WLM)(二)DB2負載
- DB2負載管理(WLM)(三)DB2負載
- DB2 WLMDB2
- DB2 V9.5工作負載管理(二)DB2負載
- DB2 V9.5工作負載管理(五)DB2負載
- DB2 V9.5工作負載管理(六)DB2負載
- DB2 V9.5工作負載管理(七)DB2負載
- 負載均衡技術(一)———負載均衡技術介紹負載
- 一個負載均衡的問題負載
- 一文讀懂“負載均衡”負載
- NLB網路負載均衡管理器詳解負載
- 負載均衡負載
- linux負載均衡總結性說明(四層負載/七層負載)Linux負載
- DB2的一些管理用指令碼DB2指令碼
- gRPC負載均衡(客戶端負載均衡)RPC負載客戶端
- gRPC負載均衡(自定義負載均衡策略)RPC負載
- 2.8 使用資料庫服務管理應用負載資料庫負載
- php列印負載函式、Linux awk列印負載PHP負載函式Linux
- NGINX 負載均衡Nginx負載
- WebSocket負載均衡Web負載
- IP負載均衡負載
- nginx負載均衡Nginx負載
- Nginx負載配置Nginx負載
- 【Nginx】負載均衡Nginx負載
- 負載均衡 - MQTT Broker 叢集詳解(一)負載MQQT
- RAC負載均衡的簡單測試(一)負載
- Camel:軟負載管理中介軟體 通過介面及介面管理Nginx叢集負載Nginx
- 解密負載均衡技術和負載均衡演算法解密負載演算法
- JMeter分散式壓測/JMeter負載新增/jmeter負載均衡/jmeter Windows系統壓測負載新增JMeter分散式負載Windows
- 常用的DB2管理命令DB2
- 淺析基於雲的DNS管理與負載均衡技術DNS負載
- 負載均衡技術(二)———常用負載均衡服務介紹負載
- 【知識分享】四層負載均衡和七層負載均衡負載
- 記一次nginx負載均衡配置情況Nginx負載
- Go實現了一個負載均衡器Go負載
- 關於負載均衡的一些認識負載
- 淺談負載均衡負載
- 漫談負載均衡負載