Skip to content
svaroqui edited this page Jan 18, 2013 · 16 revisions

Read Write Splitting

Connect to MySQL to main VIP

/usr/local/skysql/mariadb-client/bin/mysql -h10.0.0.10 -pskyvodka -uskysql -P3306

Run and check that you are redericeted to the master in a transaction

MariaDB [(none)]> select @@server_id;BEGIN; select @@server_id; COMMIT; select @@server_id;
+-------------+
| @@server_id |
+-------------+
| 5012 |
+-------------+
+-------------+
| @@server_id |
+-------------+
| 5010 |
+-------------+
+-------------+
| @@server_id |
+-------------+
| 5012 |
+-------------+

Is the vip ok

ip addr list dev eth0

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 0e:30:66:29:0c:e9 brd ff:ff:ff:ff:ff:ff
inet 10.0.0.102/24 brd 10.0.0.255 scope global eth0
inet 10.0.0.10/24 scope global secondary eth0
inet6 fe80::c30:66ff:fe29:ce9/64 scope link
valid_lft forever preferred_lft forever

ip addr list dev eth0

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 0e:30:66:0c:ce:43 brd ff:ff:ff:ff:ff:ff
inet 10.0.0.47/24 brd 10.0.0.255 scope global eth0
inet 10.0.0.10/24 scope global secondary eth0
inet6 fe80::c30:66ff:fe0c:ce43/64 scope link
valid_lft forever preferred_lft forever

tail -f /var/log/messages

Jan 18 06:07:37 ip-10-0-0-47 Keepalived_vrrp[2228]: Opening file '/usr/local/skysql/ncc/etc /keepalived.lb2.cnf'. Jan 18 06:07:37 ip-10-0-0-47 Keepalived_vrrp[2228]: Configuration is using : 63687 Bytes
Jan 18 06:07:37 ip-10-0-0-47 Keepalived_vrrp[2228]: Using LinkWatch kernel netlink reflector...
Jan 18 06:07:38 ip-10-0-0-47 Keepalived_vrrp[2228]: VRRP_Instance(mysql_pool) Transition to MASTER STATE
Jan 18 06:07:39 ip-10-0-0-47 Keepalived_vrrp[2228]: VRRP_Instance(mysql_pool) Entering MASTER STATE

Concurrency with mysqlslap

/usr/local/skysql/mariadb-client/bin/mysqlslap -c10 -h10.0.0.10 -pskyvodka -uskysql --number-of-queries=200 --create-schema=dbt2 -P3306 -q"select * from orders limit 10"

Benchmark

Average number of seconds to run all queries: 0.278 seconds
Minimum number of seconds to run all queries: 0.278 seconds
Maximum number of seconds to run all queries: 0.278 seconds
Number of clients running queries: 10
Average number of queries per client: 20

Checking for concurrency of 10 with connection open and close every query outch network

/usr/local/skysql/mariadb-client/bin/mysqlslap -c10 -h10.0.0.10 -pskyvodka -uskysql --number-of-queries=200 --create-schema=dbt2 -P3306 -q"select * from orders limit 10" --debug-info --detach=1

Benchmark

Average number of seconds to run all queries: 3.378 seconds
Minimum number of seconds to run all queries: 3.378 seconds
Maximum number of seconds to run all queries: 3.378 seconds
Number of clients running queries: 10
Average number of queries per client: 20

Clone this wiki locally