From f3d32087d83b46fa6b5e19b6dfc4c9c1baf4d9b0 Mon Sep 17 00:00:00 2001 From: Mark Riddoch Date: Tue, 16 Sep 2014 12:37:57 +0100 Subject: [PATCH 1/2] Performance improvement or streaming large result sets. -bash-4.1$ time mysql -h 127.0.0.1 -P4007 -umassi -pmassi information_schema -q -e "select * from engines a, engines b, engines c, engines d, engines e;" > /dev/null real 1m16.137s user 0m0.660s sys 0m0.392s -bash-4.1$ time mysql -h 127.0.0.1 -P4007 -umassi -pmassi information_schema -q -e "select * from engines a, engines b, engines c, engines d, engines e;" > /dev/null real 0m0.980s user 0m0.944s sys 0m0.027s --- server/include/gw.h | 11 +++++++++-- server/modules/include/mysql_client_server_protocol.h | 4 ---- server/modules/protocol/mysql_client.c | 3 +++ server/modules/protocol/mysql_common.c | 6 ++++++ 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/server/include/gw.h b/server/include/gw.h index c6b847866..822884f9b 100644 --- a/server/include/gw.h +++ b/server/include/gw.h @@ -23,8 +23,15 @@ // network buffer is 32K #define MAX_BUFFER_SIZE 32768 -// socket send buffer for backend -#define GW_BACKEND_SO_SNDBUF 1024 + +/** + * Configuration for send and receive socket buffer sizes for + * backend and cleint connections. + */ +#define GW_BACKEND_SO_SNDBUF 32768 +#define GW_BACKEND_SO_RCVBUF 32768 +#define GW_CLIENT_SO_SNDBUF 32768 +#define GW_CLIENT_SO_RCVBUF 32768 #define GW_NOINTR_CALL(A) do { errno = 0; A; } while (errno == EINTR) #define GW_MYSQL_LOOP_TIMEOUT 300000000 diff --git a/server/modules/include/mysql_client_server_protocol.h b/server/modules/include/mysql_client_server_protocol.h index cb2e41cd7..18771aecd 100644 --- a/server/modules/include/mysql_client_server_protocol.h +++ b/server/modules/include/mysql_client_server_protocol.h @@ -82,10 +82,6 @@ #endif #define GW_NOINTR_CALL(A) do { errno = 0; A; } while (errno == EINTR) -// network buffer is 32K -#define MAX_BUFFER_SIZE 32768 -// socket send buffer for backend -#define GW_BACKEND_SO_SNDBUF 1024 #define SMALL_CHUNK 1024 #define MAX_CHUNK SMALL_CHUNK * 8 * 4 #define ToHex(Y) (Y>='0'&&Y<='9'?Y-'0':Y-'A'+10) diff --git a/server/modules/protocol/mysql_client.c b/server/modules/protocol/mysql_client.c index 5425667d8..bace1eef5 100644 --- a/server/modules/protocol/mysql_client.c +++ b/server/modules/protocol/mysql_client.c @@ -1180,7 +1180,10 @@ int gw_MySQLAccept(DCB *listener) conn_open[c_sock] = true; #endif /* set nonblocking */ + sendbuf = GW_BACKEND_SO_SNDBUF; setsockopt(c_sock, SOL_SOCKET, SO_SNDBUF, &sendbuf, optlen); + sendbuf = GW_BACKEND_SO_RCVBUF; + setsockopt(c_sock, SOL_SOCKET, SO_RCVBUF, &sendbuf, optlen); setnonblocking(c_sock); client_dcb = dcb_alloc(DCB_ROLE_REQUEST_HANDLER); diff --git a/server/modules/protocol/mysql_common.c b/server/modules/protocol/mysql_common.c index 0dad65350..78e82cb86 100644 --- a/server/modules/protocol/mysql_common.c +++ b/server/modules/protocol/mysql_common.c @@ -34,6 +34,7 @@ * */ +#include #include "mysql_client_server_protocol.h" #include #include @@ -741,6 +742,7 @@ int gw_do_connect_to_backend( struct sockaddr_in serv_addr; int rv; int so = 0; + int bufsize; memset(&serv_addr, 0, sizeof serv_addr); serv_addr.sin_family = AF_INET; @@ -764,6 +766,10 @@ int gw_do_connect_to_backend( /* prepare for connect */ setipaddress(&serv_addr.sin_addr, host); serv_addr.sin_port = htons(port); + bufsize = GW_CLIENT_SO_SNDBUF; + setsockopt(so, SOL_SOCKET, SO_SNDBUF, &bufsize, sizeof(bufsize)); + bufsize = GW_CLIENT_SO_RCVBUF; + setsockopt(so, SOL_SOCKET, SO_RCVBUF, &bufsize, sizeof(bufsize)); /* set socket to as non-blocking here */ setnonblocking(so); rv = connect(so, (struct sockaddr *)&serv_addr, sizeof(serv_addr)); From 3b452b47459a22f54ed0171472788494eb0bc566 Mon Sep 17 00:00:00 2001 From: MassimilianoPinto Date: Tue, 16 Sep 2014 17:12:24 +0200 Subject: [PATCH 2/2] Documentation file names change Documentation file names change --- ... MaxScale Configuration And Usage Scenarios.pdf} | Bin ...df => MaxScale Debug And Diagnostic Support.pdf} | Bin ...etup-Z3.pdf => MaxScale MySQL Cluster setup.pdf} | Bin ... => RabbitMQ Setup And MaxScale Integration.pdf} | Bin 4 files changed, 0 insertions(+), 0 deletions(-) rename Documentation/{MaxScale Configuration And Usage Scenarios-Z3.pdf => MaxScale Configuration And Usage Scenarios.pdf} (100%) rename Documentation/{MaxScale Debug And Diagnostic Support-Z3.pdf => MaxScale Debug And Diagnostic Support.pdf} (100%) rename Documentation/{MaxScale MySQL Cluster setup-Z3.pdf => MaxScale MySQL Cluster setup.pdf} (100%) rename Documentation/{RabbitMQ Setup And MaxScale Integration-Z3.pdf => RabbitMQ Setup And MaxScale Integration.pdf} (100%) diff --git a/Documentation/MaxScale Configuration And Usage Scenarios-Z3.pdf b/Documentation/MaxScale Configuration And Usage Scenarios.pdf similarity index 100% rename from Documentation/MaxScale Configuration And Usage Scenarios-Z3.pdf rename to Documentation/MaxScale Configuration And Usage Scenarios.pdf diff --git a/Documentation/MaxScale Debug And Diagnostic Support-Z3.pdf b/Documentation/MaxScale Debug And Diagnostic Support.pdf similarity index 100% rename from Documentation/MaxScale Debug And Diagnostic Support-Z3.pdf rename to Documentation/MaxScale Debug And Diagnostic Support.pdf diff --git a/Documentation/MaxScale MySQL Cluster setup-Z3.pdf b/Documentation/MaxScale MySQL Cluster setup.pdf similarity index 100% rename from Documentation/MaxScale MySQL Cluster setup-Z3.pdf rename to Documentation/MaxScale MySQL Cluster setup.pdf diff --git a/Documentation/RabbitMQ Setup And MaxScale Integration-Z3.pdf b/Documentation/RabbitMQ Setup And MaxScale Integration.pdf similarity index 100% rename from Documentation/RabbitMQ Setup And MaxScale Integration-Z3.pdf rename to Documentation/RabbitMQ Setup And MaxScale Integration.pdf