Most important "trick" of performance instrumentation

32
The most important trick of performance instrumentation Cary Millsap Accenture Enkitec Group and Method R Corporation @CaryMillsap OakTable World 2014 San Francisco, California 12:50p–1:00p Monday 29 September 2014 © 2014 Method R Corporation 1 TM MeTHOD R TM

description

This is the material from my 10-minute TED-style talk 2014-09-29 at OakTable World held in conjunction with Oracle OpenWorld 2014 in San Francisco. It explains the importance of assigning a unique id to the Oracle Database code path associated with each performance experience that users can have with your system

Transcript of Most important "trick" of performance instrumentation

Page 1: Most important "trick" of performance instrumentation

The  most  important  trick  of  performance  instrumentation

Cary  MillsapAccenture  Enkitec  Group  and  Method  R  Corporation

@CaryMillsap

OakTable  World  2014  ·∙  San  Francisco,  California12:50p–1:00p  Monday  29  September  2014

©  2014  Method  R  Corporation

1

TMMeTHOD RTM

Page 2: Most important "trick" of performance instrumentation

@CaryMillsap

Performance is not an attribute of a system.

2

Page 3: Most important "trick" of performance instrumentation

@CaryMillsap

ID USERNAME MODULE START_TIME R SLR-- -------- ------- -------------------------- ----- --- 1 FCHANG OE BOOK 2014-09-15T08:14:22.189533 2.019 2.0 2 RSMITH OE SHIP 2014-09-15T08:14:23.673849 3.528 5.0 3 DJOHNSON OE PICK 2014-09-15T08:15:01.938816 1.211 5.0 4 FFORBES OE BOOK 2014-09-15T08:17:23.815511 0.716 2.5 5 FCHANG OE BOOK 2014-09-15T08:17:24.032562 1.917 2.5 6 LBUMONT PA MTCH 2014-09-15T08:17:42.019328 1.305 2.0

3

This  thing  called  an  experience...

#define FAST (R ≤ SLR)

Page 4: Most important "trick" of performance instrumentation

@CaryMillsap

ID USERNAME MODULE R SLR FAST?-- -------- ------- ----- --- ----- 1 FCHANG OE BOOK 2.019 2.0 N 2 RSMITH OE SHIP 3.528 5.0 Y 3 DJOHNSON OE PICK 1.211 5.0 Y 4 FFORBES OE BOOK 0.716 2.5 Y 5 FCHANG OE BOOK 1.917 2.5 Y 6 LBUMONT PA MTCH 1.305 2.0 Y

4

This  thing  called  an  experience...

#define FAST (R ≤ SLR)

Page 5: Most important "trick" of performance instrumentation

@CaryMillsap

Performance is an attribute ofeach individual experience

with a system.

5

Page 6: Most important "trick" of performance instrumentation

@CaryMillsap 6

TASK• id• name• ...

EXPERIENCE• id• task-id• user-id• ip-address• start-time• end-time• ERROR-code• WORK-done

SQL• ID• Task-id• ...

N

1

N

1

Page 7: Most important "trick" of performance instrumentation

@CaryMillsap

The “trick”...

7

Page 8: Most important "trick" of performance instrumentation

@CaryMillsap

Each experience gets its own

unique id.8

Page 9: Most important "trick" of performance instrumentation

@CaryMillsap

That’s  it.

9

Page 10: Most important "trick" of performance instrumentation

@CaryMillsap

Each experience gets its own

unique id.10

Page 11: Most important "trick" of performance instrumentation

@CaryMillsap

You  need  to  see  this  experience  id  in

your  session’s  v$  dataand  your  trace  data.

11

❶❷

Page 12: Most important "trick" of performance instrumentation

@CaryMillsap

Implementation?

12

Page 13: Most important "trick" of performance instrumentation

@CaryMillsap 13

UNDERCONSTRUCTION

T

Page 14: Most important "trick" of performance instrumentation

@CaryMillsap

dbms_application_info.set_module( module_name => 'OE BOOK', action_name => sys_guid() -- 32-char hex string);

-- Your ‘book order’ code

dbms_application_info.set_module( module_name => null, action_name => null);

14

SQL, PL/SQL

Page 15: Most important "trick" of performance instrumentation

@CaryMillsap

conn.ModuleName = "OE BOOK";conn.ActionName = Guid.NewGuid().toString();

// Your ‘book order’ code

conn.ModuleName = "";conn.ActionName = "";

ODP.NET

15

Page 16: Most important "trick" of performance instrumentation

@CaryMillsap

String metrics[] = new String[OraCxn.END_TO_END_STATE_INDEX_MAX];

metrics[END_TO_END_MODULE_INDEX] = "OE BOOK";metrics[END_TO_END_ACTION_INDEX] = UUID.randomUUID().toString();conn.setEndToEndMetrics(metrics, (short) 0);

// Your ‘book order’ code

metrics[END_TO_END_MODULE_INDEX] = "";metrics[END_TO_END_ACTION_INDEX] = "";conn.setEndToEndMetrics(metrics, (short) 0);

16

Java, ADF

Page 17: Most important "trick" of performance instrumentation

17

Page 18: Most important "trick" of performance instrumentation

setClientInfo method supports JDBC DMS metrics

setEndToEndMetrics is deprecated

DBOP tag can be associated with application thread

18

New in 12.1

Page 19: Most important "trick" of performance instrumentation

19

Oh, and...

module and action lengths are limited by JDBC

(Thanks Lasse Jenssen)

Page 20: Most important "trick" of performance instrumentation

@CaryMillsap

Postscript

A  UUID  in  canonical  form  is  36  characters  long  (32  lowercase  hexadecimal  characters  and  4  hyphens).  However,  v$session.action  is  VARCHAR2(32),  so  either  we  need  to  perform  a  more  sophisticated  transformation  than  toString  upon  the  UUID  (such  as  to  remove  the  hyphens),  or  we  have  to  choose  another  column  in  which  to  store  it.

We’re  also  investigating  whether  the  new  12.1  begin_operation  function  and  end_operation  procedure  in  dbms_sql_monitor  will  accomplish  our  goal  of  assigning  a  unique  id  to  each  end-­‐user  experience.  The  material  at  http://docs.oracle.com/database/121/TGSQL/tgsql_monit.htm#TGSQL789  and  http://docs.oracle.com/database/121/ARPLS/d_sql_monitor.htm#ARPLS74779  looks  promising.

The  combination  of  dbop_name  and  dbop_eid  should  be  unique,  but  to  meet  my  needs,  these  elements  would  have  to  render  into  the  session’s  trace  data.

These  are  the  kinds  of  things  we’re  working  on.

20

Page 21: Most important "trick" of performance instrumentation

@CaryMillsap

What you get

21

Page 22: Most important "trick" of performance instrumentation

@CaryMillsap 22

USERNAME MODULE_NAME ACTION_NAME START_TIME-------- ----------- -------------------------------- ----------FCHANG OE BOOK 4a782ce58c4c462990547500d2fd308d 2014-09-15RSMITH OE SHIP 990a5426012841fa83c0cfa3690fad54 2014-09-15DJOHNSON OE PICK 9d92d1cceb87405f94a04d0224e1c7c4 2014-09-15FFORBES OE BOOK 2c920fc0fb91473ab4c141423e450715 2014-09-15FCHANG OE BOOK 396f1348b5364d578e1815e74e910b43 2014-09-15LBUMONT PA MTCH 7ddbf894941549e9b91b036947cb7328 2014-09-15

experience  id  (PK)

Page 23: Most important "trick" of performance instrumentation

@CaryMillsap 23

DBMS_MONITOR.SERV_MOD_ACT_TRACE_ENABLE( MODULE_NAME => 'OE BOOK', ACTION_NAME => ANY_ACTION // default)

USERNAME MODULE_NAME ACTION_NAME START_TIME-------- ----------- -------------------------------- ----------FCHANG OE BOOK 4a782ce58c4c462990547500d2fd308d 2014-09-15RSMITH OE SHIP 990a5426012841fa83c0cfa3690fad54 2014-09-15DJOHNSON OE PICK 9d92d1cceb87405f94a04d0224e1c7c4 2014-09-15FFORBES OE BOOK 2c920fc0fb91473ab4c141423e450715 2014-09-15FCHANG OE BOOK 396f1348b5364d578e1815e74e910b43 2014-09-15LBUMONT PA MTCH 7ddbf894941549e9b91b036947cb7328 2014-09-15

Page 24: Most important "trick" of performance instrumentation

@CaryMillsap

*** CLIENT ID:(10.17.21.198 FCHANG) ...*** MODULE NAME:(OE BOOK) ...*** ACTION NAME:(4a782ce58c4c462990547500d2fd308d) ...PARSE ...EXEC ...WAIT ......

*** CLIENT ID:(10.17.22.57 FFORBES) ...*** MODULE NAME:(OE BOOK) ...*** ACTION NAME:(2c920fc0fb91473ab4c141423e450715) ...PARSE ...WAIT ...EXEC ......

*** CLIENT ID:(10.17.22.241 FCHANG) ...*** MODULE NAME:(OE BOOK) ...*** ACTION NAME:(396f1348b5364d578e1815e74e910b43) ...EXEC ...WAIT ...FETCH ......

24

Page 25: Most important "trick" of performance instrumentation

@CaryMillsap

*** CLIENT ID:(10.17.21.198 FCHANG) ...*** MODULE NAME:(OE BOOK) ...*** ACTION NAME:(4a782ce58c4c462990547500d2fd308d) ...PARSE ...EXEC ...WAIT ......

*** CLIENT ID:(10.17.22.57 FFORBES) ...*** MODULE NAME:(OE BOOK) ...*** ACTION NAME:(2c920fc0fb91473ab4c141423e450715) ...PARSE ...WAIT ...EXEC ......

*** CLIENT ID:(10.17.22.241 FCHANG) ...*** MODULE NAME:(OE BOOK) ...*** ACTION NAME:(396f1348b5364d578e1815e74e910b43) ...EXEC ...WAIT ...FETCH ......

25

4a782ce5...4a782ce5...4a782ce5...4a782ce5...

2c920fc0...2c920fc0...2c920fc0...2c920fc0...

396f1348...396f1348...396f1348...396f1348...

ACTION Trace file line------------- -----------------------------------------------------------

Page 26: Most important "trick" of performance instrumentation

@CaryMillsap

$ mrskew --group='"$act $mod $client_id"' ... --top=10 *trc

ACTION MODULE CLIENT_ID DURATION % CALLS MEAN MIN MAX--------------------------------------------------------------- --------- ------ ------ -------- -------- --------c9a65ad7c62a4de9bb4ad118d9a5eda3 OE BOOK 10.17.23.41 AGREEN 3.162362 3.6% 604 0.005236 0.000000 0.135835b4748d88eea44d81a406e341ea36548f OE BOOK 10.17.22.14 GLAMB 3.115821 3.5% 604 0.005159 0.000000 0.280440f685757c77dd4b15a15d8ce811ee7390 OE BOOK 10.17.23.163 YJUSTICE 1.000578 1.1% 604 0.001657 0.000000 0.0272025d14953834e74063836678babf51e072 OE BOOK 10.17.22.227 USILVA 0.942317 1.1% 604 0.001560 0.000000 0.050971390c18ebfcd84e418b004c71bb3c0589 OE BOOK 10.17.21.63 WEVANS 0.914806 1.0% 604 0.001515 0.000000 0.0305532e5316d0cff448afa5f20de22c044409 OE BOOK 10.17.23.68 VMAYNARD 0.864778 1.0% 604 0.001432 0.000000 0.0402813db7b83fdad34b4289ca06cffaa5e711 OE BOOK 10.17.23.212 JSTRONG 0.786390 0.9% 604 0.001302 0.000000 0.050243f0135a649e124aefb8fb8069bb5bc16d OE BOOK 10.17.22.25 RHOPPER 0.780173 0.9% 604 0.001292 0.000000 0.03142093ff740851704d6dbcac5579e585dd61 OE BOOK 10.17.22.219 FWALLACE 0.758373 0.9% 604 0.001256 0.000000 0.034323ff784d033478490b899b5d04814a1ca8 OE BOOK 10.17.21.246 FROWLAND 0.750675 0.9% 604 0.001243 0.000000 0.0283642,275 others 75.188801 85.2% 10,915 0.006889 0.000000 0.181656-------------------------------------------------------------- --------- ------ ------ -------- -------- --------TOTAL (2,285) 88.265074 100.0% 16,955 0.005206 0.000000 0.280440

26

Page 27: Most important "trick" of performance instrumentation

@CaryMillsap

$ mrskew --group='"$act $mod $client_id"' ... --top=10 *trc

ACTION MODULE CLIENT_ID DURATION % CALLS MEAN MIN MAX-------------------------------------------------------------- --------- ------ ------ -------- -------- --------c9a65ad7c62a4de9bb4ad118d9a5eda3 OE BOOK 10.17.23.41 AGREEN 3.162362 3.6% 604 0.005236 0.000000 0.135835b4748d88eea44d81a406e341ea36548f OE BOOK 10.17.22.14 GLAMB 3.115821 3.5% 604 0.005159 0.000000 0.280440f685757c77dd4b15a15d8ce811ee7390 OE BOOK 10.17.23.163 YJUSTICE 1.000578 1.1% 604 0.001657 0.000000 0.0272025d14953834e74063836678babf51e072 OE BOOK 10.17.22.227 USILVA 0.942317 1.1% 604 0.001560 0.000000 0.050971390c18ebfcd84e418b004c71bb3c0589 OE BOOK 10.17.21.63 WEVANS 0.914806 1.0% 604 0.001515 0.000000 0.0305532e5316d0cff448afa5f20de22c044409 OE BOOK 10.17.23.68 VMAYNARD 0.864778 1.0% 604 0.001432 0.000000 0.0402813db7b83fdad34b4289ca06cffaa5e711 OE BOOK 10.17.23.212 JSTRONG 0.786390 0.9% 604 0.001302 0.000000 0.050243f0135a649e124aefb8fb8069bb5bc16d OE BOOK 10.17.22.25 RHOPPER 0.780173 0.9% 604 0.001292 0.000000 0.03142093ff740851704d6dbcac5579e585dd61 OE BOOK 10.17.22.219 FWALLACE 0.758373 0.9% 604 0.001256 0.000000 0.034323ff784d033478490b899b5d04814a1ca8 OE BOOK 10.17.21.246 FROWLAND 0.750675 0.9% 604 0.001243 0.000000 0.0283642,275 others 75.188801 85.2% 10,915 0.006889 0.000000 0.181656-------------------------------------------------------------- --------- ------ ------ -------- -------- --------TOTAL (2,285) 88.265074 100.0% 16,955 0.005206 0.000000 0.280440

$ mrskew --where='$act eq "c9a65ad7c62a4de9bb4ad118d9a5eda3"' *trc

CALL-NAME DURATION % CALLS MEAN MIN MAX--------------------------- -------- ------ ----- -------- -------- --------SQL*Net message from client 3.161922 100.0% 201 0.015731 0.001619 0.135835SQL*Net message to client 0.000440 0.0% 201 0.000002 0.000000 0.000027FETCH 0.000000 0.0% 201 0.000000 0.000000 0.000000EXEC 0.000000 0.0% 1 0.000000 0.000000 0.000000--------------------------- -------- ------ ----- -------- -------- --------TOTAL (4) 3.162362 100.0% 604 0.005236 0.000000 0.135835

27

Page 28: Most important "trick" of performance instrumentation

@CaryMillsap

Each experience gets its own

unique id.28

Page 29: Most important "trick" of performance instrumentation

@CaryMillsap

...So you can

measure and diagnose

what people feel.

29

Page 30: Most important "trick" of performance instrumentation

@CaryMillsap

...So you can

measure and diagnose

performance.

30

Page 31: Most important "trick" of performance instrumentation

@CaryMillsap

For  more...http://amzn.to/173bpzg  

31

Page 32: Most important "trick" of performance instrumentation

@CaryMillsap

Fin

32