Performance Comparison
The use of database proxies is an essential purpose to distribute the request pressure of the database to the slaves, thereby maintaining the stable operation of the database. Of course, making use of the read-write separation capability of database proxies can significantly improve the request processing ability of the entire database cluster and respond to business functions faster.
Test Parameters
The stress test adopts the industry standard multi-threaded performance testing tool sysbench.
- sysbench version: sysbench 1.0.20
- sysbench test machine: the same area, fast Jie O-type cloud host CPU: 8 cores Memory: 8G
- Operating System: Centos 8.3
- Test dataset: 10 tables, each table data 1000w
- 8-core 16G configuration for the proxy node service
Test command
sysbench --test=/usr/share/sysbench/oltp_read_only.lua --db-driver=mysql --mysql-host=$ip --mysql-port=3306 --mysql-user=xxxx --mysql-password=xxxxx --mysql-db=sysbenchtest --report-interval=5 --max-requests=0 --max-time=300 --num-threads=$thread_num run
Read Requests Curve with Pressure Variation
As shown in the chart above, we use two proxy nodes to connect to a single master and double slave 6C8G UDB MySQL instance to conduct performance testing of the database proxy under different pressures. You can see that when the database request pressure increases, the use of database proxies shows good stability. Direct connection to the master will show a decline in performance due to increased pressure. At the same time, we observed the CPU pressure situation under different situations, and obtained the following curve:
From the graph, we can see that the request pressure will be distributed to the slave, thereby reducing the master's pressure to improve performance.
Performance Comparison Between Different Database Configurations
The above chart shows the performance difference between using a database proxy among different database configurations where the number of proxy nodes and the number of databases are consistent. You can see that when the request pressure is large enough, accessing through the database proxy can better exert the service performance of the database cluster.