http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11974
Olli-Antti Kivilahti <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #26486|0 |1 is obsolete| | --- Comment #15 from Olli-Antti Kivilahti <[email protected]> --- Created attachment 26505 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=26505&action=edit Bug 11974 - Enable unix socket connections for database connections. ----------------- - BUSINESS CASE - ----------------- Currently Koha doesn't support using a non-default unix socket for database connections. Using unix sockets is generally ~20-30% faster compared to using TCP packets. Because Koha abuses the database a lot, this will make a difference. Using a non-default unix socket is useful if you want to run multiple databases (eg. mysql and mariadb) in the same OS (eg. for testing purposes). Also if one needs to move the unix socket, for example to share it between LXC containers using a shared partition, this feature might be handy. Using unix sockets for connections are faster than TCP because there is no need for TCP and IP layer packet generation. Instead applications can communicate directly without extra overhead. The benefit is marginal for a single query, around 0.5ms, but escalates linearly when hundreds of queries are performed. ------------ - SOLUTION - ------------ Mysql uses unix sockets for localhost connections only, but DBI::Mysql cannot automatically find the non-default socket path, thus it needs to be explicitly given. This patch modifies the C4::Context->dbh() routine to check for the presence of mysql_socket in koha-conf.xml and prioritize the socket connection. If making the socket connection fails, dbh() defaults to the TCP-connection if available. This patch works on MariaDB and Mysql, hence the configuration variable name mysql_socket. ------------- - TEST PLAN - ------------- DEFAULT: 1. edit koha-conf.xml 1.1. uncomment row <mysql_socket>... and put your socket path here, by default /var/run/mysqld/mysqld.sock . or create the xml-entry <mysql_socket>/var/run/mysqld/mysqld.sock</mysql_socket> 2. load any koha's web-page. Shouldn't get any errors. SOCKET ONLY: replicate DEFAULT and do the following instructions: 3. From koha-conf.xml, remove hostname or set to bad name. 4. load any koha's web page. 5. Mysql/MariaDB connection works faster than ever! BAD SOCKET: 1. but a bad path as your mysql_socket, eg /var/run/mysqld/mysqld.sockBADBAD 2. load any koha's web-page. see your koha-error_log or koha-opac-error_log for the error. You can still use Koha normally, but it is recommended to fix bad socket ASAP. TOTAL DESTRUCTION: replicate BAD SOCKET and do the following instructions: 3. from koha-conf.xml remove hostname or change to a bad one. 4. load any koha's web page. Enjoy the "Software error". Thank you for testing! -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
