TPAC needs to be instrumented so we can determine where performance bottlenecks lie

Bug #988146 reported by Dan Scott
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Wishlist
Unassigned
2.2
Fix Released
Undecided
Unassigned

Bug Description

* Evergreen master

The TPAC consists primarily of two layers: the template code that mostly handles formatting and display, and the Perl modules that handle most of the logic - including calls to the database.

To determine areas where we could focus on optimization, we should instrument the TPAC. A simple approach would be to create and populate a context variable if a debug flag (say, DEBUG_TIMING) is true. The structure of the variable will be a list of key-value pairs. The key will be composed of the interval since the start of the template generation, and the value will be a description of the event. These key-value pairs, in the forms of hashes, will be pushed onto the context variable throughout the Perl code. Oh, and we'll have to use Time::HiRes as Perl's default timestamps don't go beyond a granularity of one second.

For example:

[
    {0.000209 => "Allocated variables"},
    {0.005009 => "Issued search query"},
    {1.510110 => "Search results obtained"}
]

... or something like that.

Then we can also, based on the DEBUG_TIMING flag, expose the results at the bottom of each page, or something along those lines, so that we can easily debug problems on remote servers as well. Win win win!

Revision history for this message
Lebbeous Fogle-Weekley (lebbeous) wrote :

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/collab/senator/tpac-instrument-new

Boom!

Here's a branch that has Dan's instrumentation and a first use case thereof, in the record detail page

Revision history for this message
Dan Scott (denials) wrote :

Nice. I turned DEBUG_TIMING off by default and committed the resulting two commits to master. Onward to more insight into the speed of the TPAC!

Changed in evergreen:
status: New → Fix Committed
importance: Undecided → Wishlist
Revision history for this message
Lebbeous Fogle-Weekley (lebbeous) wrote :

Backported to rel_2_2 by popular demand!

Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.