Change potentially slow log statements to subroutines

Bug #1824184 reported by John Merriam
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenSRF
Fix Released
Medium
Unassigned
3.0
Fix Released
Medium
Unassigned

Bug Description

See LP1824181 https://bugs.launchpad.net/opensrf/+bug/1824181

This depends on the above change being merged.

The OpenSRF code was searched for potentially slow logging statements at log level info or above. We then changed those logging statements to be delayed execution subroutines. This is in reaction to LP1823338 where a slow debug logging statement was slowing down SIP checkins even though debug logging was not turned on.

Here is some pseudocode that shows what is being done here:

$log->debug("Some text " . $some->slow_method);

would be changed to:

$log->debug(sub{return "Some text " . $some->slow_method });

With this change, an unnamed sub is passed to the OpenSRF logger module and it will not be executed unless the global logging level is set to debug or higher (the slow_method will not be called unless it is needed for that logging level).

********
If/when this is committed, please use delayed execution subroutines for any logging statements that could be slow in the future. It is recommend that any logging statements that do not consist entirely of quoted text and/or already available scalar variables use delayed execution subroutines.
********

At some point in the future if these changes are accepted, the same analysis and changes should be made for the Evergreen code.

This bug is related to LP1823338 https://bugs.launchpad.net/opensrf/+bug/1823338 If this solution is accepted, that bug can be closed/ignored.

Branch to follow.

Revision history for this message
John Merriam (jmerriam) wrote :
tags: added: pullrequest
Galen Charlton (gmc)
Changed in opensrf:
status: New → Confirmed
importance: Undecided → Medium
milestone: none → 3.1.1
Revision history for this message
Galen Charlton (gmc) wrote :

Pushed to master, rel_3_1, and rel_3_0. Thanks, John!

tags: added: performance
Changed in opensrf:
status: Confirmed → Fix Committed
Galen Charlton (gmc)
Changed in opensrf:
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.