feumw has asked for the wisdom of the Perl Monks concerning the following question:

We're facing performance issues in our CMS and we can't find a reason for it. We're using a CMS which is written in Perl and running on our Apache using mod_perl. So my take was to profile and see what's going on.

I got the Apache running and Devel::NYTProf::Apache logging, the issue here is: the profiling does not profile the CMS itself. Since the CMS is using mod_perl I need to profile all Perl modules used by the CMS.

Our Apache is configured with a httpd.conf and two virtual hosts. Both used for the CMS.
First take was: Setting Devel::NYTProf::Apache up in my VHost.
Second take was: Setting Devel::NYTProf::Apache up in my httpd.conf.
Third take was: Setting Devel::NYTProf::Apache up in my httpd.conf while only having my httpd.conf (disabled all vhosts).

No difference in the results. This screenshot may helps to understand what I'm looking for: https://ibb.co/0rkgrGL

On the left side are the results I'm always getting. On the right side you see completely different modules. And all those modules on the right side are missing in the profiling on Apache. The right side of the screenshot is done while profiling on a different webserver. The CMS provides an own perl-based webserver which can be uses for debugging.

Does anyone around here know how to proper use Devel::NYTProf::Apache and can help me out?

If you need me to share any configurations, just let me know.
  • Comment on Devel::NYTProf::Apache does not profile our CMS

Replies are listed 'Best First'.
Re: Devel::NYTProf::Apache does not profile our CMS
by Corion (Patriarch) on Mar 01, 2021 at 08:36 UTC

    Have you looked at whether the CMS is maybe always running its own webserver and Apache is mostly running as a reverse proxy in front of the CMS?

    Without seeing the configuration, and knowing more about the CMS in question, and how it actually works/runs, it's hard to give any kind of advice.

      The CMS is running on our apache. This perl-based webserver they provide is only used for debugging and not more. I can assure this 100%.
      It's hard to put all information in a question. I could post the apache configurations if that could help. Basically for this CMS you have to install a webserver (in our case apache) and mod_perl. That's it. In the configuration, setup sources where perl should look for Packages and you're ready o go. That's why I tried to simplify the question as much as possible.
      Basically I just want to use NYTProf on a webserver and profile everything, even if it runs "inside" mode_perl.

      Update: The CMS is called "Imperia". To run the CMS you have to extract the CMS itself and add

      PerlOptions +Parent PerlModule Apache2::RequestRec PerlModule Apache2::compat <Perl> unshift @INC, '/mycms/develop/site/modules/core'; unshift @INC, '/mycms/develop/site/modules/collection'; unshift @INC, '/mycms/develop/site/modules/fallback'; </Perl> <Location ~ "/imp($|/)"> SetHandler modperl PerlResponseHandler Imperia::Core::Backends::ModPerl20 </Location>
      to your webserver configuration. To get NYTProf running I added
      PerlSetEnv NYTPROF file=/mycms/nyt/prof.out <Perl> use Devel::NYTProf::Apache; </Perl>
      as well.

      So I don't think the issue is related to the CMS. It's more like a general issue that I don't get subroutines and stuff profiled which is using mod_perl. That's why I tried to simplify the question.