Tuning for Oracle PL/SQL Lock Timer Wait Events

6
Tuning for Oracle PL/SQL Lock Timer Wait Events Confio Software 08/23/2022 1

description

The PL/SQL lock timer wait event represents the amount of time a user or application has "slept" through the USER_LOCK.SLEEP or DBMS_LOCK.SLEEP procedures. The PL/SQL lock timer event is worth watching because it can indicate issues with application response, throughput and possibly coding.

Transcript of Tuning for Oracle PL/SQL Lock Timer Wait Events

Page 1: Tuning for Oracle PL/SQL Lock Timer Wait Events

04/13/2023 1

Tuning for Oracle PL/SQL Lock Timer Wait Events

Confio Software

Page 2: Tuning for Oracle PL/SQL Lock Timer Wait Events

04/13/2023 2

About Oracle PL/SQL Lock Timer Wait Events

• Represents the amount of time a user or application has "slept" through the USER_LOCK.SLEEP or DBMS_LOCK.SLEEP procedures

• Is a sleep mandated by the application code– Indicates that the application is idle and doing

nothing– For example, if the application sleeps for a combined

interval of five minutes, the response to the user or complete run of the application will take at least five minutes longer

Page 3: Tuning for Oracle PL/SQL Lock Timer Wait Events

04/13/2023 3

Why It’s Worth Watching the PL/SQL Lock Timer Waits

• Can indicate issues with application response, throughput and possibly coding

• Oracle sleeps are put into an application for serialization of transactional events or spinning on queues until something happens

• When the event occurs or a queue is populated, then the application continues its work

• You will gain quicker responses if you trigger an action instead of the action waiting for an event

Page 4: Tuning for Oracle PL/SQL Lock Timer Wait Events

04/13/2023 4

How to look at the PL/SQL Lock Timer wait event

• To initiate a sleep for the current session for five seconds:SQL> execute sys.dbms_lock.sleep(5);

• To look at current sessions that are using the SLEEP command: SQL> select osuser,event,p1 from v$session where event = 'PL/SQL lock timer' OSUSER EVENT P1Johnny Smith PL/SQL lock timer 500

– Note that the column P1 in V$SESSION does not represent the amount of time the session has slept but the duration this session will sleep

– Also note that this column is in centiseconds (the five seconds issued for a sleep has been translated in to 500 centiseconds)

• To see the total amount of time accumulated for this wait event, look at the V$SYSTEM_EVENT view.

SQL> select time_waited from v$system_event where event = 'PL/SQL lock timer';

– Note that the time waited is also in centiseconds, but the time actually waited may be more that expected. On our test system this equated to about 1.024 seconds to 1 second requested.

Page 5: Tuning for Oracle PL/SQL Lock Timer Wait Events

04/13/2023 5

Recommendations for the PL/SQL Lock Timer wait event

• If an application is waiting for the PL/SQL lock timer wait, the end user is also waiting

• As DBAs, our job is to increase the throughput of the Oracle engine by limiting the amount of time an application runs

• We recommend asking why an application is sleeping for any amount of time and providing alternatives if necessary to reduce this idle event

• We must use response time analysis and a tool such as Confio Ignite to:– Identify the wait– Determine its impact– Provide an environment that allows database workload to complete

within respected times

Page 6: Tuning for Oracle PL/SQL Lock Timer Wait Events

04/13/2023 6

With Confio Ignite, You Find Root Cause of Waits Quickly

• Improve database performance by 65% with Confio Ignite– Installs in minutes– Puts no load on monitored servers– Identify bottlenecks and root causes of blocks like

these in minutes

Download Ignite trial for freewww.confio.com/freetrial