[Koha-bugs] [Bug 7511] New: Caching Templates

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Feb 8 16:48:07 CET 2012


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7511

             Bug #: 7511
           Summary: Caching Templates
    Classification: Unclassified
 Change sponsored?: ---
           Product: Koha
           Version: master
          Platform: All
        OS/Version: All
            Status: ASSIGNED
          Severity: enhancement
          Priority: P1 - high
         Component: Architecture, internals, and plumbing
        AssignedTo: paul.poulain at biblibre.com
        ReportedBy: paul.poulain at biblibre.com
         QAContact: koha.sekjal at gmail.com


(cc of a mail sent to koha-devel on 2011-09-12)


The loading of the template seems to cost 150ms, and I feel that those 2
options could be usefull to speed up the process. Did anyone already saw
this option before ? Is it something worth investigating more ?

Here is the documentation of the 1st option:

COMPILE_EXT

>From version 2 onwards, the Template Toolkit has the ability to compile
templates to Perl code and save them to disk for subsequent use (i.e.
cache persistence). The COMPILE_EXT option may be provided to specify a
filename extension for compiled template files. It is undefined by
default and no attempt will be made to read or write any compiled
template files.

    my $template = Template->new({
        COMPILE_EXT => '.ttc',
    });

If COMPILE_EXT is defined (and COMPILE_DIR isn't, see below) then
compiled template files with the COMPILE_EXT extension will be written
to the same directory from which the source template files were loaded.


I made some tests and the results are great:

NYTprof comparison:
WITHOUT caching: Profile of mainpage.pl for 2.18s (of 2.79s), executing 199503
statements and 60033 subroutine calls in 279 source files and 81 string evals.
WITH caching: Profile of mainpage.pl for 1.86s (of 2.27s), executing 131771
statements and 47501 subroutine calls in 281 source files and 73 string evals.

The same kind of improvements can be seen with
misc/load_testing/benchmark_staff.pl
WITHOUT caching:
Benchmarking with 20 occurences of each operation and 30 concurrent sessions 
Step 1: staff client main page         23465ms    0.852 pages/sec
Step 2: catalog detail page            34507ms    0.579 biblios/sec
Step 3: catalogue search                   26909ms    0.743 biblios/sec
Step 5: patron detail page             27872ms    0.717 borrowers/sec
Step 5: patron search page                 52577ms    0.76 borrowers/sec
Step 6a circulation (checkouts)            32309ms    0.619 checkouts/sec
Step 6b circulation (checkins)             32959ms    0.606 checkins/sec
all transactions at once                   103897ms    1.732 operations/sec

WITH caching:
Benchmarking with 20 occurences of each operation and 30 concurrent sessions 
Step 1: staff client main page         21286ms    0.939 pages/sec
Step 2: catalog detail page            27213ms    0.734 biblios/sec
Step 3: catalogue search                   22091ms    0.905 biblios/sec
Step 5: patron detail page             22015ms    0.908 borrowers/sec
Step 5: patron search page                 43871ms    0.911 borrowers/sec
Step 6a circulation (checkouts)            27601ms    0.724 checkouts/sec
Step 6b circulation (checkins)             28860ms    0.693 checkins/sec
all transactions at once                   87597ms    2.054 operations/sec

-- 
Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.


More information about the Koha-bugs mailing list