-- Server - 5.7.16 # Host details ushastry@ArtfulAardvark:~/Downloads/mysql-5.7.16$ cat /etc/*release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=17.10 DISTRIB_CODENAME=artful DISTRIB_DESCRIPTION="Ubuntu 17.10" NAME="Ubuntu" VERSION="17.10 (Artful Aardvark)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 17.10" VERSION_ID="17.10" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" VERSION_CODENAME=artful UBUNTU_CODENAME=artful ushastry@ArtfulAardvark:~/Downloads/mysql-5.7.16$ free -m total used free shared buff/cache available Mem: 12007 1481 543 80 9981 10209 Swap: 2047 0 2047 ushastry@ArtfulAardvark:~/Downloads/mysql-5.7.16$ cat /proc/ Display all 345 possibilities? (y or n) ushastry@ArtfulAardvark:~/Downloads/mysql-5.7.16$ cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 44 model name : Intel(R) Xeon(R) CPU E5649 @ 2.53GHz stepping : 2 microcode : 0x616 cpu MHz : 2527.020 cache size : 12288 KB physical id : 0 siblings : 12 core id : 0 cpu cores : 12 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 11 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt aes hypervisor lahf_lm pti retpoline bugs : cpu_meltdown spectre_v1 spectre_v2 bogomips : 5054.04 clflush size : 64 cache_alignment : 64 address sizes : 40 bits physical, 48 bits virtual power management: processor : 1 vendor_id : GenuineIntel cpu family : 6 model : 44 model name : Intel(R) Xeon(R) CPU E5649 @ 2.53GHz stepping : 2 microcode : 0x616 cpu MHz : 2527.020 cache size : 12288 KB physical id : 0 siblings : 12 core id : 1 cpu cores : 12 apicid : 1 initial apicid : 1 fpu : yes fpu_exception : yes cpuid level : 11 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt aes hypervisor lahf_lm pti retpoline bugs : cpu_meltdown spectre_v1 spectre_v2 bogomips : 5054.04 clflush size : 64 cache_alignment : 64 address sizes : 40 bits physical, 48 bits virtual power management: processor : 2 vendor_id : GenuineIntel cpu family : 6 model : 44 model name : Intel(R) Xeon(R) CPU E5649 @ 2.53GHz stepping : 2 microcode : 0x616 cpu MHz : 2527.020 cache size : 12288 KB physical id : 0 siblings : 12 core id : 2 cpu cores : 12 apicid : 2 initial apicid : 2 fpu : yes fpu_exception : yes cpuid level : 11 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt aes hypervisor lahf_lm pti retpoline bugs : cpu_meltdown spectre_v1 spectre_v2 bogomips : 5054.04 clflush size : 64 cache_alignment : 64 address sizes : 40 bits physical, 48 bits virtual power management: processor : 3 vendor_id : GenuineIntel cpu family : 6 model : 44 model name : Intel(R) Xeon(R) CPU E5649 @ 2.53GHz stepping : 2 microcode : 0x616 cpu MHz : 2527.020 cache size : 12288 KB physical id : 0 siblings : 12 core id : 3 cpu cores : 12 apicid : 3 initial apicid : 3 fpu : yes fpu_exception : yes cpuid level : 11 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt aes hypervisor lahf_lm pti retpoline bugs : cpu_meltdown spectre_v1 spectre_v2 bogomips : 5054.04 clflush size : 64 cache_alignment : 64 address sizes : 40 bits physical, 48 bits virtual power management: processor : 4 vendor_id : GenuineIntel cpu family : 6 model : 44 model name : Intel(R) Xeon(R) CPU E5649 @ 2.53GHz stepping : 2 microcode : 0x616 cpu MHz : 2527.020 cache size : 12288 KB physical id : 0 siblings : 12 core id : 4 cpu cores : 12 apicid : 4 initial apicid : 4 fpu : yes fpu_exception : yes cpuid level : 11 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt aes hypervisor lahf_lm pti retpoline bugs : cpu_meltdown spectre_v1 spectre_v2 bogomips : 5054.04 clflush size : 64 cache_alignment : 64 address sizes : 40 bits physical, 48 bits virtual power management: processor : 5 vendor_id : GenuineIntel cpu family : 6 model : 44 model name : Intel(R) Xeon(R) CPU E5649 @ 2.53GHz stepping : 2 microcode : 0x616 cpu MHz : 2527.020 cache size : 12288 KB physical id : 0 siblings : 12 core id : 5 cpu cores : 12 apicid : 5 initial apicid : 5 fpu : yes fpu_exception : yes cpuid level : 11 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt aes hypervisor lahf_lm pti retpoline bugs : cpu_meltdown spectre_v1 spectre_v2 bogomips : 5054.04 clflush size : 64 cache_alignment : 64 address sizes : 40 bits physical, 48 bits virtual power management: processor : 6 vendor_id : GenuineIntel cpu family : 6 model : 44 model name : Intel(R) Xeon(R) CPU E5649 @ 2.53GHz stepping : 2 microcode : 0x616 cpu MHz : 2527.020 cache size : 12288 KB physical id : 0 siblings : 12 core id : 6 cpu cores : 12 apicid : 6 initial apicid : 6 fpu : yes fpu_exception : yes cpuid level : 11 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt aes hypervisor lahf_lm pti retpoline bugs : cpu_meltdown spectre_v1 spectre_v2 bogomips : 5054.04 clflush size : 64 cache_alignment : 64 address sizes : 40 bits physical, 48 bits virtual power management: processor : 7 vendor_id : GenuineIntel cpu family : 6 model : 44 model name : Intel(R) Xeon(R) CPU E5649 @ 2.53GHz stepping : 2 microcode : 0x616 cpu MHz : 2527.020 cache size : 12288 KB physical id : 0 siblings : 12 core id : 7 cpu cores : 12 apicid : 7 initial apicid : 7 fpu : yes fpu_exception : yes cpuid level : 11 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt aes hypervisor lahf_lm pti retpoline bugs : cpu_meltdown spectre_v1 spectre_v2 bogomips : 5054.04 clflush size : 64 cache_alignment : 64 address sizes : 40 bits physical, 48 bits virtual power management: processor : 8 vendor_id : GenuineIntel cpu family : 6 model : 44 model name : Intel(R) Xeon(R) CPU E5649 @ 2.53GHz stepping : 2 microcode : 0x616 cpu MHz : 2527.020 cache size : 12288 KB physical id : 0 siblings : 12 core id : 8 cpu cores : 12 apicid : 8 initial apicid : 8 fpu : yes fpu_exception : yes cpuid level : 11 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt aes hypervisor lahf_lm pti retpoline bugs : cpu_meltdown spectre_v1 spectre_v2 bogomips : 5054.04 clflush size : 64 cache_alignment : 64 address sizes : 40 bits physical, 48 bits virtual power management: processor : 9 vendor_id : GenuineIntel cpu family : 6 model : 44 model name : Intel(R) Xeon(R) CPU E5649 @ 2.53GHz stepping : 2 microcode : 0x616 cpu MHz : 2527.020 cache size : 12288 KB physical id : 0 siblings : 12 core id : 9 cpu cores : 12 apicid : 9 initial apicid : 9 fpu : yes fpu_exception : yes cpuid level : 11 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt aes hypervisor lahf_lm pti retpoline bugs : cpu_meltdown spectre_v1 spectre_v2 bogomips : 5054.04 clflush size : 64 cache_alignment : 64 address sizes : 40 bits physical, 48 bits virtual power management: processor : 10 vendor_id : GenuineIntel cpu family : 6 model : 44 model name : Intel(R) Xeon(R) CPU E5649 @ 2.53GHz stepping : 2 microcode : 0x616 cpu MHz : 2527.020 cache size : 12288 KB physical id : 0 siblings : 12 core id : 10 cpu cores : 12 apicid : 10 initial apicid : 10 fpu : yes fpu_exception : yes cpuid level : 11 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt aes hypervisor lahf_lm pti retpoline bugs : cpu_meltdown spectre_v1 spectre_v2 bogomips : 5054.04 clflush size : 64 cache_alignment : 64 address sizes : 40 bits physical, 48 bits virtual power management: processor : 11 vendor_id : GenuineIntel cpu family : 6 model : 44 model name : Intel(R) Xeon(R) CPU E5649 @ 2.53GHz stepping : 2 microcode : 0x616 cpu MHz : 2527.020 cache size : 12288 KB physical id : 0 siblings : 12 core id : 11 cpu cores : 12 apicid : 11 initial apicid : 11 fpu : yes fpu_exception : yes cpuid level : 11 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt aes hypervisor lahf_lm pti retpoline bugs : cpu_meltdown spectre_v1 spectre_v2 bogomips : 5054.04 clflush size : 64 cache_alignment : 64 address sizes : 40 bits physical, 48 bits virtual power management: ### SSL disabled on server - Not much performance difference observed between 5.6 and 5.7 client # Start up rm -rf 89926/ bin/mysqld --initialize-insecure --basedir=$PWD --datadir=$PWD/89926 --log-error-verbosity=3 bin/mysqld --defaults-file=./my.cnf --basedir=$PWD --datadir=$PWD/89926 --core-file --socket=/tmp/mysql_ushastry.sock --port=3306 --log-error=$PWD/89926/log.err --log-error-verbosity=3 --max-connections=1100 2>&1 & - build details ushastry@ArtfulAardvark:~/Downloads/mysql-5.7.16$ cat docs/INFO_SRC commit: 901c8cbd555c2a94218e2fc64a966b58b39932f4 date: 2016-09-28 18:45:23 +0200 build-date: 2016-09-28 19:03:21 +0200 short: 901c8cb branch: mysql-5.7.16-release MySQL source 5.7.16 ushastry@ArtfulAardvark:~/Downloads/mysql-5.7.16$ bin/mysql -uroot -S /tmp/mysql_ushastry.sock Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.16 MySQL Community Server (GPL) Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> SHOW VARIABLES LIKE '%ssl%'; +---------------+----------+ | Variable_name | Value | +---------------+----------+ | have_openssl | DISABLED | | have_ssl | DISABLED | | ssl_ca | | | ssl_capath | | | ssl_cert | | | ssl_cipher | | | ssl_crl | | | ssl_crlpath | | | ssl_key | | +---------------+----------+ 9 rows in set (0.01 sec) mysql> system cat my.cnf [mysqld] skip_ssl mysql> -- 5.6.39 ushastry@ArtfulAardvark:~/Downloads/setups$ md5sum mysql-5.6.39.tar.gz abcee03992647d508ac5c2568c6cc802 mysql-5.6.39.tar.gz ushastry@ArtfulAardvark:~/Downloads/setups$ tar -zxvf mysql-5.6.39.tar.gz ushastry@ArtfulAardvark:~/Downloads/setups$ cd mysql-5.6.39 ushastry@ArtfulAardvark:~/Downloads/setups/mysql-5.6.39$ cmake -DWITHOUT_SERVER=1 -DCMAKE_INSTALL_PREFIX:PATH=/home/ushastry/Downloads/5_6 -g 'Unix Makefiles' . ushastry@ArtfulAardvark:~/Downloads/setups/mysql-5.6.39$ make -j8 ushastry@ArtfulAardvark:~/Downloads/setups/mysql-5.6.39$ make install export LD_LIBRARY_PATH=/home/ushastry/Downloads/5_6/lib gcc -o test_mysql_connect test_mysql_connect.c `/home/ushastry/Downloads/5_6/bin/mysql_config --cflags --libs` ldd test_mysql_connect ./test_mysql_connect ushastry@ArtfulAardvark:~/Downloads/5_6$ export LD_LIBRARY_PATH=/home/ushastry/Downloads/5_6/lib ushastry@ArtfulAardvark:~/Downloads/5_6$ gcc -o test_mysql_connect test_mysql_connect.c `/home/ushastry/Downloads/5_6/bin/mysql_config --cflags --libs` ushastry@ArtfulAardvark:~/Downloads/5_6$ ldd test_mysql_connect linux-vdso.so.1 => (0x00007fff365bf000) libmysqlclient.so.18 => /home/ushastry/Downloads/5_6/lib/libmysqlclient.so.18 (0x00007f63859e8000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6385608000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f6385404000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f63851e5000) libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f6384e5f000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f6384b09000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f63848f2000) /lib64/ld-linux-x86-64.so.2 (0x00007f63861bf000) ushastry@ArtfulAardvark:~/Downloads/5_6$ ./test_mysql_connect Opening 100 parallel connections took 0.093689 seconds Opening 1000 parallel connections took 1.105089 seconds Opening 100 individual connections took 0.169830 seconds Opening 1000 individual connections took 0.728516 seconds Server host name and the connection type 127.0.0.1 via TCP/IP MySQL server version 5.7.16 Currently used cipher of the TLS connection (null) Client compile version: 50639 Client runtime version: 5.6.39 ushastry@ArtfulAardvark:~/Downloads/5_6$ ushastry@ArtfulAardvark:~/Downloads/5_6$ ./test_mysql_connect Opening 100 parallel connections took 0.083672 seconds Opening 1000 parallel connections took 0.799070 seconds Opening 100 individual connections took 0.091719 seconds Opening 1000 individual connections took 0.741284 seconds Server host name and the connection type 127.0.0.1 via TCP/IP MySQL server version 5.7.16 Currently used cipher of the TLS connection (null) Client compile version: 50639 Client runtime version: 5.6.39 ushastry@ArtfulAardvark:~/Downloads/5_6$ ./test_mysql_connect Opening 100 parallel connections took 0.074157 seconds Opening 1000 parallel connections took 0.789931 seconds Opening 100 individual connections took 0.082588 seconds Opening 1000 individual connections took 0.711914 seconds Server host name and the connection type 127.0.0.1 via TCP/IP MySQL server version 5.7.16 Currently used cipher of the TLS connection (null) Client compile version: 50639 Client runtime version: 5.6.39 -- 5.7.21 (To avoid hitting Bug #87348, commented relevant else part from CMakeLists.txt:) ushastry@ArtfulAardvark:~/Downloads/setups$ md5sum mysql-boost-5.7.21.tar.gz 27313ded360f39f237e99404666bc448 mysql-boost-5.7.21.tar.gz ushastry@ArtfulAardvark:~/Downloads/setups$ tar -zxvf mysql-boost-5.7.21.tar.gz ushastry@ArtfulAardvark:~/Downloads/setups$ cd mysql-5.7.21 ushastry@ArtfulAardvark:~/Downloads/setups/mysql-5.7.21$ cmake -DWITH_BOOST=./boost -DWITHOUT_SERVER=1 -DCMAKE_INSTALL_PREFIX:PATH=/home/ushastry/Downloads/5_7 -g 'Unix Makefiles' . ushastry@ArtfulAardvark:~/Downloads/setups/mysql-5.7.21$ make -j8 ushastry@ArtfulAardvark:~/Downloads/setups/mysql-5.7.21$ make install export LD_LIBRARY_PATH=/home/ushastry/Downloads/5_7/lib gcc -o test_mysql_connect test_mysql_connect.c `/home/ushastry/Downloads/5_7/bin/mysql_config --cflags --libs` ldd test_mysql_connect ./test_mysql_connect shastry@ArtfulAardvark:~/Downloads/5_7$ export LD_LIBRARY_PATH=/home/ushastry/Downloads/5_7/lib ushastry@ArtfulAardvark:~/Downloads/5_7$ gcc -o test_mysql_connect test_mysql_connect.c `/home/ushastry/Downloads/5_7/bin/mysql_config --cflags --libs` ushastry@ArtfulAardvark:~/Downloads/5_7$ ldd test_mysql_connect linux-vdso.so.1 => (0x00007ffdbcf7f000) libmysqlclient.so.20 => /home/ushastry/Downloads/5_7/lib/libmysqlclient.so.20 (0x00007fe9bc34d000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe9bbf6d000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fe9bbd69000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fe9bbb4a000) libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fe9bb7c4000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fe9bb46e000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fe9bb257000) /lib64/ld-linux-x86-64.so.2 (0x00007fe9bcb6b000) ushastry@ArtfulAardvark:~/Downloads/5_7$ ./test_mysql_connect Opening 100 parallel connections took 0.066461 seconds Opening 1000 parallel connections took 0.772308 seconds Opening 100 individual connections took 0.070255 seconds Opening 1000 individual connections took 0.745322 seconds Server host name and the connection type 127.0.0.1 via TCP/IP MySQL server version 5.7.16 Currently used cipher of the TLS connection (null) Client compile version: 50721 Client runtime version: 5.7.21 ushastry@ArtfulAardvark:~/Downloads/5_7$ ./test_mysql_connect Opening 100 parallel connections took 0.062636 seconds Opening 1000 parallel connections took 0.755811 seconds Opening 100 individual connections took 0.069983 seconds Opening 1000 individual connections took 0.705119 seconds Server host name and the connection type 127.0.0.1 via TCP/IP MySQL server version 5.7.16 Currently used cipher of the TLS connection (null) Client compile version: 50721 Client runtime version: 5.7.21 ushastry@ArtfulAardvark:~/Downloads/5_7$ ./test_mysql_connect Opening 100 parallel connections took 0.071486 seconds Opening 1000 parallel connections took 0.738237 seconds Opening 100 individual connections took 0.081464 seconds Opening 1000 individual connections took 0.725182 seconds Server host name and the connection type 127.0.0.1 via TCP/IP MySQL server version 5.7.16 Currently used cipher of the TLS connection (null) Client compile version: 50721 Client runtime version: 5.7.21 ### SSL enabled on Server - performance drop observed in case of 5.7.21 rm -rf 89926/ bin/mysqld --initialize-insecure --basedir=$PWD --datadir=$PWD/89926 --log-error-verbosity=3 bin/mysqld --defaults-file=./my_ssl.cnf --basedir=$PWD --datadir=$PWD/89926 --core-file --socket=/tmp/mysql_ushastry.sock --port=3306 --log-error=$PWD/89926/log.err --log-error-verbosity=3 --max-connections=1100 2>&1 & ushastry@ArtfulAardvark:~/Downloads/mysql-5.7.16$ bin/mysql -uroot -S /tmp/mysql_ushastry.sock Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.16 MySQL Community Server (GPL) Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> SHOW VARIABLES LIKE '%ssl%'; +---------------+-------------------------------------------------------------+ | Variable_name | Value | +---------------+-------------------------------------------------------------+ | have_openssl | YES | | have_ssl | YES | | ssl_ca | /home/ushastry/Downloads/mysql-5.7.16/89926/ca.pem | | ssl_capath | | | ssl_cert | /home/ushastry/Downloads/mysql-5.7.16/89926/server-cert.pem | | ssl_cipher | | | ssl_crl | | | ssl_crlpath | | | ssl_key | /home/ushastry/Downloads/mysql-5.7.16/89926/server-key.pem | +---------------+-------------------------------------------------------------+ 9 rows in set (0.01 sec) mysql> system cat my_ssl.cnf [mysqld] ssl-ca=/home/ushastry/Downloads/mysql-5.7.16/89926/ca.pem ssl-cert=/home/ushastry/Downloads/mysql-5.7.16/89926/server-cert.pem ssl-key=/home/ushastry/Downloads/mysql-5.7.16/89926/server-key.pem mysql> - 5.6.39 ushastry@ArtfulAardvark:~/Downloads/5_6$ export LD_LIBRARY_PATH=/home/ushastry/Downloads/5_6/lib ushastry@ArtfulAardvark:~/Downloads/5_6$ gcc -o test_mysql_connect test_mysql_connect.c `/home/ushastry/Downloads/5_6/bin/mysql_config --cflags --libs` ushastry@ArtfulAardvark:~/Downloads/5_6$ ldd test_mysql_connect linux-vdso.so.1 => (0x00007ffcef194000) libmysqlclient.so.18 => /home/ushastry/Downloads/5_6/lib/libmysqlclient.so.18 (0x00007f98551b3000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9854dd3000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f9854bcf000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f98549b0000) libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f985462a000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f98542d4000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f98540bd000) /lib64/ld-linux-x86-64.so.2 (0x00007f985598a000) ushastry@ArtfulAardvark:~/Downloads/5_6$ ./test_mysql_connect Opening 100 parallel connections took 0.093478 seconds Opening 1000 parallel connections took 1.167366 seconds Opening 100 individual connections took 0.219451 seconds Opening 1000 individual connections took 0.711548 seconds Server host name and the connection type 127.0.0.1 via TCP/IP MySQL server version 5.7.16 Currently used cipher of the TLS connection (null) Client compile version: 50639 Client runtime version: 5.6.39 ushastry@ArtfulAardvark:~/Downloads/5_6$ ./test_mysql_connect Opening 100 parallel connections took 0.088789 seconds Opening 1000 parallel connections took 0.797415 seconds Opening 100 individual connections took 0.106445 seconds Opening 1000 individual connections took 0.748653 seconds Server host name and the connection type 127.0.0.1 via TCP/IP MySQL server version 5.7.16 Currently used cipher of the TLS connection (null) Client compile version: 50639 Client runtime version: 5.6.39 - 5.7.21 ushastry@ArtfulAardvark:~/Downloads/5_7$ export LD_LIBRARY_PATH=/home/ushastry/Downloads/5_7/lib ushastry@ArtfulAardvark:~/Downloads/5_7$ gcc -o test_mysql_connect test_mysql_connect.c `/home/ushastry/Downloads/5_7/bin/mysql_config --cflags --libs` ushastry@ArtfulAardvark:~/Downloads/5_7$ ldd test_mysql_connect linux-vdso.so.1 => (0x00007fff01ebc000) libmysqlclient.so.20 => /home/ushastry/Downloads/5_7/lib/libmysqlclient.so.20 (0x00007f7b2cb58000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7b2c778000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f7b2c574000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f7b2c355000) libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f7b2bfcf000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f7b2bc79000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f7b2ba62000) /lib64/ld-linux-x86-64.so.2 (0x00007f7b2d376000) ushastry@ArtfulAardvark:~/Downloads/5_7$ ./test_mysql_connect Opening 100 parallel connections took 4.430755 seconds Opening 1000 parallel connections took 44.414449 seconds Opening 100 individual connections took 4.661381 seconds Opening 1000 individual connections took 44.778399 seconds Server host name and the connection type 127.0.0.1 via TCP/IP MySQL server version 5.7.16 Currently used cipher of the TLS connection DHE-RSA-AES256-SHA Client compile version: 50721 Client runtime version: 5.7.21 ushastry@ArtfulAardvark:~/Downloads/5_7$ ./test_mysql_connect Opening 100 parallel connections took 3.418550 seconds Opening 1000 parallel connections took 44.423538 seconds Opening 100 individual connections took 4.573982 seconds Opening 1000 individual connections took 45.495805 seconds Server host name and the connection type 127.0.0.1 via TCP/IP MySQL server version 5.7.16 Currently used cipher of the TLS connection DHE-RSA-AES256-SHA Client compile version: 50721 Client runtime version: 5.7.21 # .C test case provided by reporter cat test_mysql_connect.c #include #include #include #include const char* getenv_default(const char* name, const char* def) { const char *value = getenv(name); if (value == NULL) return def; return value; } MYSQL* connect_to_mysql() { const char *hostname = getenv_default("MYSQL_HOST", "127.0.0.1"); const char *username = getenv_default("MYSQL_USER", "root"); const char *password = getenv_default("MYSQL_PASSWORD", ""); MYSQL *mysql = mysql_init(NULL); if (!mysql_real_connect(mysql,hostname,username,password,NULL,3306,NULL,CLIENT_COMPRESS)) { fprintf(stderr, "Failed to connect to database: Error: %s\n", mysql_error(mysql)); } return mysql; } void connection_pool_test(int num_connections) { int i; MYSQL *connections[num_connections]; struct timeval tv_start, tv_end, tv_elapsed; gettimeofday(&tv_start, NULL); for (i = 0; i < num_connections; i++) { connections[i] = connect_to_mysql(); } gettimeofday(&tv_end, NULL); tv_elapsed.tv_sec = tv_end.tv_sec - tv_start.tv_sec; tv_elapsed.tv_usec = tv_end.tv_usec - tv_start.tv_usec; if (tv_elapsed.tv_usec < -1) { tv_elapsed.tv_sec -= 1; tv_elapsed.tv_usec += 1000000; } printf("Opening %d parallel connections took %ld.%06ld seconds\n", num_connections, tv_elapsed.tv_sec, tv_elapsed.tv_usec); for (i = 0; i < num_connections; i++) { mysql_close(connections[i]); } } void individual_connection_test(int num_connections) { int i; MYSQL *connection; struct timeval tv_start, tv_end, tv_elapsed; gettimeofday(&tv_start, NULL); for (i = 0; i < num_connections; i++) { connection = connect_to_mysql(); mysql_close(connection); } gettimeofday(&tv_end, NULL); tv_elapsed.tv_sec = tv_end.tv_sec - tv_start.tv_sec; tv_elapsed.tv_usec = tv_end.tv_usec - tv_start.tv_usec; if (tv_elapsed.tv_usec < -1) { tv_elapsed.tv_sec -= 1; tv_elapsed.tv_usec += 1000000; } printf("Opening %d individual connections took %ld.%06ld seconds\n", num_connections, tv_elapsed.tv_sec, tv_elapsed.tv_usec); } void envr() { const char *hostname = getenv_default("MYSQL_HOST", "127.0.0.1"); const char *username = getenv_default("MYSQL_USER", "root"); const char *password = getenv_default("MYSQL_PASSWORD", ""); MYSQL *mysql = mysql_init(NULL); if (!mysql_real_connect(mysql,hostname,username,password,NULL,3306,NULL,CLIENT_COMPRESS)) { fprintf(stderr, "Failed to connect to database: Error: %s\n", mysql_error(mysql)); } printf("Server host name and the connection type %s \n", mysql_get_host_info(mysql)); printf("MySQL server version %s \n", mysql_get_server_info(mysql)); printf("Currently used cipher of the TLS connection %s \n", mysql_get_ssl_cipher(mysql)); printf("Client compile version: %d\n", MYSQL_VERSION_ID); printf("Client runtime version: %s\n", mysql_get_client_info()); } int main(int argc, char* argv[], char* env[]) { connection_pool_test(100); connection_pool_test(1000); individual_connection_test(100); individual_connection_test(1000); envr(); }