New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
7x faster performance. Connect thru socket to MySQL database. #3168
Conversation
Check for new config option `db_socket`, the name of the socket to connect to the mysql database. If config option `db_socket` exists and has a value, then connect to MySQL by the name of the socket. Socket connection is preferred over the network connection thru localhost.
@chris001 I'd love to test this. Do you know of an easy way to do a simple performance verification? Just to make sure that the traffic is actually going through the socket, and that there is some observable advantage? |
My initial tests aren't making much sense to me... First of all, I introduced the changes, and edited config.php, and the SuiteCRM app works fine (though I can't tell if it's faster). ... but then I tried to make sure the traffic was going through the socket, so I changed
and it shows The app still works fine, which is what I expected: we don't need networking, we're going through the socket. But when I removed the new socket setting from All this was done with restarts to MySql and Apache in between. What could be going on? Am I wrong about the meaning of |
Maybe that is the reason: |
Thanks @gunnicom that seems to make sense. I changed my Then I removed skip-networking and it started connecting again (through 127.0.0.1 networking, I suppose). But this leaves the following question: it seems MySql is already using the socket, without this PR, when the db is set as P.S. - I'm using MySql 5.7 |
Yes, i think it is exactly how you described. |
I suppose it would be a good idea to note on setup or at least somewhere in the documentation that "localhost" should be the preffered host over 127.0.0.1 for local db installs. I had no idea of this difference. Cool find. |
@gunnerman1 I think the best place to do it could be in label I would change it to something like this:
|
65d0682
to
95f8224
Compare
Add support for config option to connect to MySQL database by unix domain socket (UDS), for faster performance, when using a locally hosted database, than the only previous option of connecting by network connection to the database server.
This socket upgrade delivers 66% less latency, and 7X more throughput vs. TCP network connection to MySQL through the network interface.
Source: https://github.com/rigtorp/ipc-bench
Description
Check for new config option
db_socket
, the name of the socket to connect to the mysql database.If config option
db_socket
exists and has a value, then connect to MySQL by the name of the socket.Motivation and Context
Socket connection is preferred over the network connection thru localhost.
How To Test This
config.php
, afterdb_port
, calleddb_socket
.db_socket
to the full path of the mysql socket, which is a special file created by mysql server when it starts.To find the full path of the mysql socket, do the following shell command, on debian/ubuntu/mint:
# cat /etc/mysql/my.cnf | grep socket
On CentOS/Scientific/RedHat/Fedora:
# cat /etc/my.cnf | grep socket
On debian 8, the full path to the mysql 5.6 socket, happens to be:
/var/run/mysqld/mysqld.sock
.On CentOS 7, the full path to the mysql (mariadb) 5.5 socket happens to be,
/var/lib/mysql/mysql.sock
.So on debian 8/ubuntu 14, after the line with
'db_port'
, you add:'db_socket' => '/var/run/mysqld/mysqld.sock',
And on CentOS 7/RedHat 7/Fedora, after the line
'db_port'
, you add:'db_socket' => '/var/lib/mysql/mysql.sock',
Types of changes
Final checklist