forked from gggeek/ezperformancelogger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
INSTALL
152 lines (109 loc) · 6.7 KB
/
INSTALL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
Installation instructions
=========================
1. enable the extension; clear all caches (at least the ini and template caches)
For performance logging
-----------------------
2. edit ezperformancelogger.ini to decide the data you want to log:
parameter [GeneralSettings]/TrackVariables
See file README for more details about available data.
Note that depending on the variables you want to log, you might have to alter
the [GeneralSettings]/VariableProviders parameter as well.
NB: db_queries logging by default only works with ez debug on.
3. edit ezperformancelogger.ini to decide how to log it:
a. using Apache
to add perf data to the Apache access log, customize your Apache configuration
taking as example the sample_httpd.conf file in the doc directory.
It is recommended not to enable collection of execution time via
TrackVariables when using Apache, but to rely on the more precise native
measure obtained with %D
Remember to restart Apache after changing its configuration
b. using odoscope, piwik or google analytics
the perf data is logged directly to the analytics engine database, via usage
of "custom variables" (ie. we add the perf data to the js call done for visit
tracking). For all of these tools, you will need to insert in your pagelayout
template the standard javascript tracking code; the extension will transform
it as appropriate to add the extra data.
For ga, only the async tag is supported.
NB: data reported via odoscope, piwik or google analytics will not be accurate
if your website is using a caching reverse proxy or cdn. Please use tha apache-log
configuration in such case.
c. using a separate log file
this is useful if your webserver is Nginx, Lighttpd or IIS. In that case, the
extension can log perf data all by itself to a separate log. The name of that
file has to be configured in ezperformancelogger.ini; it can be written either
using the same format as Apache "extended" log, with perf counters data at the
end of the line, or in csv format
d. using statsd and graphite
this is useful if you have a lot of traffic, and want to be able to see nice
graphs, with drill-down / group / filter capability.
Steps are:
a. set up a graphite+statsd server
b. set up ezperformancelogger.ini
c. if using ezp >= 5, add a specific template tag in your pagelayout (see provided
tpl in the design/admin folder in this extension)
The main difference between graphite and other KPI graphing tools is the extensive
support for grouping data. To get most value out of it, the extension "rewrites" the
names of the measured KPIs when sending them to statsd, injecting by default the
content-class name and node-id. This way the graphite user could drill down, to see
f.e. the avg page-load-time across the whole site, then across all pages displaying
articles, then only for the article with node-id 635.
The way KPI names are rewritten for graphite can also be configured via ini settings.
e. using monolog, syslog etc...
read comments in ezperformancelogger.ini to find out more details about those
4. once logging of data is active, we recommend using a tool like httrack or
wget to scan your complete website and get an overview of the performance
of your web pages and identify the most resource-hungry ones.
A good idea is to run the scan both with eZ Publish caches on and off, to
measure the effectiveness of cache configuration.
NB: the extension does not provide any means to visualize the logged data.
You can use any tool from excel to matlab for that.
5. to log db performances with Debug Output disabled, uncomment the
appropriate line in settings/site.ini.append.php and use one of the db
connectors provided by the extension (currently only for eZP 4.5 to 4.7 on mysqli)
6. to log cluster-db performances with Debug Output disabled, uncomment the
appropriate lines in settings/file.ini.append.php and use one of the cluster db
connectors provided by the extension (currently only for eZP 4.5 to 4.7 on mysqli)
7. to log performance data even on web pages which end prematurely or redirect
you need to patch the index.php file and add somewhere the following line:
eZExecution::addCleanupHandler( array( 'eZPerfLogger', 'cleanup' ) );
a good candidate location is next to the existing eZExecution::addCleanupHandler call.
For eZPublish 5.x, patch ezpkernelweb.php instead of index.php;
please note that in this case the measured data can be lower than expected,
you should also patch ezpkernelweb::runCallback() to avoid measuring data
via calls to eZPerfLogger::disable() and reenable()
8. you can also decide not to log data for every single request received, but only for
some of them. To this end, use the LogFilters option in ezperformancelogger.ini.
Filters provided within the extension allow to log slow pages, memory-hungry pages,
or a random subset of all pages.
For graphing performance indicators with Munin
----------------------------------------------
1. make sure you have a valid munin-node installation on your webserver
2. configure eZPerformanceLogger to record as many variables as you want (see
paragraph above).
The only constraint is that LOGGING TO CSV FILE HAS TO BE ENABLED (see point 4.c)
3. customize how the variables recorded by eZPerformanceLogger will show up
in Munin graphs by editing ini settings in the [MuninSettings] section of
ezperformancelogger.ini
4. activate the munin plugin provided within the extension.
Detailed instructions for this step you will find in the file
bin/scripts/ezmuninperflogger_
For graphing performance indicators with Graphite
-------------------------------------------------
See point 3.d above
For profiling
-------------
1. make sure the XHProf PECL extension is installed and active
2. give to the user account that will be used for viewing profiling data permissions
to execute hxprof/view
3. edit your config.php file and add the following lines at the top:
(if you miss the config.php file, copy config.php-RECOMMENDED into config.php)
include( 'extension/ezperformancelogger/classes/ezxhproflogger.php' );
eZXHProfLogger::start();
in alternative, you can start profiling from anywhere in your php code
4. edit design.ini in extension/ezperformacelogger/settings, and uncomment the
lines corresponding to your eZ version
5. view any website page: a link to its profiling info is at the bottom of the debug output
6. in the Admin Interface, in the Setup tab, you will find a link to a page listing
all available profiling data for viewing.
7. all profiling data is stored permanently on disk, in var/log/xhprof. To avoid
filling the hard-disk, please schedule execution of the removexhprofdata cronjob