[Koha-bugs] [Bug 11974] Enable unix socket connections for database connections.

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Mar 20 14:13:20 CET 2014


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11974

Olli-Antti Kivilahti <olli-antti.kivilahti at jns.fi> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #26485|0                           |1
        is obsolete|                            |

--- Comment #5 from Olli-Antti Kivilahti <olli-antti.kivilahti at jns.fi> ---
Created attachment 26486
  -->
http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=26486&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 ~30-40% faster compared to using TCP packets.
Because
Koha abuses the database a lot, this will make a difference.

------------
- 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.


More information about the Koha-bugs mailing list