1Devel::NYTProf::Apache(U3s)er Contributed Perl DocumentatDieovnel::NYTProf::Apache(3)
2
3
4

NAME

6       Devel::NYTProf::Apache - Profile mod_perl applications with
7       Devel::NYTProf
8

SYNOPSIS

10         # in your Apache config file with mod_perl installed
11         PerlPassEnv NYTPROF
12         PerlModule Devel::NYTProf::Apache
13
14       If you're using virtual hosts with "PerlOptions" that include either
15       "+Parent" or "+Clone" then see "VIRTUAL HOSTS" below.
16

CAUTION

18       Use of "Devel::NYTProf::Apache" is officially discouraged.
19
20       The "Apache" module is not exercised anywhere in Devel-NYTProf's test
21       suite.  To do so would require an Apache/mod_perl environment, which in
22       turn would require a major redirection of developer efforts.  The code
23       may be perfectly sound -- so we're not officially deprecating it -- but
24       it was last modified in 2010.
25
26       If ...
27
28       1.  You are an experienced user of Devel-NYTProf;
29
30       2.  you can set up a development/testing environment with
31           Apache/mod_perl;
32
33       3.  can devise some tests that would demonstrate that
34           Devel::NYTProf::Apache works as intended; and
35
36       4.  would be willing to support it as an independent CPAN distribution,
37           then please let us know!
38

DESCRIPTION

40       This module allows mod_perl applications to be profiled using
41       "Devel::NYTProf".
42
43       If the NYTPROF environment variable isn't set at the time
44       Devel::NYTProf::Apache is loaded then Devel::NYTProf::Apache will issue
45       a warning and default it to:
46
47         file=/tmp/nytprof.$$.out:addpid=1:endatexit=1
48
49       The file actually created by NTProf will also have the process id
50       appended to it because the "addpid" option is enabled by default.
51
52       See "ENVIRONMENT VARIABLES" in Devel::NYTProf for more details on the
53       settings effected by this environment variable.
54
55       Try using "PerlPassEnv" in your httpd.conf if you can set the NYTPROF
56       environment variable externally.  Note that if you set the NYTPROF
57       environment variable externally then the file name obviously can't
58       include the parent process id. For example, to set stmts=0 externally,
59       use:
60
61           NYTPROF=file=/tmp/nytprof.out:out:addpid=1:endatexit=1:stmts=0
62
63       Each profiled mod_perl process will need to have terminated cleanly
64       before you can successfully read the profile data file. The simplest
65       approach is to start the httpd, make some requests (e.g., 100 of the
66       same request), then stop it and process the profile data.
67
68       Alternatively you could send a TERM signal to the httpd worker process
69       to terminate that one process. The parent httpd process will start up
70       another one for you ready for more profiling.
71
72   Example httpd.conf
73       It's usually a good idea to use just one child process when profiling,
74       which you can do by setting the "MaxClients" to 1 in httpd.conf.
75
76       Set "MaxRequestsPerChild" to 0 to avoid worker processes exiting and
77       restarting during the profiling, which would split the profile data
78       across multiple files.
79
80       Using an "IfDefine" blocks lets you leave the profile configuration in
81       place and enable it whenever it's needed by adding "-D NYTPROF" to the
82       httpd startup command line.
83
84         <IfDefine NYTPROF>
85             MaxClients 1
86             MaxRequestsPerChild 0
87             PerlModule Devel::NYTProf::Apache
88         </IfDefine>
89
90       With that configuration you should get two profile files, one for the
91       parent process and one for the worker.
92

VIRTUAL HOSTS

94       If your httpd configuration includes virtual hosts with "PerlOptions"
95       that include either "+Parent" or "+Clone" then mod_perl2 will create a
96       new perl interpreter to handle requests for that virtual host.  This
97       causes some issues for profiling.
98
99       If "Devel::NYTProf::Apache" is loaded in the top-level configuration
100       then activity in any virtual hosts that use their own perl interpreter
101       won't be profiled. Normal virtual hosts will be profiled just fine.
102
103       You can profile a single virtual host that uses its own perl
104       interpreter by loading "Devel::NYTProf::Apache" inside the
105       configuration for that virtual host. In this case do not use
106       "PerlModule" directive. You need to use a "Perl" directive instead,
107       like this:
108
109           <VirtualHost *:1234>
110               ...
111               <Perl> use Devel::NYTProf::Apache; </Perl>
112               ...
113           </VirtualHost>
114

LIMITATIONS

116       Profiling mod_perl on Windows is not supported because NYTProf
117       currently doesn't support threads.
118

TROUBLESHOOTING

120       Truncated profile: Profiles for large applications can take a while to
121       write to the disk. Allow sufficient time after stopping apache, or
122       check the process has actually exited, before trying to read the
123       profile.
124
125       Truncated profile: The mod_perl child_terminate() function terminates
126       the child without giving perl an opportunity to cleanup. Since
127       "Devel::NYTProf::Apache" doesn't intercept the mod_perl
128       child_terminate() function (yet) the profile will be corrupted if it's
129       called. You're most likely to encounter this when using
130       Apache::SizeLimit, so you may want to disable it while profiling.
131

SEE ALSO

133       Devel::NYTProf
134

AUTHOR

136       Adam Kaplan, "<akaplan at nytimes.com>" Tim Bunce,
137       <http://blog.timbunce.org> Steve Peters, "<steve at fisharerojo.org>"
138
140         Copyright (C) 2008 by Adam Kaplan and The New York Times Company.
141         Copyright (C) 2008 by Steve Peters.
142         Copyright (C) 2008-2012 by Tim Bunce.
143
144       This library is free software; you can redistribute it and/or modify it
145       under the same terms as Perl itself, either Perl version 5.8.8 or, at
146       your option, any later version of Perl 5 you may have available.
147
148
149
150perl v5.36.0                      2023-01-20         Devel::NYTProf::Apache(3)
Impressum