DB Connection Pool
DB Connection Pool
DB Connection Pool
for MySQL
adzmely mansor
adzmely@nexoprima.com
About Me
adzmely mansor
founder & employee @
sdn. bhd.
and Myths
About Me
X
i Introductory
• costly
• resource intensive
2 Direct DB Connection
SQL
SQL SQL
SQL
SQL DB
SQL
Application(s)
SQL
SQL SQL SQL
SQL
SQL
SQL
SQL
}
}
• max connections
2 Direct DB Connection
• sysbench demo:
SQL
SQL SQL SQL SQL SQL SQL SQL SQL SQL
SQL
SQL
SQL
SQL
}
}
Application making ProxySQL ProxySQL to DB
connection via SQLProxy Connection Threads Persistent Threads
(green threads)
3 Green Threads
• persistent connections to DB
3 DB Connection Pool
• sysbench demo:
DB: DB Pool:
mariaDB 5.5.52 proxySQL 1.4.2
http://mariadb.org http://proxysql.com
GPL Licence GPL License
mariaDB proxySQL
172.16.1.1 172.16.1.2
mariadb proxySQL
port: 3306 internal network port: 6602 - management
inside VM port: 6603 - proxy port
4 Demo VMs/Net Layout
mariaDB proxySQL
port 6602
proxySQL Admin
i Load Balance ProxySQL
mariaDB proxySQL
3 06
t3 port 6602
por
proxySQL Admin
4 Demo: proxySQL Admin
• advance configuration with 0
downtime
• set backend max_connections=1
• run sysbench
• set backend max_connections=50
• run sysbench
• monitoring
4 Demo: Sysbench 01
mariaDB proxySQL
port 3306
Single DB thread for all SQLs
SQL
mariaDB SQL
proxySQL
SQL
DB initiation
for each SQL SQL
SQL
4 Demo: sysbench
SQL
SQL
50 persistent
SQL
db conns
SQL
4 Demo: sysbench