[Koha-devel] Restructuring C4

Chris Cormack chris at bigballofwax.co.nz
Wed Sep 14 22:59:21 CEST 2011


Hi Paul

Good email, just a couple of comments inline.

2011/9/15 Paul Poulain <paul.poulain at biblibre.com>:
> (this mail has been sent 10 hours ago, seems it was too large. I send it
> again without attached docs)
>
> Le 30/03/2011 16:47, Ian Walls a écrit :
>> Fellow Developers,
> Hello everybody,
>> Last night, I stayed up late running circ/circulation.pl
>> <http://circulation.pl> through NYTProf, to get an idea where we may
>> be able to optimize circulation for speed.  After much frustration
>> (darn session IDs...), I was able to get a report.  The results
>> were... not exactly what I expected.
>
> For those who have used or developed on Koha 2.x, you probably have
> noticed that Koha 2.x was much more slower than Koha 3.x
> So, yesterday and tonight i've taken my laptop and made a lot of testings.
>
> First of all, i'll thank forever ... The New York Times ... Why will you
> tell me ? Because of
> http://search.cpan.org/~adamk/Aspect-Library-NYTProf-1.00/lib/Aspect/Library/NYTProf.pm
>
> This tool is really amazing. You run
> perl -d:NYTProf mainpage.pl ; nytprofhtml --open
> And you get a highly detailled HTML report with the time spent in each
> line/sub/module to run mainpage.pl.
> Here is the result :  http://depot.biblibre.com/ppoulain/nytprof.ini/
> (the .ini is to keep track of the perf before anything optimized)
>
> Note : tests done on my laptop, that is not a server.
> 1st test with master:
> Profile of mainpage.pl for 1.73s (of 2.18s), executing 155108 statements
> and 41041 subroutine calls in 249 source files and 64 string evals.
>
> I have investigated to find the longest timings & if we can do something.
> (note All the following improvement have been done incrementally)
>
> First of all, C4::Context and C4::Koha are loaded on everypage, so it's
> worth investigating
>
> == C4::Context ==
> * spent 185ms just reading the config file. Ouch ! that's almost 10% of
> the time !!!
> (http://depot.biblibre.com/ppoulain/nytprof.ini/C4-Context-pm-13-line.html#230)
> I tried to hardcode the hashref instead of XMLin-ing the config file,
> the results are astonishing :
> after = Profile of mainpage.pl for 1.59s (of 1.93s), executing 117399
> statements and 26939 subroutine calls in 241 source files and 63 string
> evals.
> => PROPOSAL = add a YAML version of the XML config file that we could
> use in //
> => PROPOSAL 2 = memcache the config file
> (hint : the config file in koha 2 was not xml !)
>

Done already
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=6193

Some more testing on this, so I can push it would be much appreciated.

> * C4::Context, sub db_scheme2dbi, the i flag in /mysql/i cost 84ms !!!
> with /i, the duration is 84.4ms, without, it's 10µs !!!
> after = Profile of mainpage.pl for 1.55s (of 1.91s), executing 117398
> statements and 26938 subroutine calls in 241 source files and 63 string
> evals.
> => PROPOSAL = just 'return "mysql"' at the beginning of this sub, as
> everything else is not working anyway !
>
> == C4::Languages ==
> * C4::Languages::getAllLanguages 43ms => heavily under optimized mysql
> query = returns all languages from language_subtag_registry and
> language_descriptions even if only a few localisations are installed.
> * C4::Languages::_build_languages_arrayref 15ms => same as for
> getAllLanguages
> I know there is a patch (from hdl) pending to improve this sub, i
> haven't tested it yet
> (http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=6000)
> (hint : this sub appeared in 3.0, was not in 2.2 !)

These are cached by memoize_memcached if you are running it, I
strongly suggest people do

Chris


More information about the Koha-devel mailing list