Refactoring Proposal: Eliminate TWiki's homegrown benchmark module Monitor.pm
Motivation
TWiki's homegrown Monitor.pm isn't too well documented and doesn't provide nice results. Better methods are readily available, and there's no reasonable chance to add all their features to Monitor.pm.
Description
The module
Monitor.pm and all references to it (including the environment variable
TWIKI_MONITOR) can be eliminated from the code. In all cases where the monitor can be used,
CPAN:Devel::NYTProf
provides better results.
- From the command line: Instead of
TWIKI_MONITOR=2 view Main.WebHome, you use perl -T -d:NYTProf view Main.WebHome.
- From CliRunnerContrib: Set
$runner->perlOptions('-T -dNYTProf').
- From Apache, there's a module CPAN:Devel::NYTProf::Apache
- I haven't figured out how to do this with TWiki's Monitor at all.
- Devel::NYTProf can also be used in a pure-perl webserver so that you can collect multiple requests in one measurement - I plan to extend the PSGI contrib to make that readily available.
Devel:NYTProf doesn't need any instrumentation in the code. The only downside is that it creates lots of output (ca. 1MB for one
view call from the commandline, and 28MB for the comprehensive, line-by-line,
HTML output).
--
HaraldJoerg - 2018-01-31
Impact and Available Solutions
Documentation
In the documentation, the description of TWiki's Monitor can be replaced by a short introduction to Devel::NYTProf, with pointers to the extensive documentation and guidelines in the web.
Implementation
There are a couple of places which refer to the environment variable
TWIKI_MONITOR or call
Monitor::MARK, these can be eliminated.
The module itself would no longer be necessary.
The performance imrovement on "normal" TWiki operations (i.e. when no monitoring takes placs) is just measurable: about 0.1%, according to Devel::NYTProf.
Discussion
Accepted by
KampalaReleaseMeeting2018x02x01.
--
Peter Thoeny - 2018-02-01