Need help related to MariaDB performance behavior
We are working on case related to MariaDB where-in we are observing performance degradation while establishing a connection with MariaDB server of version 5.5.52 (as compared to v5.5.31). Looking forward to community people in case some has experienced a similar thing in past and give us some pointer to optimize it.
What we are seeing:
The call to mysql_real_connect(..) is taking around 360+ msec to establish a connection with Maria DB server (v5.5.52-MariaDB). We are establishing an encrypted connection using SSL. The same thing when tried using MariaDB server (v5.5.31-MariaDB) then it is taking around 23 msec. So there is a clear difference in performance while establishing SSL connection with DB server.
Our configuration:--
We are using C based client application to connect with MariaDB server.
Scenario 1: where performance is good i.e. just 23 msec for establishing a connection: - C based MariaDB connector : mariadb_client-2.0.0. - MariaDB Server v5.5.31.
Scenario 2: where performance degradation is observed i.e. 360+ msec for establishing a connection: - C based MariaDB connector : mariadb_client-2.2.3 - MariaDB Server v5.5.52.
Client code used:--
Here is the code snippet we are using: MYSQL *mysql = NULL; mysql_init(mysql);
mysql_ssl_set(mysql, mysqlsslkey, mysqlsslcert, mysqlsslca, NULL, NULL);
mysql_options(mysql,MYSQL_OPT_CONNECT_TIMEOUT,(char *) &Timeout); Timeout is 10
mysql_options(mysql,MYSQL_OPT_READ_TIMEOUT, (char*) &Timeout); Timeout is 10
mysql_real_connect(mysql, "127.0.0.1", MY_USER_NAME, MY_USER_PASSWORD, NULL, 0, NULL, CLIENT_REMEMBER_OPTIONS);
Our analysis till now:--
While analysing the TCPDUMP of the communication between MariaDB client and MariaDB server we see that major time (around 345 msec )is used while establishing a SSL handshaking between client and server. Although in case of MariaDB server v5.5.31 the SSL session establishment is taking just 18msec.
The TLS protocol used is same i.e. TLSv1 in both the cases.
Please share if someone has experienced a similar thing in past and give us some pointer to optimize it.