KOHA
Koha performance: Revision 10

Ova stranica dokumentira naša podešavanja (i pokušaje) za što bržom Koha instalacijom.



Apache deflate kompresija

Smanjuje veličinu stranice koja se isporučije browersu.

  • apache2

    deflate-test.sh

    apache2/deflate-test.sh
    #!/bin/sh
    
    if [ -z "$1" ] ; then
    	echo "Usage: $0 http://www.example.com/"
    	exit 1
    else
    	url=$1
    fi
    
    time wget $url -O /tmp/foo
    echo
    time wget --header="Accept-Encoding: gzip" $url -O /tmp/foo.gz
    echo
    
    orig_size=`ls -al /tmp/foo    | awk '{ print $5 }'`
    comp_size=`ls -al /tmp/foo.gz | awk '{ print $5 }'`
    
    if [ $comp_size -lt $orig_size ] ; then
    	echo "OK $comp_size < $orig_size";
    else
    	echo "ERROR: no visible compression benefits"
    fi
    
    #ls -al /tmp/foo /tmp/foo.gz

    deflate.conf

    apache2/deflate.conf
    # /etc/apache2/conf.d/deflate.conf
    
    <IfModule mod_deflate.c>
    	AddOutputFilterByType DEFLATE text/html text/plain text/xml
    
    	SetOutputFilter DEFLATE
    	SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ 			no-gzip dont-vary
    	SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|bz2|sit|rar)$	no-gzip dont-vary
    	SetEnvIfNoCase Request_URI \.pdf$							no-gzip dont-vary
    
    	BrowserMatch ^Mozilla/4 gzip-only-text/html
    	BrowserMatch ^Mozilla/4\.0[678] no-gzip
    	BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
    
    	DeflateFilterNote Input input_info
    	DeflateFilterNote Output output_info
    	DeflateFilterNote Ratio ratio_info
    	LogFormat '"%r" %{output_info}n/%{input_info}n (%{ratio_info}n%%)' deflate
    	CustomLog /var/log/apache2/deflate.log deflate
    </IfModule>

    server-status.conf

    apache2/server-status.conf
    <IfModule mod_status.c>
    
    # munin needs ExtededStatus
    ExtendedStatus On
    
    <Location /server-status>
    	SetHandler server-status
    	Order deny,allow
    	Deny from all
    #	Allow from all
    	Allow from 127.0.0.1
    	Allow from .ffzg.hr
    </Location>
    
    </IfModule>



Session

dpavlin@koha:~$ sudo ./mk-query-digest /var/log/mysql/mysql-slow.log

# Profile
# Rank Query ID           Response time    Calls R/Call   Item
# ==== ================== ================ ===== ======== ================
#    1 0xC7A803CDD4FE9A36 30517.0000 45.5%   349  87.4413 INSERT UPDATE sessions
#    2 0xB4F2B316DFE865C8  8027.0000 12.0%   119  67.4538 SELECT sessions
#    3 0x6019E0D94A244FF5  3952.0000  5.9%   275  14.3709 SELECT opac_news
#    4 0x1F809CA9753CDEE7  2753.0000  4.1%    23 119.6957 SELECT biblio
#    5 0x27CE7D5D2BC5F598  2305.0000  3.4%   206  11.1893 SELECT fieldmapping
#    6 0xB0F504DD073A49CB  2192.0000  3.3%    30  73.0667 SELECT issues items biblio biblioitems
#    7 0x8ED635CB153D27A5  2146.0000  3.2% 19313   0.1111 SELECT reserves reserveconstraints
#    8 0xDB6DC1962741AB10  1978.0000  3.0%     7 282.5714 SELECT biblio biblioitems itemtypes
#    9 0x32783383AEA5AD49  1642.0000  2.4%    10 164.2000 SELECT items
#   10 0x6DD9F09DA2455228  1361.0000  2.0%     8 170.1250 DELETE sessions

Profile

Devel::NYTProf

instalacija:

root@koha-dev-git-reorg:~# cpan Devel::NYTProf

profile search query:

root@koha-dev-git-reorg:/usr/share/koha/opac/cgi-bin/opac# time perl -d:NYTProf -I/usr/share/koha/lib/ opac-search.pl q=human | wc
   1553    3259   58648

real    0m4.001s
user    0m3.152s
sys     0m0.560s

generate html report:

root@koha-dev-git-reorg:/usr/share/koha/opac/cgi-bin/opac# nytprofhtml 
Generating report...
Reading nytprof.out
Writing report to nytprof directory

koha-240

First run

dpavlin@koha-240:/tmp$ time perl -d:NYTProf -I/usr/share/koha/lib/ /usr/share/koha/opac/cgi-bin/opac/opac-search.pl q=human | wc
Use of uninitialized value $borrowernumber in string eq at /usr/share/koha/opac/cgi-bin/opac/opac-search.pl line 483.
Use of uninitialized value in string eq at /usr/share/koha/opac/cgi-bin/opac/opac-search.pl line 486.
   1962    3177   64512

real    0m8.561s
user    0m5.708s
sys     0m0.724s

Second run

dpavlin@koha-240:/tmp$ time perl -d:NYTProf -I/usr/share/koha/lib/ /usr/share/koha/opac/cgi-bin/opac/opac-search.pl q=human | wc
Use of uninitialized value $borrowernumber in string eq at /usr/share/koha/opac/cgi-bin/opac/opac-search.pl line 483.
Use of uninitialized value in string eq at /usr/share/koha/opac/cgi-bin/opac/opac-search.pl line 486.
   1962    3177   64512

real    0m6.664s
user    0m5.636s
sys     0m0.816s

Drop caches and run profile:

dpavlin@koha-240:/tmp$ sudo sh -c 'echo 3 >

Zebra reindex

dpavlin@koha-240:/srv/koha$ sudo -u koha ./misc/migration_tools/rebuild_zebra.pl -b -v -r -d /tmp/indexing -k -x -nosanitize