SlideShare uma empresa Scribd logo
1 de 50
Baixar para ler 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!!

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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
 

Semelhante a 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
 

Semelhante a 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
 

Mais de 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
 

Mais de 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
 

Último

VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...Suhani Kapoor
 
RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998YohFuh
 
B2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxB2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxStephen266013
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptxAnupama Kate
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxfirstjob4
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% SecurePooja Nehwal
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxolyaivanovalion
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxolyaivanovalion
 
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxBPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxMohammedJunaid861692
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysismanisha194592
 
Unveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystUnveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystSamantha Rae Coolbeth
 
Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxolyaivanovalion
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingNeil Barnes
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxolyaivanovalion
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxolyaivanovalion
 
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改atducpo
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusTimothy Spann
 

Último (20)

VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
 
RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998
 
B2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxB2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docx
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptx
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptx
 
Sampling (random) method and Non random.ppt
Sampling (random) method and Non random.pptSampling (random) method and Non random.ppt
Sampling (random) method and Non random.ppt
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptx
 
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxBPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysis
 
Unveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystUnveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data Analyst
 
Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptx
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data Storytelling
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptx
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptx
 
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and Milvus
 

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!!