Koha Tuning Guide

__FORCETOC__
See also the article about performance.
= MySQL tuning =
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
# 
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
# Here is entries for some specific programs
# The following values assume you have at least 32M ram
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld]
#
# * Basic Settings
#
#
# * Fine Tuning
#
key_buffer		= 2000M
max_allowed_packet	= 16M
thread_stack		= 128K
thread_cache_size	= 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover		= BACKUP
max_connections = 500
max_user_connections = 500
#table_cache = 64
thread_concurrency = 300
table_cache = 30000
open_files_limit = 65000
#innodb_force_recovery =6
#
# * Query Cache Configuration
#
query_cache_limit = 50M
query_cache_size = 300M
#
# * Logging and Replication
#
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
# You might want to disable InnoDB to shrink the mysqld process by circa 100MB.
#skip-innodb
innodb_buffer_pool_size=16777216
innodb_file_per_table
=Apache configuration =
Add that to your configuration file. 
<IfModule mod_gzip.c>
 mod_gzip_on yes
 mod_gzip_dechunk yes
 mod_gzip_keep_workfiles No
 mod_gzip_can_negotiate yes
 mod_gzip_update_static No
 mod_gzip_temp_dir /tmp
 mod_gzip_minimum_file_size 512
 mod_gzip_maximum_file_size 1000000
 mod_gzip_maximum_inmem_size 1000000
 mod_gzip_handle_methods GET POST
 mod_gzip_item_exclude reqheader "User-Agent: .*Mozilla/4\..*\["
 mod_gzip_item_exclude mime ^image/.*
 mod_gzip_item_exclude rspheader Content-Type:image/*
 mod_gzip_item_include file \.js$
 mod_gzip_item_include mime ^application/x-javascript$
 mod_gzip_item_include file \.php$
 mod_gzip_item_include mime ^text/html$
 mod_gzip_item_include file \.css$
 mod_gzip_item_include mime ^text/css$
 </IfModule>
 <IfModule mod_deflate.c>
 # Compress content with type html, text, and css, ...
 AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css
 AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript
 DeflateCompressionLevel 9
 # Properly handle old browsers that do not support compression
 BrowserMatch ^Mozilla/4 gzip-only-text/html
 BrowserMatch ^Mozilla/4\.0[678] no-gzip
 BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
 DeflateFilterNote Input instream
 DeflateFilterNote Output outstream
 DeflateFilterNote Ratio ratio
 LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
 <IfModule mod_headers.c>
 #properly handle requests coming from behind proxies
 Header append Vary User-Agent
 </IfModule>
</IfModule>
 SetOutputFilter DEFLATE
 SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip
<FilesMatch "\.(jpg|gif|png|css|js$)$">
 ExpiresDefault "access plus 7 days"
 Header set Cache-Control "public"
</FilesMatch>
<FilesMatch "\.(pl|html?)$">
 Header set Pragma "no-cache"
 Header set Cache-Control "no-cache, must-revalidate, post-check=0, pre-check=0"
 Header set Expires 1
</FilesMatch>
To enable Apache modules gzip, deflate, expires and headers in Ubuntu:
 sudo a2enmod gzip deflate expires headers
= Reduce CPU usage of webcrawlers: robots.txt =
Ona typical installation just:
 cd /usr/share/koha/opac/htdocs/ # Or on /var/lib/koha/INSTANCE/
 sudo nano robots.txt
And add (source):
 Crawl-delay: 60
 
 User-agent: *
 Disallow: /
 
 User-agent: Googlebot
 Disallow: /cgi-bin/koha/opac-search.pl
 Disallow: /cgi-bin/koha/opac-showmarc.pl
 Disallow: /cgi-bin/koha/opac-detailprint.pl
 Disallow: /cgi-bin/koha/opac-ISBDdetail.pl
 Disallow: /cgi-bin/koha/opac-MARCdetail.pl
 Disallow: /cgi-bin/koha/opac-reserve.pl
 Disallow: /cgi-bin/koha/opac-export.pl
 Disallow: /cgi-bin/koha/opac-detail.pl
 Disallow: /cgi-bin/koha/opac-authoritiesdetail.pl
Check at <yourserver>/robots.txt
* Related bug
* Related thread
* Documentation: robotstxt.org, robots.txt on Google
= See also =
* Performance
Category:Documentation_examples
Category:Tips_&_Tricks
Category:Performance