Vitessとは • VitessはシャーディングによるMySQLの水平スケーリ ングのためのデータベースクラスタリングシステム – https://vitess.io • YouTubeによって開発された技術 – First Commit in 2010 – In Production at YouTube since 2011 • CNCFの16番目にホストされたプロジェクト – 現在は Incubating • 今回はKubernetes上で動作させる前提で調査、検証 5
Vitess in Kubernetes 11 pod pod app server pod etcd VTgate service etcd service pod pod VTctld VTctld service Admin pod batch job VTgate pod Shard 1 Shard 2 tablet tablet Master Replica Ronly Master Replica Ronly
データ増幅方法/クエリー • データ増幅 29 create procedure insert_messages(in x int) begin declare i int; set i = 0; set i = i + 1; INSERT INTO messages (page, time_created_ns, message) VALUES ( i, i+cast(now() as datetime) , SUBSTRING(MD5(RAND()), 1, 10)); end while; end ; call insert_messages(1000000); • 複数のShardにヒットするクエ リー(Scatter Query) select * from messages where message like '%abc%'; +----+-------------+----------+------------+------+---------------+------+---------+------+--------+----------+------- | id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra | +----+-------------+----------+------------+------+---------------+------+---------+------+--------+----------+------- | 1 | SIMPLE | messages | NULL | ALL | NULL | NULL | NULL | NULL | 227016 | 11.11 | Using +----+-------------+----------+------------+------+---------------+------+---------+------+--------+----------+------- 1 row in set (0.70 sec)