mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-02-02 10:00:38 +01:00
Update Trace API spec
This commit is contained in:
parent
cbab35e197
commit
4b98181618
@ -1,5 +1,5 @@
|
|||||||
Performance analysis with Firebird.
|
Performance analysis with Firebird.
|
||||||
Document version 0.1
|
Document version 0.2
|
||||||
Created by Nickolay Samofatov
|
Created by Nickolay Samofatov
|
||||||
|
|
||||||
Performance monitoring framework is consisted of 2 parts:
|
Performance monitoring framework is consisted of 2 parts:
|
||||||
@ -9,43 +9,55 @@ Performance monitoring framework is consisted of 2 parts:
|
|||||||
|
|
||||||
Trace API.
|
Trace API.
|
||||||
|
|
||||||
Trace API allows to plug a monitoring module into the engine and notify it
|
Trace API allows to plug a monitoring module into the engine and notify it of
|
||||||
of processes happening there. List of analysis plugins is specified in
|
processes happening there. List of analysis plugins is specified in firebird.conf
|
||||||
firebird.conf parameter TracePlugins. Each trace plugin receives notifications
|
parameter TracePlugins. Each trace plugin receives notifications on each database
|
||||||
on each database attached as a call of procedure having following signature:
|
opened by the engine as a call of procedure having following signature:
|
||||||
|
|
||||||
ISC_STATUS trace_attach(ISC_STATUS* status, TraceDatabase* db);
|
NTRACE_BOOLEAN trace_attach(const char* db_filename, const TracePlugin** plugin);
|
||||||
|
|
||||||
Conceptually db is the database trace interface, but it is implemented as a
|
Conceptually TracePlugin is the plugin trace interface. It is implemented as a
|
||||||
structure of function pointers and void* object pointer.
|
structure of function pointers and void* object pointer to be passed as first
|
||||||
|
argument for each function.
|
||||||
|
|
||||||
Given this interface plugin may install hooks for particular events and receive
|
Given this interface plugin may install hooks for particular events and receive
|
||||||
notifications on them. In fact, set of hooks is also implemented as a structure
|
notifications for them. If plugin has interest in some kind of events for given
|
||||||
with function pointers.
|
database it sets plugin pointer to a structure containing non-null hook function
|
||||||
|
pointers and returns NTRACE_TRUE value. Otherwise it should return NTRACE_FALSE.
|
||||||
|
|
||||||
See ntrace.h module for definitions of these structures and events supported.
|
One category of hooks receives the same parameters as corresponding Y-Valve
|
||||||
|
(public API) methods plus internal objects identifiers, generated PLANs for
|
||||||
|
statements and performance counters. One more hook receives performance
|
||||||
|
statistics for each procedure execution.
|
||||||
|
|
||||||
|
Each hook function returns boolean value indicating success or failure. When hook
|
||||||
|
function fails engine collects error message from plugin in the same thread
|
||||||
|
context as hook was called, writes message to firebird.log and stops calling
|
||||||
|
hooks for this particular database and trace plugin.
|
||||||
|
|
||||||
|
See jrd/ntrace.h module for definitions of structures and events supported.
|
||||||
|
|
||||||
|
|
||||||
Default analysis module.
|
Default analysis module.
|
||||||
|
|
||||||
Reference implementation of analysis plugin is centered around a concept of
|
Reference implementation of analysis plugin is centered around a concept of
|
||||||
performance snapshot. Snapshot detail may vary, but in any case it contains
|
performance snapshot. Snapshot detail may vary, but in any case it contains
|
||||||
information on all activities performed by server during a given period of time,
|
information on all activities performed by server for database during a given
|
||||||
possibly in aggregated form. All snapshots may be compared to allow quanititive
|
period of time, possibly in aggregated form. All snapshots may be compared to
|
||||||
measurements of performance improvements due to various optimization activities
|
allow quanititive measurements of performance improvements due to various
|
||||||
or changes in user applications and infrastucture.
|
optimization activities or changes in user applications and infrastucture.
|
||||||
|
|
||||||
Snapshot data is collected by trace module in raw form in a binary log file and
|
Snapshot data is collected by trace module in raw form in a binary log file and
|
||||||
then may be loaded into a stats database using ntrace utility.
|
then may be loaded into a stats database using ntrace utility.
|
||||||
|
|
||||||
Stored snapshots may contain data on usage of indices, statements executed,
|
Stored snapshots may contain data on usage of indices, statements executed, their
|
||||||
their plans and performance counters, IO statistics and other performance data.
|
plans and performance counters, IO statistics and other performance data.
|
||||||
|
|
||||||
Level of detail for information collected is set up in analysis trace module
|
Level of detail for information collected is set up in analysis trace module
|
||||||
configuration file on per-database basis.
|
configuration file on per-database basis.
|
||||||
|
|
||||||
Default analysis module does not have GUI and only provides a database with
|
Default analysis module does not have GUI and only provides a database with data
|
||||||
data on server activities and some stored procedures to use and maintain it.
|
on server activities and some stored procedures to use and maintain it.
|
||||||
|
|
||||||
It is expected that third parties develop GUI tools, custom trace modules and
|
It is expected that third parties develop GUI tools, custom trace modules and
|
||||||
statistics tools to statisfy rich client needs.
|
statistics tools to statisfy rich client needs.
|
||||||
|
Loading…
Reference in New Issue
Block a user