APEX Performance Analyse DOAG 2018 Peter Raganitsch @PeterRaganitsch peter.raganitsch@foex.at
Tools Tools Tools
Activity Log Browser Developer Tools APEX Debug Trace Hierarchical Profiler
Co-Founder of FOEX
How to measure: Page Load
DB Time
Network Time
Client Time
= Total Time User waits
Stop Watch?
Browser Developer Tools
Google Chrome
Firefox
Safari
TTFB = Time to first Byte = DB-Time+Network-Time
(Page) Load = DB-Time+Network-Time+Client-Time
Network tab explained in detail
Save as HAR (HTTP Archive)
Review HAR Files Some Browser Developer Tools (eg. Firefox) also support loading HAR files and displaying their content
Activity Log
View APEX_WORKSPACE_ACTIVITY_LOG
View APEX_WORKSPACE_ACTIVITY_LOG
App Builder has many predefined Activity Reports
App Builder has many predefined Activity Reports
Logging can be deactivated
APEX Debug
Activate Debug in APEX as Developer
Activate Debug in APEX f?p=app:page:session::yes/levelx::: OR APEX_DEBUG.enable(p_level) OR APEX_SESSION.set_debug(p_session_id,p_level) debug messages are logged into internal rolling tables will be purged after x days (default 14)
Instance wide Debug Scripts @d0..activates/deactivates debug level 9 - instance wide @d1..lists debug sessions @d2 <id>. opens editor with debug details!attention! Every APEX session on the DB is debugged!!
View Debug Output
View Debug Output
Debug Overview
Debug Detail Information
View Debug Output
Debug Level 9 also shows the plan of executed queries
Trace
Activate Trace Mode in APEX f?p=app:page:session:::::&p_trace=yes OR APEX_SESSION.set_trace(p_session_id, SQL ) activates events (10046 trace name context forever, level 12) writes a message into APEX Debug log with the trace file identifier (as of APEX 18.1)
Trace File Identifier logged in APEX Debug *as of APEX 18.1. **APEX 19.1 will also include trace file name
Programmatically activate Trace in PL/SQL Attention! This can generate tons of trace files. Will be called for every page render/submit/ajax!!!
Get Trace File Name (new in 12.2)
Get Trace File Content (12.2)
TKPROF or SQL Developer
TKPROF or SQL Developer
Enable/Disable Trace Instance wide APEX_INSTANCE_ADMIN.set_parameter( ENABLE_TRACE, N );
Hierarchical Profiler
The PL/SQL Hierarchical Profiler
Activate HPROF in APEX f?p=app:page:session:::::&p_trace=hprof OR APEX_SESSION.set_trace(p_session_id, HPROF ) activates sys.dbms_hprof.start_profiling writes a message into APEX Debug log with the hprof file name (as of APEX 18.1)
Programmatically activate HPROF in PL/SQL
HPROF in APEX needs some setup at first setup directory and grant privileges SQL> conn / as sysdba SQL> create directory tmp as '/tmp'; SQL> grant read,write on directory tmp to APEX_xxxxxx; SQL> grant execute on dbms_hprof to APEX_xxxxxx; SQL> grant execute on dbms_hprof to <parsing-schema>; configure profile directory SQL> conn APEX_xxxxxx/... SQL> exec wwv_flow_instance_admin.set_parameter('hprof_directory','tmp');
HPROF creates files on the DB Server
File content - not very readable
Convert HPROF.trc File to readable output plshprof -output report test.trc OR DBMS_HPROF.analyze('PLSHPROF_DIR', test.trc')
HTML Report
Visualize HPROF Output Data in APEX
Enable/Disable HPROF Instance wide APEX_INSTANCE_ADMIN.set_parameter( ENABLE_TRACE, N );
Helpful Links
More links and knowledge http://www.oracle-and-apex.com - my blog will feature more detailed posts on all those tools https://developers.google.com/web/tools/chrome-devtools/network-performance/ reference#analyze http://www.softwareishard.com/har/viewer/ https://docs.oracle.com/en/database/oracle/oracle-database/12.2/adfns/hierarchicalprofiler.html https://oracle-base.com/articles/11g/plsql-hierarchical-profiler-11gr1
Thanks! Follow FOEX: @FOEXplugins FOEXPlugins foex-gmbh