.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Devel::NYTProf::Apache 3pm" .TH Devel::NYTProf::Apache 3pm "2018-11-02" "perl v5.28.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Devel::NYTProf::Apache \- Profile mod_perl applications with Devel::NYTProf .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& # in your Apache config file with mod_perl installed \& PerlPassEnv NYTPROF \& PerlModule Devel::NYTProf::Apache .Ve .PP If you're using virtual hosts with \f(CW\*(C`PerlOptions\*(C'\fR that include either \&\f(CW\*(C`+Parent\*(C'\fR or \f(CW\*(C`+Clone\*(C'\fR then see \*(L"\s-1VIRTUAL HOSTS\*(R"\s0 below. .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module allows mod_perl applications to be profiled using \&\f(CW\*(C`Devel::NYTProf\*(C'\fR. .PP If the \s-1NYTPROF\s0 environment variable isn't set \fIat the time Devel::NYTProf::Apache is loaded\fR then Devel::NYTProf::Apache will issue a warning and default it to: .PP .Vb 1 \& file=/tmp/nytprof.$$.out:addpid=1:endatexit=1 .Ve .PP The file actually created by NTProf will also have the process id appended to it because the \f(CW\*(C`addpid\*(C'\fR option is enabled by default. .PP See \*(L"\s-1ENVIRONMENT VARIABLES\*(R"\s0 in Devel::NYTProf for more details on the settings effected by this environment variable. .PP Try using \f(CW\*(C`PerlPassEnv\*(C'\fR in your httpd.conf if you can set the \s-1NYTPROF\s0 environment variable externally. Note that if you set the \s-1NYTPROF\s0 environment variable externally then the file name obviously can't include the parent process id. For example, to set stmts=0 externally, use: .PP .Vb 1 \& NYTPROF=file=/tmp/nytprof.out:out:addpid=1:endatexit=1:stmts=0 .Ve .PP 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. .PP Alternatively you could send a \s-1TERM\s0 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. .SS "Example httpd.conf" .IX Subsection "Example httpd.conf" It's usually a good idea to use just one child process when profiling, which you can do by setting the \f(CW\*(C`MaxClients\*(C'\fR to 1 in httpd.conf. .PP Set \f(CW\*(C`MaxRequestsPerChild\*(C'\fR to 0 to avoid worker processes exiting and restarting during the profiling, which would split the profile data across multiple files. .PP Using an \f(CW\*(C`IfDefine\*(C'\fR blocks lets you leave the profile configuration in place and enable it whenever it's needed by adding \f(CW\*(C`\-D NYTPROF\*(C'\fR to the httpd startup command line. .PP .Vb 5 \& \& MaxClients 1 \& MaxRequestsPerChild 0 \& PerlModule Devel::NYTProf::Apache \& .Ve .PP With that configuration you should get two profile files, one for the parent process and one for the worker. .SH "VIRTUAL HOSTS" .IX Header "VIRTUAL HOSTS" If your httpd configuration includes virtual hosts with \f(CW\*(C`PerlOptions\*(C'\fR that include either \f(CW\*(C`+Parent\*(C'\fR or \f(CW\*(C`+Clone\*(C'\fR then mod_perl2 will create a new perl interpreter to handle requests for that virtual host. This causes some issues for profiling. .PP If \f(CW\*(C`Devel::NYTProf::Apache\*(C'\fR is loaded in the top-level configuration then activity in any virtual hosts that use their own perl interpreter won't be profiled. Normal virtual hosts will be profiled just fine. .PP You can profile a \fIsingle\fR virtual host that uses its own perl interpreter by loading \f(CW\*(C`Devel::NYTProf::Apache\*(C'\fR \fIinside the configuration for that virtual host\fR. In this case \fIdo not\fR use \f(CW\*(C`PerlModule\*(C'\fR directive. You need to use a \f(CW\*(C`Perl\*(C'\fR directive instead, like this: .PP .Vb 5 \& \& ... \& use Devel::NYTProf::Apache; \& ... \& .Ve .SH "LIMITATIONS" .IX Header "LIMITATIONS" Profiling mod_perl on Windows is not supported because NYTProf currently doesn't support threads. .SH "TROUBLESHOOTING" .IX Header "TROUBLESHOOTING" 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. .PP Truncated profile: The mod_perl \fBchild_terminate()\fR function terminates the child without giving perl an opportunity to cleanup. Since \f(CW\*(C`Devel::NYTProf::Apache\*(C'\fR doesn't intercept the mod_perl \fBchild_terminate()\fR function (yet) the profile will be corrupted if it's called. You're most likely to encounter this when using Apache::SizeLimit, so you may want to disable it while profiling. .SH "SEE ALSO" .IX Header "SEE ALSO" Devel::NYTProf .SH "AUTHOR" .IX Header "AUTHOR" \&\fBAdam Kaplan\fR, \f(CW\*(C`\*(C'\fR \&\fBTim Bunce\fR, and \&\fBSteve Peters\fR, \f(CW\*(C`\*(C'\fR .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" .Vb 3 \& 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. .Ve .PP 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.