Manual Reference Pages - DEVEL::NYTPROF::APACHE (3)
Devel::NYTProf::Apache - Profile mod_perl applications with Devel::NYTProf
# in your Apache config file with mod_perl installed
If youre using virtual hosts with PerlOptions that include either
+Parent or +Clone then see VIRTUAL HOSTS below.
This module allows mod_perl applications to be profiled using
If the NYTPROF environment variable isnt set at the time
Devel::NYTProf::Apache is loaded then Devel::NYTProf::Apache will issue a
warning and default it to:
The file actually created by NTProf will also have the process id appended to
it because the addpid option is enabled by default.
See ENVIRONMENT VARIABLES in Devel::NYTProf for
more details on the settings effected by this environment variable.
Try using PerlPassEnv in your httpd.conf if you can set the NYTPROF
environment variable externally. Note that if you set the NYTPROF environment
variable externally then the file name obviously cant include the parent
process id. For example, to set stmts=0 externally, use:
Each profiled mod_perl process will need to have terminated cleanly before you can
successfully read the profile data file. The simplest approach is to start the
httpd, make some requests (e.g., 100 of the same request), then stop it and
process the profile data.
Alternatively you could send a TERM signal to the httpd worker process to
terminate that one process. The parent httpd process will start up another one
for you ready for more profiling.
Its usually a good idea to use just one child process when profiling, which you
can do by setting the MaxClients to 1 in httpd.conf.
Set MaxRequestsPerChild to 0 to avoid worker processes exiting and
restarting during the profiling, which would split the profile data across
Using an IfDefine blocks lets you leave the profile configuration in place
and enable it whenever its needed by adding -D NYTPROF to the httpd startup
With that configuration you should get two profile files, one for the parent
process and one for the worker.
If your httpd configuration includes virtual hosts with PerlOptions that
include either +Parent or +Clone then mod_perl2 will create a new perl
interpreter to handle requests for that virtual host.
This causes some issues for profiling.
If Devel::NYTProf::Apache is loaded in the top-level configuration then
activity in any virtual hosts that use their own perl interpreter wont be
profiled. Normal virtual hosts will be profiled just fine.
You can profile a single virtual host that uses its own perl interpreter by
loading Devel::NYTProf::Apache inside the configuration for that virtual
host. In this case do not use PerlModule directive. You need to use
a Perl directive instead, like this:
<Perl> use Devel::NYTProf::Apache; </Perl>
Profiling mod_perl on Windows is not supported because NYTProf currently
doesnt support threads.
Truncated profile: Profiles for large applications can take a while to write to
the disk. Allow sufficient time after stopping apache, or check the process has
actually exited, before trying to read the profile.
Truncated profile: The mod_perl child_terminate() function terminates the child
without giving perl an opportunity to cleanup. Since Devel::NYTProf::Apache
doesnt intercept the mod_perl child_terminate() function (yet) the profile
will be corrupted if its called. Youre most likely to encounter this when
using Apache::SizeLimit, so you may want to disable it while profiling.
<B>Adam KaplanB>, <akaplan at nytimes.com>
Tim Bunce, <http://www.tim.bunce.name> and <http://blog.timbunce.org>
<B>Steve PetersB>, <steve at fisharerojo.org>
COPYRIGHT AND LICENSE
Copyright (C) 2008 by Adam Kaplan and The New York Times Company.
Copyright (C) 2008 by Steve Peters.
Copyright (C) 2008-2012 by Tim Bunce.
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.8 or,
at your option, any later version of Perl 5 you may have available.
|perl v5.20.3 ||DEVEL::NYTPROF::APACHE (3) ||2015-05-10 |
Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.