KOHA
Koha performance: Revision 8

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>



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 > /proc/sys/vm/drop_caches'
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    0m30.717s
user    0m4.280s
sys     0m0.748s