SlideShare a Scribd company logo
1 of 50
Download to read offline
How to migrate to sharding with Spider
Kentoku SHIBA
1. What is SPIDER?
2. Why SPIDER? what SPIDER can do for you?
3. How to migrate to sharding using Replication
4. How to migrate to sharding using Trigger
5. How to migrate to sharding using Spider function
6. How to migrate to sharding
using Vertical Partitioning Storage Engine
Agenda
What is Spider
What is the Spider Storage Engine?
Spider is a sharding solution and proxying
solution. Spider Storage Engine is a
plugin of MariaDB/MySQL. Spider tables
can be used to federate from other servers
MariaDB/MySQL/OracleDB tables as if they
stand on local server. And Spider can
create database sharding by using table
partitioning feature.
What is the Spider Storage Engine?
1.request
2. Execute SQL
4.response
AP
All databases can be used as ONE database through Spider.
APAP AP AP
SPIDER
(MariaDB/MySQL)
MariaDB
tbl_a
MySQL
tbl_b
SPIDER
(MariaDB/MySQL)
SPIDER
(MariaDB/MySQL)
OracleDB
tbl_c
3. Distributed SQL3. Distributed SQL 3. Distributed SQL
What is the Spider Storage Engine?
Spider is bundled in MariaDB
from 10.0 and all patches for MariaDB is
applied in 10.3
Why SPIDER?
What SPIDER can do for you?
Why Spider? What Spider can do for you?
For federation
You can attach tables from other servers or
from local server by using Spider.
For sharding
You can divide huge tables and huge
traffics to multiple servers by using Spider.
Why Spider? What Spider can do for you?
Cross shard join
You can join all tables by using Spider,
even if tables are on different servers.
simple
sharding
solution
Join operation with simple sharding solution (without Spider)
DB1
tbl_a1
1.Request
2. Execute SQL with JOIN
3.Response
DB2
AP
Join operation requires that all joined tables are on same
server.
APAP AP AP
tbl_a2tbl_b1 tbl_b2
Join operation with Spider
1.request
2. Execute SQL with JOIN
3.response
AP
You can JOIN all tables, even if tables are on different servers.
APAP AP AP
SPIDER
(MariaDB/MySQL)
DB1
tbl_a1
DB2
tbl_a2tbl_b1 tbl_b2
Why Spider? What Spider can do for you?
Join push down
If it is possible, Spider executes JOIN
operation at data node directly.
JOIN push down
1.request
2. Execute SQL with JOIN
3.response
AP
If all tables are on same data node, Spider executes JOIN
operation on data node directly.
APAP AP AP
SPIDER
(MariaDB/MySQL)
DB1
tbl_a
DB2
tbl_ctbl_b tbl_d
JOIN push down
Simple join operation are two times faster
on simple JOIN pushdown test.
Also, in this pushdown of JOIN, when
aggregate functions are included in the
query, since the aggregation processing is
also executed at the data node, the amount
of data transfer is greatly reduced and it
becomes super high speed.
How to migrate to sharding with Spider
using Replication
Initial Structure
There is 1 MariaDB server without Spider.
DB1
tbl_a
Create table tbl_a (
col_a int,
col_b int,
primary key(col_a)
) engine = InnoDB;
Step 1 (for migrating)
Create table on DB3 and DB4.
Then create Spider table on DB2.
DB1
tbl_a
DB3
tbl_a
col_a%2=1col_a%2=0
DB2
DB4
tbl_a
Create table tbl_a (
col_a int,
col_b int,
primary key(col_a)
) engine = Spider
Connection ‘
table “tbl_a”,
user “user”,
password “pass”
‘
partition by list(
mod(col_a, 2)) (
partition pt1 values in(0)
comment ‘host “DB3”’,
partition pt2 values in(1)
comment ‘host “DB4”’
);
tbl_a
Step 2
DB1
tbl_a
DB3
tbl_a
col_a%2=1col_a%2=0
DB2
DB4
tbl_a
Copy table data from DB1 to DB2.
(Use mysqldump with “--master-data = 1 or 2” option)
tbl_a
Step 3
Start replication from DB1 to DB2.
Wait for resolving replication delay.
DB1
tbl_a
DB3
tbl_a
col_a%2=1col_a%2=0
DB2
DB4
tbl_a
tbl_a
replication
Step 4
Stop client access for DB1.
Wait for resolving replication delay.
Switch client access from DB1 to DB2.
DB1
tbl_a
DB3
tbl_a
col_a%2=1col_a%2=0
DB2
DB4
tbl_a
tbl_a
replication
Finish
Stop replication on DB2.
Remove DB1.
DB3
tbl_a
col_a%2=1col_a%2=0
DB2
DB4
tbl_a
tbl_a
Pros and Cons of Replication way
Pros
1. No need to manage lock size for coping.
2. Support non primary key table.
Cons
1. Need to stop writing.
How to migrate to sharding with Spider
using Trigger
Initial Structure
There is 1 MariaDB server without Spider.
DB1
tbl_aCreate table tbl_a (
col_a int,
col_b int,
primary key(col_a)
) engine = InnoDB;
Step 1 (for migrating)
Create table on DB2 and DB3.
Then create Spider table on DB1.
DB1
tbl_a
DB2
tbl_a
col_a%2=1col_a%2=0
DB3
tbl_a
tbl_a2
Create table tbl_a2 (
col_a int,
col_b int,
primary key(col_a)
) engine = Spider
Connection ‘
table “tbl_a”,
user “user”,
password “pass”
‘
partition by list(
mod(col_a, 2)) (
partition pt1 values in(0)
comment ‘host “DB2”’,
partition pt2 values in(1)
comment ‘host “DB3”’
);
Step 2
Create triggers on DB1.
(For copying insert, update and delete. If you use “truncate” for tbl_a, you should better to use
other way)
DB1
tbl_a
DB2
tbl_a
col_a%2=1col_a%2=0
DB3
tbl_a
tbl_a2
delimiter |
create trigger tbl_a_i after insert
on tbl_a for each row
insert into tbl_a2 (a,b) values
(new.a, new.b);
|
create trigger tbl_a_u after update
on tbl_a for each row
update tbl_a2 set a = new.a,
b = new.b
where a = old.a;
|
create trigger tbl_a_d after delete
on tbl_a for each row
delete from tbl_a2 where a = old.a;
|
delimiter ;
Step 3
DB1
tbl_a
DB2
tbl_a
col_a%2=1col_a%2=0
DB3
tbl_a
tbl_a2
Insert select from tbl_a to tbl_a2.
(Please take care of locking time for tbl_a and tbl_a2.)
Step 4
DB2
tbl_a
col_a%2=1col_a%2=0
DB3
tbl_a
Rename table from tbl_a2 to tbl_a.
Rename table tbl_a to tbl_a3,
tbl_a2 to tbl_a;
DB1
tbl_a3
tbl_a
Finish
DB1 DB2
tbl_a
col_a%2=1col_a%2=0
DB3
tbl_atbl_a
Drop table tbl_a3.
Pros and Cons of Trigger way
Pros
1. No need to stop services.
2. Easy to copy.(Simple command)
Cons
1. Impossible to support truncate.
2. Need to manage lock size at coping.
3. Impossible to support non primary key.
How to migrate to sharding with Spider
using Spider function
Initial Structure
There is 1 MariaDB server without Spider.
DB1
tbl_aCreate table tbl_a (
col_a int,
col_b int,
primary key(col_a)
) engine = InnoDB;
Step 1 (for migrating)
Create table on DB2 and DB3.
Then create Spider table on DB1.
DB1
tbl_a
DB2
tbl_a
col_a%2=1col_a%2=0
DB3
tbl_a
tbl_a2
Create table tbl_a2 (
col_a int,
col_b int,
primary key(col_a)
) engine = Spider
Connection ‘
table “tbl_a”,
user “user”,
password “pass”
‘
partition by list(
mod(col_a, 2)) (
partition pt1 values in(0)
comment ‘host “DB2”’,
partition pt2 values in(1)
comment ‘host “DB3”’
);
Step 2
Create tables on DB1.
DB1
tbl_a
DB2
tbl_a
col_a%2=1col_a%2=0
DB3
tbl_a
tbl_a2Create table tbl_a4 (
col_a int,
col_b int,
primary key(col_a)
) engine = Spider
Connection ‘
host “localhost”
table “tbl_a3 tbl_a2”,
lst “0 2”,
user “user”,
password “pass”
‘;
tbl_a4
tbl_a3
Create table tbl_a3 (
col_a int,
col_b int,
primary key(col_a)
) engine = InnoDB;
Step 3
Rename table on DB1.
DB1
tbl_a3
DB2
tbl_a
col_a%2=1col_a%2=0
DB3
tbl_a
tbl_a2
Rename table tbl_a3 to tbl_a5,
tbl_a to tbl_a3, tbl_a4 to tbl_a;
tbl_a
tbl_a5
Step 4
Copy data on DB1.
DB1
tbl_a3
DB2
tbl_a
col_a%2=1col_a%2=0
DB3
tbl_a
tbl_a2
Select
spider_copy_table(‘tbl_a’, ‘’, ‘’);
tbl_a
tbl_a5
Step 5
Rename table on DB1.
DB1
tbl_a3
DB2
tbl_a
col_a%2=1col_a%2=0
DB3
tbl_a
tbl_aRename table tbl_a2 to tbl_a6,
tbl_a5 to tbl_a2, tbl_a to tbl_a7,
tbl_a6 to tbl_a;
tbl_a7
tbl_a2
Finish
DB1 DB2
tbl_a
col_a%2=1col_a%2=0
DB3
tbl_atbl_a
Drop table tbl_a2, tbl_a3 and tbl_a7.
Pros and Cons of Spider function way
Pros
1. No need to stop services.
2. Easy to copy.(Simple command. Lock
size is managed by Spider)
Cons
1. Impossible to support non primary key.
How to migrate to sharding with Spider
using Vertical Partitioning Storage Engine
Initial Structure
There is 1 MariaDB server without Spider.
DB1
tbl_a
Create table tbl_a (
col_a int,
col_b int,
primary key(col_a),
key idx2(col_b)
) engine = InnoDB;
Step 1 (for migrating)
Create table on DB2 and DB3.
Then create tables on DB1.
DB1
tbl_a
DB2
col_a%2=1col_a%2=0
DB3
Create table tbl_pk (
col_a int,
primary key(col_a)
) engine = Spider
Connection ‘
table “tbl_pk”,
user “user”,
password “pass”
‘
partition by list(
mod(col_a, 2)) (
partition pt1 values in(0)
comment ‘host “DB2”’,
partition pt2 values in(1)
comment ‘host “DB3”’
);
tbl_pk
tbl_pk tbl_pk
Step 2
Create table on DB4 and DB5.
Then create tables on DB1.
DB1
tbl_a
DB2
col_a%2=1col_a%2=0
DB3
Create table tbl_a3 (
col_a int,
col_b int,
key idx1(col_a),
key idx2(col_b)
) engine = Spider
Connection ‘
table “tbl_a2”,
user “user”,
password “pass”
‘
partition by list(
mod(col_b, 2)) (
partition pt1 values in(0)
comment ‘host “DB4”’,
partition pt2 values in(1)
comment ‘host “DB5”’
);
tbl_pk
tbl_a2
tbl_pk tbl_pk
DB4
col_b%2=1col_b%2=0
DB5
tbl_a2 tbl_a2
Step 3
Create tables on DB1.
DB1
tbl_a
DB2
col_a%2=1col_a%2=0
DB3
Create table tbl_a3 (
col_a int,
col_b int,
primary key(col_a),
key idx2(col_b)
) engine = VP
Comment ‘
ctm “1”,
ist “1”,
pcm “1”,
tnl “tbl_a4 tbl_pk tbl_a2”
‘;
tbl_a3
tbl_pk
tbl_a2
tbl_pk tbl_pk
DB4
col_b%2=1col_b%2=0
DB5
tbl_a2 tbl_a2
Create table tbl_a4 (
col_a int,
col_b int,
primary key(col_a)
) engine = InnoDB;
tbl_a4
Step 4
Rename tables on DB1.
DB1
DB2
col_a%2=1col_a%2=0
DB3
tbl_a
tbl_pk
tbl_a2
tbl_pk tbl_pk
DB4
col_b%2=1col_b%2=0
DB5
tbl_a2 tbl_a2
Rename table tbl_a4 to tbl_a5,
tbl_a to tbl_a4, tbl_a3 to tbl_a;
tbl_a5
tbl_a4
Step 5
Copy data from tbl_a4 to tbl_pk and tbl_a2 on DB1.
DB1
DB2
col_a%2=1col_a%2=0
DB3
tbl_a
tbl_pk
tbl_a2
tbl_pk tbl_pk
DB4
col_b%2=1col_b%2=0
DB5
tbl_a2 tbl_a2
Select vp_copy_tables(‘table_a’,
‘tbl_a4’, ‘tbl_pk tbl_a2’);
tbl_a5
tbl_a4
Step 6
Alter table tbl_a on DB1.
DB1
DB2
col_a%2=1col_a%2=0
DB3
tbl_a
tbl_pk
tbl_a2
tbl_pk tbl_pk
DB4
col_b%2=1col_b%2=0
DB5
tbl_a2 tbl_a2Alter table tbl_a
comment ‘
pcm “1”,
tnl “tbl_pk tbl_a2”
‘;
tbl_a5
tbl_a4
Finish
Drop table tbl_a on DB1.
DB1
DB2
col_a%2=1col_a%2=0
DB3
tbl_a
tbl_pk
tbl_a2
tbl_pk tbl_pk
DB4
col_b%2=1col_b%2=0
DB5
tbl_a2 tbl_a2
Drop table tbl_a4, tbl_a5;
Pros and Cons of VP way
Pros
1. No need to stop services.
2. Support spiltting by non unique columns.
3. Easy to copy.(Simple command. Lock
size is managed by VP)
Cons
1. VP storage engine is required.
2. Impossible to support non primary key.
Thank you for
taking your
time!!

More Related Content

What's hot

Extending Apache Spark – Beyond Spark Session Extensions
Extending Apache Spark – Beyond Spark Session ExtensionsExtending Apache Spark – Beyond Spark Session Extensions
Extending Apache Spark – Beyond Spark Session ExtensionsDatabricks
 
Introduction to apache_cassandra_for_developers-lhg
Introduction to apache_cassandra_for_developers-lhgIntroduction to apache_cassandra_for_developers-lhg
Introduction to apache_cassandra_for_developers-lhgzznate
 
Tuning tips for Apache Spark Jobs
Tuning tips for Apache Spark JobsTuning tips for Apache Spark Jobs
Tuning tips for Apache Spark JobsSamir Bessalah
 
Scoop Job, import and export to RDBMS
Scoop Job, import and export to RDBMSScoop Job, import and export to RDBMS
Scoop Job, import and export to RDBMSRupak Roy
 
Why your Spark job is failing
Why your Spark job is failingWhy your Spark job is failing
Why your Spark job is failingSandy Ryza
 
Installing Apache Hive, internal and external table, import-export
Installing Apache Hive, internal and external table, import-export Installing Apache Hive, internal and external table, import-export
Installing Apache Hive, internal and external table, import-export Rupak Roy
 
Top 5 Mistakes to Avoid When Writing Apache Spark Applications
Top 5 Mistakes to Avoid When Writing Apache Spark ApplicationsTop 5 Mistakes to Avoid When Writing Apache Spark Applications
Top 5 Mistakes to Avoid When Writing Apache Spark ApplicationsCloudera, Inc.
 
SORT & JOIN IN SPARK 2.0
SORT & JOIN IN SPARK 2.0SORT & JOIN IN SPARK 2.0
SORT & JOIN IN SPARK 2.0Sigmoid
 
Deep Dive into Cassandra
Deep Dive into CassandraDeep Dive into Cassandra
Deep Dive into CassandraBrent Theisen
 
Introduction to scoop and its functions
Introduction to scoop and its functionsIntroduction to scoop and its functions
Introduction to scoop and its functionsRupak Roy
 
Apache cassandra and spark. you got the the lighter, let's start the fire
Apache cassandra and spark. you got the the lighter, let's start the fireApache cassandra and spark. you got the the lighter, let's start the fire
Apache cassandra and spark. you got the the lighter, let's start the firePatrick McFadin
 
Emr zeppelin & Livy demystified
Emr zeppelin & Livy demystifiedEmr zeppelin & Livy demystified
Emr zeppelin & Livy demystifiedOmid Vahdaty
 
InfluxDB IOx Tech Talks: Intro to the InfluxDB IOx Read Buffer - A Read-Optim...
InfluxDB IOx Tech Talks: Intro to the InfluxDB IOx Read Buffer - A Read-Optim...InfluxDB IOx Tech Talks: Intro to the InfluxDB IOx Read Buffer - A Read-Optim...
InfluxDB IOx Tech Talks: Intro to the InfluxDB IOx Read Buffer - A Read-Optim...InfluxData
 
Everyday I'm Shuffling - Tips for Writing Better Spark Programs, Strata San J...
Everyday I'm Shuffling - Tips for Writing Better Spark Programs, Strata San J...Everyday I'm Shuffling - Tips for Writing Better Spark Programs, Strata San J...
Everyday I'm Shuffling - Tips for Writing Better Spark Programs, Strata San J...Databricks
 
Tale of Kafka Consumer for Spark Streaming
Tale of Kafka Consumer for Spark StreamingTale of Kafka Consumer for Spark Streaming
Tale of Kafka Consumer for Spark StreamingSigmoid
 
SQL to Hive Cheat Sheet
SQL to Hive Cheat SheetSQL to Hive Cheat Sheet
SQL to Hive Cheat SheetHortonworks
 
Riak add presentation
Riak add presentationRiak add presentation
Riak add presentationIlya Bogunov
 
Apache Kafka DC Meetup: Replicating DB Binary Logs to Kafka
Apache Kafka DC Meetup: Replicating DB Binary Logs to KafkaApache Kafka DC Meetup: Replicating DB Binary Logs to Kafka
Apache Kafka DC Meetup: Replicating DB Binary Logs to KafkaMark Bittmann
 

What's hot (20)

Extending Apache Spark – Beyond Spark Session Extensions
Extending Apache Spark – Beyond Spark Session ExtensionsExtending Apache Spark – Beyond Spark Session Extensions
Extending Apache Spark – Beyond Spark Session Extensions
 
Introduction to apache_cassandra_for_developers-lhg
Introduction to apache_cassandra_for_developers-lhgIntroduction to apache_cassandra_for_developers-lhg
Introduction to apache_cassandra_for_developers-lhg
 
Tuning tips for Apache Spark Jobs
Tuning tips for Apache Spark JobsTuning tips for Apache Spark Jobs
Tuning tips for Apache Spark Jobs
 
Scoop Job, import and export to RDBMS
Scoop Job, import and export to RDBMSScoop Job, import and export to RDBMS
Scoop Job, import and export to RDBMS
 
mesos-devoxx14
mesos-devoxx14mesos-devoxx14
mesos-devoxx14
 
Why your Spark job is failing
Why your Spark job is failingWhy your Spark job is failing
Why your Spark job is failing
 
Installing Apache Hive, internal and external table, import-export
Installing Apache Hive, internal and external table, import-export Installing Apache Hive, internal and external table, import-export
Installing Apache Hive, internal and external table, import-export
 
Top 5 Mistakes to Avoid When Writing Apache Spark Applications
Top 5 Mistakes to Avoid When Writing Apache Spark ApplicationsTop 5 Mistakes to Avoid When Writing Apache Spark Applications
Top 5 Mistakes to Avoid When Writing Apache Spark Applications
 
Scala+data
Scala+dataScala+data
Scala+data
 
SORT & JOIN IN SPARK 2.0
SORT & JOIN IN SPARK 2.0SORT & JOIN IN SPARK 2.0
SORT & JOIN IN SPARK 2.0
 
Deep Dive into Cassandra
Deep Dive into CassandraDeep Dive into Cassandra
Deep Dive into Cassandra
 
Introduction to scoop and its functions
Introduction to scoop and its functionsIntroduction to scoop and its functions
Introduction to scoop and its functions
 
Apache cassandra and spark. you got the the lighter, let's start the fire
Apache cassandra and spark. you got the the lighter, let's start the fireApache cassandra and spark. you got the the lighter, let's start the fire
Apache cassandra and spark. you got the the lighter, let's start the fire
 
Emr zeppelin & Livy demystified
Emr zeppelin & Livy demystifiedEmr zeppelin & Livy demystified
Emr zeppelin & Livy demystified
 
InfluxDB IOx Tech Talks: Intro to the InfluxDB IOx Read Buffer - A Read-Optim...
InfluxDB IOx Tech Talks: Intro to the InfluxDB IOx Read Buffer - A Read-Optim...InfluxDB IOx Tech Talks: Intro to the InfluxDB IOx Read Buffer - A Read-Optim...
InfluxDB IOx Tech Talks: Intro to the InfluxDB IOx Read Buffer - A Read-Optim...
 
Everyday I'm Shuffling - Tips for Writing Better Spark Programs, Strata San J...
Everyday I'm Shuffling - Tips for Writing Better Spark Programs, Strata San J...Everyday I'm Shuffling - Tips for Writing Better Spark Programs, Strata San J...
Everyday I'm Shuffling - Tips for Writing Better Spark Programs, Strata San J...
 
Tale of Kafka Consumer for Spark Streaming
Tale of Kafka Consumer for Spark StreamingTale of Kafka Consumer for Spark Streaming
Tale of Kafka Consumer for Spark Streaming
 
SQL to Hive Cheat Sheet
SQL to Hive Cheat SheetSQL to Hive Cheat Sheet
SQL to Hive Cheat Sheet
 
Riak add presentation
Riak add presentationRiak add presentation
Riak add presentation
 
Apache Kafka DC Meetup: Replicating DB Binary Logs to Kafka
Apache Kafka DC Meetup: Replicating DB Binary Logs to KafkaApache Kafka DC Meetup: Replicating DB Binary Logs to Kafka
Apache Kafka DC Meetup: Replicating DB Binary Logs to Kafka
 

Similar to How to migrate_to_sharding_with_spider

Using spider for sharding in production
Using spider for sharding in productionUsing spider for sharding in production
Using spider for sharding in productionKentoku
 
Advanced Sharding Techniques with Spider (MUC2010)
Advanced Sharding Techniques with Spider (MUC2010)Advanced Sharding Techniques with Spider (MUC2010)
Advanced Sharding Techniques with Spider (MUC2010)Kentoku
 
Newest topic of spider 20131016 in Buenos Aires Argentina
Newest topic of spider 20131016 in Buenos Aires ArgentinaNewest topic of spider 20131016 in Buenos Aires Argentina
Newest topic of spider 20131016 in Buenos Aires ArgentinaKentoku
 
"Mobage DBA Fight against Big Data" - NHN TE
"Mobage DBA Fight against Big Data" - NHN TE"Mobage DBA Fight against Big Data" - NHN TE
"Mobage DBA Fight against Big Data" - NHN TERyosuke IWANAGA
 
Sharding with spider solutions 20160721
Sharding with spider solutions 20160721Sharding with spider solutions 20160721
Sharding with spider solutions 20160721Kentoku
 
Db2 performance tuning for dummies
Db2 performance tuning for dummiesDb2 performance tuning for dummies
Db2 performance tuning for dummiesAngel Dueñas Neyra
 
Tuning and Debugging in Apache Spark
Tuning and Debugging in Apache SparkTuning and Debugging in Apache Spark
Tuning and Debugging in Apache SparkDatabricks
 
M|18 Battle of the Online Schema Change Methods
M|18 Battle of the Online Schema Change MethodsM|18 Battle of the Online Schema Change Methods
M|18 Battle of the Online Schema Change MethodsMariaDB plc
 
DB2 LUW V11.1 CERTIFICATION TRAINING PART #1
DB2 LUW V11.1 CERTIFICATION TRAINING PART #1DB2 LUW V11.1 CERTIFICATION TRAINING PART #1
DB2 LUW V11.1 CERTIFICATION TRAINING PART #1sunildupakuntla
 
db2dart and inspect
db2dart and inspectdb2dart and inspect
db2dart and inspectdbawork
 
Go Faster With Native Compilation
Go Faster With Native CompilationGo Faster With Native Compilation
Go Faster With Native CompilationPGConf APAC
 
Go faster with_native_compilation Part-2
Go faster with_native_compilation Part-2Go faster with_native_compilation Part-2
Go faster with_native_compilation Part-2Rajeev Rastogi (KRR)
 
Conquering "big data": An introduction to shard query
Conquering "big data": An introduction to shard queryConquering "big data": An introduction to shard query
Conquering "big data": An introduction to shard queryJustin Swanhart
 
M|18 How MariaDB Server Scales with Spider
M|18 How MariaDB Server Scales with SpiderM|18 How MariaDB Server Scales with Spider
M|18 How MariaDB Server Scales with SpiderMariaDB plc
 
Deep Dive of ADBMS Migration to Apache Spark—Use Cases Sharing
Deep Dive of ADBMS Migration to Apache Spark—Use Cases SharingDeep Dive of ADBMS Migration to Apache Spark—Use Cases Sharing
Deep Dive of ADBMS Migration to Apache Spark—Use Cases SharingDatabricks
 
Webinar slides: Managing MySQL Replication for High Availability
Webinar slides: Managing MySQL Replication for High AvailabilityWebinar slides: Managing MySQL Replication for High Availability
Webinar slides: Managing MySQL Replication for High AvailabilitySeveralnines
 

Similar to How to migrate_to_sharding_with_spider (20)

Using spider for sharding in production
Using spider for sharding in productionUsing spider for sharding in production
Using spider for sharding in production
 
Advanced Sharding Techniques with Spider (MUC2010)
Advanced Sharding Techniques with Spider (MUC2010)Advanced Sharding Techniques with Spider (MUC2010)
Advanced Sharding Techniques with Spider (MUC2010)
 
Newest topic of spider 20131016 in Buenos Aires Argentina
Newest topic of spider 20131016 in Buenos Aires ArgentinaNewest topic of spider 20131016 in Buenos Aires Argentina
Newest topic of spider 20131016 in Buenos Aires Argentina
 
"Mobage DBA Fight against Big Data" - NHN TE
"Mobage DBA Fight against Big Data" - NHN TE"Mobage DBA Fight against Big Data" - NHN TE
"Mobage DBA Fight against Big Data" - NHN TE
 
Sharding with spider solutions 20160721
Sharding with spider solutions 20160721Sharding with spider solutions 20160721
Sharding with spider solutions 20160721
 
Howmysqlworks
HowmysqlworksHowmysqlworks
Howmysqlworks
 
Db2 performance tuning for dummies
Db2 performance tuning for dummiesDb2 performance tuning for dummies
Db2 performance tuning for dummies
 
Tuning and Debugging in Apache Spark
Tuning and Debugging in Apache SparkTuning and Debugging in Apache Spark
Tuning and Debugging in Apache Spark
 
M|18 Battle of the Online Schema Change Methods
M|18 Battle of the Online Schema Change MethodsM|18 Battle of the Online Schema Change Methods
M|18 Battle of the Online Schema Change Methods
 
DB2 LUW V11.1 CERTIFICATION TRAINING PART #1
DB2 LUW V11.1 CERTIFICATION TRAINING PART #1DB2 LUW V11.1 CERTIFICATION TRAINING PART #1
DB2 LUW V11.1 CERTIFICATION TRAINING PART #1
 
Go Faster With Native Compilation
Go Faster With Native CompilationGo Faster With Native Compilation
Go Faster With Native Compilation
 
db2dart and inspect
db2dart and inspectdb2dart and inspect
db2dart and inspect
 
Go Faster With Native Compilation
Go Faster With Native CompilationGo Faster With Native Compilation
Go Faster With Native Compilation
 
Go faster with_native_compilation Part-2
Go faster with_native_compilation Part-2Go faster with_native_compilation Part-2
Go faster with_native_compilation Part-2
 
sql_bootcamp.pdf
sql_bootcamp.pdfsql_bootcamp.pdf
sql_bootcamp.pdf
 
Conquering "big data": An introduction to shard query
Conquering "big data": An introduction to shard queryConquering "big data": An introduction to shard query
Conquering "big data": An introduction to shard query
 
M|18 How MariaDB Server Scales with Spider
M|18 How MariaDB Server Scales with SpiderM|18 How MariaDB Server Scales with Spider
M|18 How MariaDB Server Scales with Spider
 
Deep Dive of ADBMS Migration to Apache Spark—Use Cases Sharing
Deep Dive of ADBMS Migration to Apache Spark—Use Cases SharingDeep Dive of ADBMS Migration to Apache Spark—Use Cases Sharing
Deep Dive of ADBMS Migration to Apache Spark—Use Cases Sharing
 
Webinar slides: Managing MySQL Replication for High Availability
Webinar slides: Managing MySQL Replication for High AvailabilityWebinar slides: Managing MySQL Replication for High Availability
Webinar slides: Managing MySQL Replication for High Availability
 
Oracle NOLOGGING
Oracle NOLOGGINGOracle NOLOGGING
Oracle NOLOGGING
 

More from Kentoku

MariaDB 10.3から利用できるSpider関連の性能向上機能・便利機能ほか
MariaDB 10.3から利用できるSpider関連の性能向上機能・便利機能ほかMariaDB 10.3から利用できるSpider関連の性能向上機能・便利機能ほか
MariaDB 10.3から利用できるSpider関連の性能向上機能・便利機能ほかKentoku
 
Spiderストレージエンジンの使い方と利用事例 他ストレージエンジンの紹介
Spiderストレージエンジンの使い方と利用事例 他ストレージエンジンの紹介Spiderストレージエンジンの使い方と利用事例 他ストレージエンジンの紹介
Spiderストレージエンジンの使い方と利用事例 他ストレージエンジンの紹介Kentoku
 
Spider storage engine (dec212016)
Spider storage engine (dec212016)Spider storage engine (dec212016)
Spider storage engine (dec212016)Kentoku
 
Spiderストレージエンジンのご紹介
Spiderストレージエンジンのご紹介Spiderストレージエンジンのご紹介
Spiderストレージエンジンのご紹介Kentoku
 
MariaDB ColumnStore 20160721
MariaDB ColumnStore 20160721MariaDB ColumnStore 20160721
MariaDB ColumnStore 20160721Kentoku
 
Mroonga 20141129
Mroonga 20141129Mroonga 20141129
Mroonga 20141129Kentoku
 
MariaDB Spider Mroonga 20140218
MariaDB Spider Mroonga 20140218MariaDB Spider Mroonga 20140218
MariaDB Spider Mroonga 20140218Kentoku
 
Mroonga 20131129
Mroonga 20131129Mroonga 20131129
Mroonga 20131129Kentoku
 
Spiderの最新動向 20131009
Spiderの最新動向 20131009Spiderの最新動向 20131009
Spiderの最新動向 20131009Kentoku
 
Spiderの最新動向 20130419
Spiderの最新動向 20130419Spiderの最新動向 20130419
Spiderの最新動向 20130419Kentoku
 
Mroonga 20121129
Mroonga 20121129Mroonga 20121129
Mroonga 20121129Kentoku
 
Mroonga unsupported feature_20111129
Mroonga unsupported feature_20111129Mroonga unsupported feature_20111129
Mroonga unsupported feature_20111129Kentoku
 
Introducing mroonga 20111129
Introducing mroonga 20111129Introducing mroonga 20111129
Introducing mroonga 20111129Kentoku
 
hs_spider_hs_something_20110906
hs_spider_hs_something_20110906hs_spider_hs_something_20110906
hs_spider_hs_something_20110906Kentoku
 
Charms of MySQL 20101206(DTT#7)
Charms of MySQL 20101206(DTT#7)Charms of MySQL 20101206(DTT#7)
Charms of MySQL 20101206(DTT#7)Kentoku
 
Introducing Spider 20101206(DTT#7)
Introducing Spider 20101206(DTT#7)Introducing Spider 20101206(DTT#7)
Introducing Spider 20101206(DTT#7)Kentoku
 
Spider DeNA Technology Seminar #2
Spider DeNA Technology Seminar #2Spider DeNA Technology Seminar #2
Spider DeNA Technology Seminar #2Kentoku
 
Spider Performance Test(Bench Mark04242009)
Spider Performance Test(Bench Mark04242009)Spider Performance Test(Bench Mark04242009)
Spider Performance Test(Bench Mark04242009)Kentoku
 
Spider Shibuya.pm #12
Spider Shibuya.pm #12Spider Shibuya.pm #12
Spider Shibuya.pm #12Kentoku
 

More from Kentoku (19)

MariaDB 10.3から利用できるSpider関連の性能向上機能・便利機能ほか
MariaDB 10.3から利用できるSpider関連の性能向上機能・便利機能ほかMariaDB 10.3から利用できるSpider関連の性能向上機能・便利機能ほか
MariaDB 10.3から利用できるSpider関連の性能向上機能・便利機能ほか
 
Spiderストレージエンジンの使い方と利用事例 他ストレージエンジンの紹介
Spiderストレージエンジンの使い方と利用事例 他ストレージエンジンの紹介Spiderストレージエンジンの使い方と利用事例 他ストレージエンジンの紹介
Spiderストレージエンジンの使い方と利用事例 他ストレージエンジンの紹介
 
Spider storage engine (dec212016)
Spider storage engine (dec212016)Spider storage engine (dec212016)
Spider storage engine (dec212016)
 
Spiderストレージエンジンのご紹介
Spiderストレージエンジンのご紹介Spiderストレージエンジンのご紹介
Spiderストレージエンジンのご紹介
 
MariaDB ColumnStore 20160721
MariaDB ColumnStore 20160721MariaDB ColumnStore 20160721
MariaDB ColumnStore 20160721
 
Mroonga 20141129
Mroonga 20141129Mroonga 20141129
Mroonga 20141129
 
MariaDB Spider Mroonga 20140218
MariaDB Spider Mroonga 20140218MariaDB Spider Mroonga 20140218
MariaDB Spider Mroonga 20140218
 
Mroonga 20131129
Mroonga 20131129Mroonga 20131129
Mroonga 20131129
 
Spiderの最新動向 20131009
Spiderの最新動向 20131009Spiderの最新動向 20131009
Spiderの最新動向 20131009
 
Spiderの最新動向 20130419
Spiderの最新動向 20130419Spiderの最新動向 20130419
Spiderの最新動向 20130419
 
Mroonga 20121129
Mroonga 20121129Mroonga 20121129
Mroonga 20121129
 
Mroonga unsupported feature_20111129
Mroonga unsupported feature_20111129Mroonga unsupported feature_20111129
Mroonga unsupported feature_20111129
 
Introducing mroonga 20111129
Introducing mroonga 20111129Introducing mroonga 20111129
Introducing mroonga 20111129
 
hs_spider_hs_something_20110906
hs_spider_hs_something_20110906hs_spider_hs_something_20110906
hs_spider_hs_something_20110906
 
Charms of MySQL 20101206(DTT#7)
Charms of MySQL 20101206(DTT#7)Charms of MySQL 20101206(DTT#7)
Charms of MySQL 20101206(DTT#7)
 
Introducing Spider 20101206(DTT#7)
Introducing Spider 20101206(DTT#7)Introducing Spider 20101206(DTT#7)
Introducing Spider 20101206(DTT#7)
 
Spider DeNA Technology Seminar #2
Spider DeNA Technology Seminar #2Spider DeNA Technology Seminar #2
Spider DeNA Technology Seminar #2
 
Spider Performance Test(Bench Mark04242009)
Spider Performance Test(Bench Mark04242009)Spider Performance Test(Bench Mark04242009)
Spider Performance Test(Bench Mark04242009)
 
Spider Shibuya.pm #12
Spider Shibuya.pm #12Spider Shibuya.pm #12
Spider Shibuya.pm #12
 

Recently uploaded

Biometric Authentication: The Evolution, Applications, Benefits and Challenge...
Biometric Authentication: The Evolution, Applications, Benefits and Challenge...Biometric Authentication: The Evolution, Applications, Benefits and Challenge...
Biometric Authentication: The Evolution, Applications, Benefits and Challenge...GQ Research
 
Data Factory in Microsoft Fabric (MsBIP #82)
Data Factory in Microsoft Fabric (MsBIP #82)Data Factory in Microsoft Fabric (MsBIP #82)
Data Factory in Microsoft Fabric (MsBIP #82)Cathrine Wilhelmsen
 
Predictive Analysis for Loan Default Presentation : Data Analysis Project PPT
Predictive Analysis for Loan Default  Presentation : Data Analysis Project PPTPredictive Analysis for Loan Default  Presentation : Data Analysis Project PPT
Predictive Analysis for Loan Default Presentation : Data Analysis Project PPTBoston Institute of Analytics
 
April 2024 - NLIT Cloudera Real-Time LLM Streaming 2024
April 2024 - NLIT Cloudera Real-Time LLM Streaming 2024April 2024 - NLIT Cloudera Real-Time LLM Streaming 2024
April 2024 - NLIT Cloudera Real-Time LLM Streaming 2024Timothy Spann
 
Student profile product demonstration on grades, ability, well-being and mind...
Student profile product demonstration on grades, ability, well-being and mind...Student profile product demonstration on grades, ability, well-being and mind...
Student profile product demonstration on grades, ability, well-being and mind...Seán Kennedy
 
Conf42-LLM_Adding Generative AI to Real-Time Streaming Pipelines
Conf42-LLM_Adding Generative AI to Real-Time Streaming PipelinesConf42-LLM_Adding Generative AI to Real-Time Streaming Pipelines
Conf42-LLM_Adding Generative AI to Real-Time Streaming PipelinesTimothy Spann
 
Defining Constituents, Data Vizzes and Telling a Data Story
Defining Constituents, Data Vizzes and Telling a Data StoryDefining Constituents, Data Vizzes and Telling a Data Story
Defining Constituents, Data Vizzes and Telling a Data StoryJeremy Anderson
 
Learn How Data Science Changes Our World
Learn How Data Science Changes Our WorldLearn How Data Science Changes Our World
Learn How Data Science Changes Our WorldEduminds Learning
 
How we prevented account sharing with MFA
How we prevented account sharing with MFAHow we prevented account sharing with MFA
How we prevented account sharing with MFAAndrei Kaleshka
 
modul pembelajaran robotic Workshop _ by Slidesgo.pptx
modul pembelajaran robotic Workshop _ by Slidesgo.pptxmodul pembelajaran robotic Workshop _ by Slidesgo.pptx
modul pembelajaran robotic Workshop _ by Slidesgo.pptxaleedritatuxx
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfgstagge
 
detection and classification of knee osteoarthritis.pptx
detection and classification of knee osteoarthritis.pptxdetection and classification of knee osteoarthritis.pptx
detection and classification of knee osteoarthritis.pptxAleenaJamil4
 
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一F sss
 
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改yuu sss
 
ASML's Taxonomy Adventure by Daniel Canter
ASML's Taxonomy Adventure by Daniel CanterASML's Taxonomy Adventure by Daniel Canter
ASML's Taxonomy Adventure by Daniel Cantervoginip
 
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝DelhiRS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhijennyeacort
 
Easter Eggs From Star Wars and in cars 1 and 2
Easter Eggs From Star Wars and in cars 1 and 2Easter Eggs From Star Wars and in cars 1 and 2
Easter Eggs From Star Wars and in cars 1 and 217djon017
 
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档208367051
 
Student Profile Sample report on improving academic performance by uniting gr...
Student Profile Sample report on improving academic performance by uniting gr...Student Profile Sample report on improving academic performance by uniting gr...
Student Profile Sample report on improving academic performance by uniting gr...Seán Kennedy
 
20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdf20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdfHuman37
 

Recently uploaded (20)

Biometric Authentication: The Evolution, Applications, Benefits and Challenge...
Biometric Authentication: The Evolution, Applications, Benefits and Challenge...Biometric Authentication: The Evolution, Applications, Benefits and Challenge...
Biometric Authentication: The Evolution, Applications, Benefits and Challenge...
 
Data Factory in Microsoft Fabric (MsBIP #82)
Data Factory in Microsoft Fabric (MsBIP #82)Data Factory in Microsoft Fabric (MsBIP #82)
Data Factory in Microsoft Fabric (MsBIP #82)
 
Predictive Analysis for Loan Default Presentation : Data Analysis Project PPT
Predictive Analysis for Loan Default  Presentation : Data Analysis Project PPTPredictive Analysis for Loan Default  Presentation : Data Analysis Project PPT
Predictive Analysis for Loan Default Presentation : Data Analysis Project PPT
 
April 2024 - NLIT Cloudera Real-Time LLM Streaming 2024
April 2024 - NLIT Cloudera Real-Time LLM Streaming 2024April 2024 - NLIT Cloudera Real-Time LLM Streaming 2024
April 2024 - NLIT Cloudera Real-Time LLM Streaming 2024
 
Student profile product demonstration on grades, ability, well-being and mind...
Student profile product demonstration on grades, ability, well-being and mind...Student profile product demonstration on grades, ability, well-being and mind...
Student profile product demonstration on grades, ability, well-being and mind...
 
Conf42-LLM_Adding Generative AI to Real-Time Streaming Pipelines
Conf42-LLM_Adding Generative AI to Real-Time Streaming PipelinesConf42-LLM_Adding Generative AI to Real-Time Streaming Pipelines
Conf42-LLM_Adding Generative AI to Real-Time Streaming Pipelines
 
Defining Constituents, Data Vizzes and Telling a Data Story
Defining Constituents, Data Vizzes and Telling a Data StoryDefining Constituents, Data Vizzes and Telling a Data Story
Defining Constituents, Data Vizzes and Telling a Data Story
 
Learn How Data Science Changes Our World
Learn How Data Science Changes Our WorldLearn How Data Science Changes Our World
Learn How Data Science Changes Our World
 
How we prevented account sharing with MFA
How we prevented account sharing with MFAHow we prevented account sharing with MFA
How we prevented account sharing with MFA
 
modul pembelajaran robotic Workshop _ by Slidesgo.pptx
modul pembelajaran robotic Workshop _ by Slidesgo.pptxmodul pembelajaran robotic Workshop _ by Slidesgo.pptx
modul pembelajaran robotic Workshop _ by Slidesgo.pptx
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdf
 
detection and classification of knee osteoarthritis.pptx
detection and classification of knee osteoarthritis.pptxdetection and classification of knee osteoarthritis.pptx
detection and classification of knee osteoarthritis.pptx
 
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
 
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
 
ASML's Taxonomy Adventure by Daniel Canter
ASML's Taxonomy Adventure by Daniel CanterASML's Taxonomy Adventure by Daniel Canter
ASML's Taxonomy Adventure by Daniel Canter
 
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝DelhiRS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
 
Easter Eggs From Star Wars and in cars 1 and 2
Easter Eggs From Star Wars and in cars 1 and 2Easter Eggs From Star Wars and in cars 1 and 2
Easter Eggs From Star Wars and in cars 1 and 2
 
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档
 
Student Profile Sample report on improving academic performance by uniting gr...
Student Profile Sample report on improving academic performance by uniting gr...Student Profile Sample report on improving academic performance by uniting gr...
Student Profile Sample report on improving academic performance by uniting gr...
 
20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdf20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdf
 

How to migrate_to_sharding_with_spider

  • 1. How to migrate to sharding with Spider Kentoku SHIBA
  • 2. 1. What is SPIDER? 2. Why SPIDER? what SPIDER can do for you? 3. How to migrate to sharding using Replication 4. How to migrate to sharding using Trigger 5. How to migrate to sharding using Spider function 6. How to migrate to sharding using Vertical Partitioning Storage Engine Agenda
  • 4. What is the Spider Storage Engine? Spider is a sharding solution and proxying solution. Spider Storage Engine is a plugin of MariaDB/MySQL. Spider tables can be used to federate from other servers MariaDB/MySQL/OracleDB tables as if they stand on local server. And Spider can create database sharding by using table partitioning feature.
  • 5. What is the Spider Storage Engine? 1.request 2. Execute SQL 4.response AP All databases can be used as ONE database through Spider. APAP AP AP SPIDER (MariaDB/MySQL) MariaDB tbl_a MySQL tbl_b SPIDER (MariaDB/MySQL) SPIDER (MariaDB/MySQL) OracleDB tbl_c 3. Distributed SQL3. Distributed SQL 3. Distributed SQL
  • 6. What is the Spider Storage Engine? Spider is bundled in MariaDB from 10.0 and all patches for MariaDB is applied in 10.3
  • 7. Why SPIDER? What SPIDER can do for you?
  • 8. Why Spider? What Spider can do for you? For federation You can attach tables from other servers or from local server by using Spider. For sharding You can divide huge tables and huge traffics to multiple servers by using Spider.
  • 9. Why Spider? What Spider can do for you? Cross shard join You can join all tables by using Spider, even if tables are on different servers.
  • 10. simple sharding solution Join operation with simple sharding solution (without Spider) DB1 tbl_a1 1.Request 2. Execute SQL with JOIN 3.Response DB2 AP Join operation requires that all joined tables are on same server. APAP AP AP tbl_a2tbl_b1 tbl_b2
  • 11. Join operation with Spider 1.request 2. Execute SQL with JOIN 3.response AP You can JOIN all tables, even if tables are on different servers. APAP AP AP SPIDER (MariaDB/MySQL) DB1 tbl_a1 DB2 tbl_a2tbl_b1 tbl_b2
  • 12. Why Spider? What Spider can do for you? Join push down If it is possible, Spider executes JOIN operation at data node directly.
  • 13. JOIN push down 1.request 2. Execute SQL with JOIN 3.response AP If all tables are on same data node, Spider executes JOIN operation on data node directly. APAP AP AP SPIDER (MariaDB/MySQL) DB1 tbl_a DB2 tbl_ctbl_b tbl_d
  • 14. JOIN push down Simple join operation are two times faster on simple JOIN pushdown test. Also, in this pushdown of JOIN, when aggregate functions are included in the query, since the aggregation processing is also executed at the data node, the amount of data transfer is greatly reduced and it becomes super high speed.
  • 15. How to migrate to sharding with Spider using Replication
  • 16. Initial Structure There is 1 MariaDB server without Spider. DB1 tbl_a Create table tbl_a ( col_a int, col_b int, primary key(col_a) ) engine = InnoDB;
  • 17. Step 1 (for migrating) Create table on DB3 and DB4. Then create Spider table on DB2. DB1 tbl_a DB3 tbl_a col_a%2=1col_a%2=0 DB2 DB4 tbl_a Create table tbl_a ( col_a int, col_b int, primary key(col_a) ) engine = Spider Connection ‘ table “tbl_a”, user “user”, password “pass” ‘ partition by list( mod(col_a, 2)) ( partition pt1 values in(0) comment ‘host “DB3”’, partition pt2 values in(1) comment ‘host “DB4”’ ); tbl_a
  • 18. Step 2 DB1 tbl_a DB3 tbl_a col_a%2=1col_a%2=0 DB2 DB4 tbl_a Copy table data from DB1 to DB2. (Use mysqldump with “--master-data = 1 or 2” option) tbl_a
  • 19. Step 3 Start replication from DB1 to DB2. Wait for resolving replication delay. DB1 tbl_a DB3 tbl_a col_a%2=1col_a%2=0 DB2 DB4 tbl_a tbl_a replication
  • 20. Step 4 Stop client access for DB1. Wait for resolving replication delay. Switch client access from DB1 to DB2. DB1 tbl_a DB3 tbl_a col_a%2=1col_a%2=0 DB2 DB4 tbl_a tbl_a replication
  • 21. Finish Stop replication on DB2. Remove DB1. DB3 tbl_a col_a%2=1col_a%2=0 DB2 DB4 tbl_a tbl_a
  • 22. Pros and Cons of Replication way Pros 1. No need to manage lock size for coping. 2. Support non primary key table. Cons 1. Need to stop writing.
  • 23. How to migrate to sharding with Spider using Trigger
  • 24. Initial Structure There is 1 MariaDB server without Spider. DB1 tbl_aCreate table tbl_a ( col_a int, col_b int, primary key(col_a) ) engine = InnoDB;
  • 25. Step 1 (for migrating) Create table on DB2 and DB3. Then create Spider table on DB1. DB1 tbl_a DB2 tbl_a col_a%2=1col_a%2=0 DB3 tbl_a tbl_a2 Create table tbl_a2 ( col_a int, col_b int, primary key(col_a) ) engine = Spider Connection ‘ table “tbl_a”, user “user”, password “pass” ‘ partition by list( mod(col_a, 2)) ( partition pt1 values in(0) comment ‘host “DB2”’, partition pt2 values in(1) comment ‘host “DB3”’ );
  • 26. Step 2 Create triggers on DB1. (For copying insert, update and delete. If you use “truncate” for tbl_a, you should better to use other way) DB1 tbl_a DB2 tbl_a col_a%2=1col_a%2=0 DB3 tbl_a tbl_a2 delimiter | create trigger tbl_a_i after insert on tbl_a for each row insert into tbl_a2 (a,b) values (new.a, new.b); | create trigger tbl_a_u after update on tbl_a for each row update tbl_a2 set a = new.a, b = new.b where a = old.a; | create trigger tbl_a_d after delete on tbl_a for each row delete from tbl_a2 where a = old.a; | delimiter ;
  • 27. Step 3 DB1 tbl_a DB2 tbl_a col_a%2=1col_a%2=0 DB3 tbl_a tbl_a2 Insert select from tbl_a to tbl_a2. (Please take care of locking time for tbl_a and tbl_a2.)
  • 28. Step 4 DB2 tbl_a col_a%2=1col_a%2=0 DB3 tbl_a Rename table from tbl_a2 to tbl_a. Rename table tbl_a to tbl_a3, tbl_a2 to tbl_a; DB1 tbl_a3 tbl_a
  • 30. Pros and Cons of Trigger way Pros 1. No need to stop services. 2. Easy to copy.(Simple command) Cons 1. Impossible to support truncate. 2. Need to manage lock size at coping. 3. Impossible to support non primary key.
  • 31. How to migrate to sharding with Spider using Spider function
  • 32. Initial Structure There is 1 MariaDB server without Spider. DB1 tbl_aCreate table tbl_a ( col_a int, col_b int, primary key(col_a) ) engine = InnoDB;
  • 33. Step 1 (for migrating) Create table on DB2 and DB3. Then create Spider table on DB1. DB1 tbl_a DB2 tbl_a col_a%2=1col_a%2=0 DB3 tbl_a tbl_a2 Create table tbl_a2 ( col_a int, col_b int, primary key(col_a) ) engine = Spider Connection ‘ table “tbl_a”, user “user”, password “pass” ‘ partition by list( mod(col_a, 2)) ( partition pt1 values in(0) comment ‘host “DB2”’, partition pt2 values in(1) comment ‘host “DB3”’ );
  • 34. Step 2 Create tables on DB1. DB1 tbl_a DB2 tbl_a col_a%2=1col_a%2=0 DB3 tbl_a tbl_a2Create table tbl_a4 ( col_a int, col_b int, primary key(col_a) ) engine = Spider Connection ‘ host “localhost” table “tbl_a3 tbl_a2”, lst “0 2”, user “user”, password “pass” ‘; tbl_a4 tbl_a3 Create table tbl_a3 ( col_a int, col_b int, primary key(col_a) ) engine = InnoDB;
  • 35. Step 3 Rename table on DB1. DB1 tbl_a3 DB2 tbl_a col_a%2=1col_a%2=0 DB3 tbl_a tbl_a2 Rename table tbl_a3 to tbl_a5, tbl_a to tbl_a3, tbl_a4 to tbl_a; tbl_a tbl_a5
  • 36. Step 4 Copy data on DB1. DB1 tbl_a3 DB2 tbl_a col_a%2=1col_a%2=0 DB3 tbl_a tbl_a2 Select spider_copy_table(‘tbl_a’, ‘’, ‘’); tbl_a tbl_a5
  • 37. Step 5 Rename table on DB1. DB1 tbl_a3 DB2 tbl_a col_a%2=1col_a%2=0 DB3 tbl_a tbl_aRename table tbl_a2 to tbl_a6, tbl_a5 to tbl_a2, tbl_a to tbl_a7, tbl_a6 to tbl_a; tbl_a7 tbl_a2
  • 39. Pros and Cons of Spider function way Pros 1. No need to stop services. 2. Easy to copy.(Simple command. Lock size is managed by Spider) Cons 1. Impossible to support non primary key.
  • 40. How to migrate to sharding with Spider using Vertical Partitioning Storage Engine
  • 41. Initial Structure There is 1 MariaDB server without Spider. DB1 tbl_a Create table tbl_a ( col_a int, col_b int, primary key(col_a), key idx2(col_b) ) engine = InnoDB;
  • 42. Step 1 (for migrating) Create table on DB2 and DB3. Then create tables on DB1. DB1 tbl_a DB2 col_a%2=1col_a%2=0 DB3 Create table tbl_pk ( col_a int, primary key(col_a) ) engine = Spider Connection ‘ table “tbl_pk”, user “user”, password “pass” ‘ partition by list( mod(col_a, 2)) ( partition pt1 values in(0) comment ‘host “DB2”’, partition pt2 values in(1) comment ‘host “DB3”’ ); tbl_pk tbl_pk tbl_pk
  • 43. Step 2 Create table on DB4 and DB5. Then create tables on DB1. DB1 tbl_a DB2 col_a%2=1col_a%2=0 DB3 Create table tbl_a3 ( col_a int, col_b int, key idx1(col_a), key idx2(col_b) ) engine = Spider Connection ‘ table “tbl_a2”, user “user”, password “pass” ‘ partition by list( mod(col_b, 2)) ( partition pt1 values in(0) comment ‘host “DB4”’, partition pt2 values in(1) comment ‘host “DB5”’ ); tbl_pk tbl_a2 tbl_pk tbl_pk DB4 col_b%2=1col_b%2=0 DB5 tbl_a2 tbl_a2
  • 44. Step 3 Create tables on DB1. DB1 tbl_a DB2 col_a%2=1col_a%2=0 DB3 Create table tbl_a3 ( col_a int, col_b int, primary key(col_a), key idx2(col_b) ) engine = VP Comment ‘ ctm “1”, ist “1”, pcm “1”, tnl “tbl_a4 tbl_pk tbl_a2” ‘; tbl_a3 tbl_pk tbl_a2 tbl_pk tbl_pk DB4 col_b%2=1col_b%2=0 DB5 tbl_a2 tbl_a2 Create table tbl_a4 ( col_a int, col_b int, primary key(col_a) ) engine = InnoDB; tbl_a4
  • 45. Step 4 Rename tables on DB1. DB1 DB2 col_a%2=1col_a%2=0 DB3 tbl_a tbl_pk tbl_a2 tbl_pk tbl_pk DB4 col_b%2=1col_b%2=0 DB5 tbl_a2 tbl_a2 Rename table tbl_a4 to tbl_a5, tbl_a to tbl_a4, tbl_a3 to tbl_a; tbl_a5 tbl_a4
  • 46. Step 5 Copy data from tbl_a4 to tbl_pk and tbl_a2 on DB1. DB1 DB2 col_a%2=1col_a%2=0 DB3 tbl_a tbl_pk tbl_a2 tbl_pk tbl_pk DB4 col_b%2=1col_b%2=0 DB5 tbl_a2 tbl_a2 Select vp_copy_tables(‘table_a’, ‘tbl_a4’, ‘tbl_pk tbl_a2’); tbl_a5 tbl_a4
  • 47. Step 6 Alter table tbl_a on DB1. DB1 DB2 col_a%2=1col_a%2=0 DB3 tbl_a tbl_pk tbl_a2 tbl_pk tbl_pk DB4 col_b%2=1col_b%2=0 DB5 tbl_a2 tbl_a2Alter table tbl_a comment ‘ pcm “1”, tnl “tbl_pk tbl_a2” ‘; tbl_a5 tbl_a4
  • 48. Finish Drop table tbl_a on DB1. DB1 DB2 col_a%2=1col_a%2=0 DB3 tbl_a tbl_pk tbl_a2 tbl_pk tbl_pk DB4 col_b%2=1col_b%2=0 DB5 tbl_a2 tbl_a2 Drop table tbl_a4, tbl_a5;
  • 49. Pros and Cons of VP way Pros 1. No need to stop services. 2. Support spiltting by non unique columns. 3. Easy to copy.(Simple command. Lock size is managed by VP) Cons 1. VP storage engine is required. 2. Impossible to support non primary key.
  • 50. Thank you for taking your time!!