Presentation is loading. Please wait.

Presentation is loading. Please wait.

It’s time to do ASH! Tuesday, Februrary 8 th 2005 Gaja Krishna Vaidyanatha Principal, DBPerfMan LLC

Similar presentations


Presentation on theme: "It’s time to do ASH! Tuesday, Februrary 8 th 2005 Gaja Krishna Vaidyanatha Principal, DBPerfMan LLC"— Presentation transcript:

1 It’s time to do ASH! Tuesday, Februrary 8 th 2005 Gaja Krishna Vaidyanatha Principal, DBPerfMan LLC gaja@dbperfman.com gaja@dbperfman.com http://www.dbperfman.com

2 I am not an expert…not by any stretch of the imagination. Confession#1

3 I am an engineer not a scientist. Confession#2

4 Advanced Tuning, Turbo-charged Tuning, Push-Me-For-More-Power Tuning…Lies…Just Plain Lies… Or is it called Marketing these days!!! Confession#3

5 There is only one way to optimize Oracle performance – The Right Way...Using the Wait Interface Confession#4

6 Plan of Action What is ASH? Oracle 10g ASH! Why should you use ASH? Components of ASH ASH Architecture ASH Details Using ASH - Some Initial Findings Future Ideas for ASH Conclusion

7 What is ASH? Non-Oracle ASH Non-Oracle ASH Ashland Inc. (NYSE – ASH) Ashland Inc. (NYSE – ASH) Action on Smoking and Health Action on Smoking and Health American Society of Hypertension American Society of Hypertension ASH Karo!!! ASH Karo!!! Means “Have FUN in Hindi” Means “Have FUN in Hindi” ASH in Oracle 10g ASH in Oracle 10g Active Session History Active Session History “ASH Karo “ASH Karo Said in another way “Use Oracle 10g ASH” Said in another way “Use Oracle 10g ASH”

8 Oracle 10g ASH! New source of Oracle database performance data in 10g An active session is one which is in a user call Parse Parse Execute Execute Fetch Fetch On the CPU On the CPU Provides historical information about recently sampled “active” sessions

9 ASH = V$SESSION_WAIT++ with History Note: In 10g V$SESSION_WAIT is integrated with V$SESSION Note: In 10g V$SESSION_WAIT is integrated with V$SESSION It facilitates spot analysis of both foreground and background sessions Oracle 10g ASH!

10 Why should you use ASH? Great for performance diagnostics Logs wait events along with SQL details and session-specific context in a circular buffer in memory Logs wait events along with SQL details and session-specific context in a circular buffer in memory Fixed session sampling algorithm uses < 0.1% of 1 CPU Can be modified by the use of an _ parameter Can be modified by the use of an _ parameter Primary data provider for the Automatic Database Diagnostic Monitor (ADDM) ADDM supports proactive performance diagnostics within the Oracle Kernel ADDM supports proactive performance diagnostics within the Oracle Kernel

11 Components of ASH Memory buffers in the fixed areas New Oracle Background Process MMNL – MMON Lite MMNL – MMON LiteV$ACTIVE_SESSION_HISTORYX$ASHDBA_HIST_ACTIVE_SESS_HISTORY Based on WRH$_ACTIVE_SESSION_HISTORY Based on WRH$_ACTIVE_SESSION_HISTORY

12 ASH Architecture Circular buffer in SGA V$ACTIVE_SESSION_HISTORY X$ASH AWR WRH$_ACTIVE_SESSION_HISTORY Every 30 mins or when buffer is full Samples with variable size rows Direct-path inserts MMON Lite (MMNL) Indexed on time

13 ASH Details - General No installation or setup required Intended 30-min circular buffer in the SGA In memory ASH contains as much history as it can store. Circular buffer not cleared when written to disk Circular buffer not cleared when written to disk ASH on Disk (1 of 10 in memory samples) Init.ora STATISTICS_LEVEL = TYPICAL (Default) STATISTICS_LEVEL = TYPICAL (Default) Master Switch _ACTIVE_SESSION_HISTORY = TRUE (Default) _ACTIVE_SESSION_HISTORY = TRUE (Default)

14 ASH Details - General 30-minute circular buffer in the SGA - GOAL May scale down to smaller duration on large systems May scale down to smaller duration on large systems Circular Buffer Sizing Formula: Max( Min (# of CPUs * 2MB, 5% of SHARED_POOL_SIZE, 30MB), 1MB) If SHARED_POOL_SIZE is not explicitly set Formula changes to 2% of SGA target Formula changes to 2% of SGA target

15 ASH Details - General Assumptions for MAX Size - 30MB 100 active sessions 100 active sessions Sampled at once per second (60 samples in 1 minute) Sampled at once per second (60 samples in 1 minute) Assume 17 minutes of non-stop collection Assume 17 minutes of non-stop collection Assume 300 bytes per sample Assume 300 bytes per sample Size = 100*60*17*300 bytes ~ 29.18MB Size = 100*60*17*300 bytes ~ 29.18MB Fudge Factor of 0.82 MB Fudge Factor of 0.82 MB

16 ASH Details - General History flushed to Automatic Workload Repository (AWR) every 30 minutes Part of the AWR snapshot Database metrics Database metrics Session Wait Information Session Wait Information Hot files and segments Hot files and segments

17 ASH Details - General Sampling done every second Can support sub-second sampling Can support sub-second sampling _ash_sampling_interval = 1000 (milliseconds by default) _ash_sampling_interval = 1000 (milliseconds by default) Can dump to process trace (if required) Estimated 2500 CPU Instructions per active session per sample 400 active sessions on a 1 Ghz processor consumes < 1 millisecond 400 active sessions on a 1 Ghz processor consumes < 1 millisecond The sampler (MMNL) does not take any latches It supports dirty reads Can write to the in-memory buffer without any issues

18 ASH Details – View Describe SQL> desc v$active_session_history Name Null? Type Name Null? Type ---------------------------------------------- ---------------------------- ---------------------------------------------- ---------------------------- SAMPLE_ID NUMBER SAMPLE_ID NUMBER SAMPLE_TIME TIMESTAMP(3) SAMPLE_TIME TIMESTAMP(3) SESSION_ID NUMBER SESSION_ID NUMBER SESSION_SERIAL# NUMBER SESSION_SERIAL# NUMBER USER_ID NUMBER USER_ID NUMBER SQL_ID VARCHAR2(13) SQL_ID VARCHAR2(13) SQL_CHILD_NUMBER NUMBER SQL_CHILD_NUMBER NUMBER SQL_PLAN_HASH_VALUE NUMBER SQL_PLAN_HASH_VALUE NUMBER SQL_OPCODE NUMBER SQL_OPCODE NUMBER SERVICE_HASH NUMBER SERVICE_HASH NUMBER SESSION_TYPE VARCHAR2(10) SESSION_TYPE VARCHAR2(10) SESSION_STATE VARCHAR2(7) SESSION_STATE VARCHAR2(7) QC_SESSION_ID NUMBER QC_SESSION_ID NUMBER QC_INSTANCE_ID NUMBER QC_INSTANCE_ID NUMBER EVENTVARCHAR2(64) EVENTVARCHAR2(64) EVENT_ID NUMBER EVENT_ID NUMBER EVENT_#NUMBER EVENT_#NUMBER SEQ#NUMBER SEQ#NUMBER P1 NUMBER P1 NUMBER P2 NUMBER P2 NUMBER P3 NUMBER P3 NUMBER WAIT_TIME NUMBER WAIT_TIME NUMBER TIME_WAITED NUMBER TIME_WAITED NUMBER CURRENT_OBJ# NUMBER CURRENT_OBJ# NUMBER CURRENT_FILE# NUMBER CURRENT_FILE# NUMBER CURRENT_BLOCK# NUMBER CURRENT_BLOCK# NUMBER PROGRAM VARCHAR2(64) PROGRAM VARCHAR2(64) MODULE VARCHAR2(48) MODULE VARCHAR2(48) ACTION VARCHAR2(32) ACTION VARCHAR2(32) CLIENT_ID VARCHAR2(64) CLIENT_ID VARCHAR2(64)

19 ASH Details – View Definition SQL> select view_definition from v$fixed_view_definition 2* where view_name = 'GV$ACTIVE_SESSION_HISTORY'; 2* where view_name = 'GV$ACTIVE_SESSION_HISTORY';VIEW_DEFINITION-------------------------------------------------------------------------------- SELECT /*+ no_merge ordered use_nl(s,a) */ a.inst_id, s.sample_id, s.sample_time, a.session_id, a.session_serial#, a.user_id, a.sql_id, a.sql_child_number, a.sql_plan_hash_value, a.sql_opcode, a.service_hash, decode(a.session_type, 1,'FOREGROUND', 2,'BACKGROUND', 'UNKNOWN'), decode(a.wait_time, 0, 'WAITING', 'ON CPU'), a.qc_session_id, a.qc_instance_id, a.event, a.event_id, a.event#, a.seq#, a.p1, a.p2, a.p3, a.wait_time, a.time_waited, a.current_obj#, a.current_file#, a.current_block#, a.program, a.module, a.action, a.client_id FROM x$kewash s, x$ash a WHERE s.sample_addr = a.sample_addr and s.sample_id = a.sample_id and s.sample_id = a.sample_id and s.sample_time = a.sample_time s.sample_time = a.sample_time The New Oracle 10g Car Wash

20 ASH Details – WRH$_ASH View Describe SQL> desc wrh$_active_session_history Name Null? Type Name Null? Type ------------------------------------ -------- --------------- ------------------------------------ -------- --------------- SNAP_ID NOT NULL NUMBER DBID NOT NULL NUMBER INSTANCE_NUMBER NOT NULL NUMBER SAMPLE_ID NOT NULL NUMBER SAMPLE_TIME NOT NULL TIMESTAMP(3) SESSION_ID NOT NULL NUMBER SESSION_SERIAL# NUMBER USER_ID NUMBER SQL_ID VARCHAR2(13) SQL_CHILD_NUMBER NUMBER SQL_PLAN_HASH_VALUENUMBER SERVICE_HASH NUMBER SESSION_TYPE NUMBER SQL_OPCODE NUMBER QC_SESSION_ID NUMBER QC_INSTANCE_ID NUMBER CURRENT_OBJ# NUMBER CURRENT_FILE#NUMBER CURRENT_BLOCK#NUMBER SEQ# NUMBER EVENT_ID NUMBER P1 NUMBER P2 NUMBER P3 NUMBER WAIT_TIME NUMBER TIME_WAITED NUMBER PROGRAM VARCHAR2(48) MODULE VARCHAR2(48) ACTION VARCHAR2(32) CLIENT_ID VARCHAR2(64)

21 Using ASH – Some Initial Findings Querying V$ACTIVE_SESSION_HISTORY needs a session New logins may be impossible on badly crippled systems New logins may be impossible on badly crippled systems Query V$ACTIVE_SESSION_HISTORY requires all relevant latches in the SQL layer On systems crippled on shared pool and library cache latches, queries to ASH will impose even more overhead on these latches

22 Proposed Workaround for Limitations 1.Data in buffer is first dumped to a process trace file – Host 1 2.Transport the file (ftp) to another box – Host 2 3.Sanitize the file of its headers and other information on Host 2 4.Build a SQL*Loader Control File for the load on Host 2 5.Create a user-defined ASH table (with the same structure) in a database in Host2 6.Load the data from #3 using #4 into #5

23 Optional Demo!!!

24 Future Ideas for ASH Keep a persistent and “reserved” session Eliminates the need to “logon” Eliminates the need to “logon” Pre-compile some standard cursors on ASH, Eliminates the need to soft parse Eliminates the need to soft parse Open a non-PL/SQL API so that data from the collector can be directly read Eliminates the need to SQL*Load trace data into another database Eliminates the need to SQL*Load trace data into another database

25 Conclusion Great performance diagnostic data source But it is only for 10g But it is only for 10g Granular enough data for most problems Makes for a good performance management suite when combined with ADDM and AWR Brand new code – Maturity will come with time Yet to replace 3 rd -party direct-SGA-attached collectors But it may be cheaper…;-) But it may be cheaper…;-)

26 Visit us at http://www.dbperfman.com Gaja Krishna Vaidyanatha, Principal, DBPerfMan LLC, gaja@dbperfman.com Thank You!


Download ppt "It’s time to do ASH! Tuesday, Februrary 8 th 2005 Gaja Krishna Vaidyanatha Principal, DBPerfMan LLC"

Similar presentations


Ads by Google