SlideShare uma empresa Scribd logo
1 de 16
Baixar para ler offline
Spider Storage Engine 作ってみた


  MySQLのストレージエンジンによる
      「RDBMS sharding」
はじめに




MySQLのストレージエンジンで、
shardingを実装してみました。
はじめに



アプリケーションからは、MySQLの
テーブルとして利用できるので、
使用感がshardingする前と変わらな
いのが特徴です。
構成例
                  col_a%3=0                col_a%3=1   col_a%3=2

                   tbl_a                    tbl_a       tbl_a
                    DB1                      DB2         DB3
                                   3.Choose a connection and get data

                   tbl_a                    tbl_a       tbl_a
                    DB                     DB            DB
2.Request                     4.Response
                 AP1
  from application                        AP2
                                to application           AP3

1.Request                  5.Response
  from client                  to client
tbl_a.col_a = 1


                   の部分にSpiderのテーブルがあります。
動作イメージ

    tbl_a                tbl_b          tbl_c
    DB1                  DB2            DB3



                     SPIDER
                            2.Just connect to spider

                          AP

         1.Request               3.Response
          select tbl_b
Vertical Partitioning
Vertical Partitioning

MySQLのストレージエンジンとして、
Spiderストレージエンジンのほかに
Vertical Partitioning
ストレージエンジン
というものを作ってみました。
Vertical Partitioning



今年の初めに、
「FriendFeed では MySQL を使いどのように
スキーマレスのデータを保存しているのか」
http://hyuki.com/yukiwiki/wiki.cgi?HowFriendFeedUsesMySqlToStoreSchemaLessData

という記事が話題になったかと思いますが、
Vertical Partitioning




Vertical PartitioningとSpiderを
組み合わせて利用すると
これを、DBの中で、RDBの機能は
そのままに、実現できるようになります。
Spider + Vertical Partitioning構成例
  col_a%3=0 col_a%3=1 col_a%3=2            col_b%3=0 col_b%3=1 col_b%3=2

    tbl_a1       tbl_a1      tbl_a1           tbl_a2   tbl_a2     tbl_a2
     DB1          DB2        DB3              DB4       DB5           DB6


                             tbl_a1        tbl_a2
Vertical Partitioning テーブル
このケースでは同一カラムを持ち、                      tbl_a
異なるルールでパーティションさ
れたtbl_a1、tbl_a2を子テーブル
に持っている                                DB
          select ~ from tbl_a                   select ~ from tbl_a
              where col_a = 1                   where col_b = 1
                                      AP

               の部分にSpiderのテーブルがあります。
Spider + Vertical Partitioning



また、Vertical Partitioningストレージエンジンは、
子テーブルのデータをサービス停止なしで、
別の子テーブルにコピーすることができるので、
(vp_copy_tablesというUDFを利用します)
スキーマの変更やreshardingを動的に行うことが
可能です。
Spider + Vertical Partitioning




これで、データベースのテーブルの構造・データを
外からは何も変わっていないように見せながら、
DB内で柔軟に分解再構築できるようになります。
(サービス停止の必要はありません)
まとめ


以上、「RDBをRDBのままshardingするために、
SpiderとVertical Partitioningを作ってみた」という
お話でした。




Amazon RDSの限界越え用にも是非使って
みてください。
おまけ



今、Spiderのクラスタ機能を実装中です。

Spiderのクラスタは、テーブル(パーティション)
レベルクラスタリングを採用しており、テーブル
(パーティション)単位で異なる監視サーバを
割り当てられます。
おまけ

このため、独特な可用性設計が可能で、
「Webサーバ2台、DBサーバ2台で、とりあえず
冗長化はしておくか」という環境から、
大災害にあっても稼動し続けられる
(もしくは、高速復旧できる)システムの
構築まで、利用できるようになる予定です。

ご期待下さい。
Any Questions?


Thank you for taking
    your time!!



  斯波健徳
  http://wild-growth-ja.blogspot.com/
  http://spiderformysql.com

Mais conteúdo relacionado

Destaque

Spiderの最新動向 20131009
Spiderの最新動向 20131009Spiderの最新動向 20131009
Spiderの最新動向 20131009
Kentoku
 
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
 

Destaque (16)

Charms of MySQL 20101206(DTT#7)
Charms of MySQL 20101206(DTT#7)Charms of MySQL 20101206(DTT#7)
Charms of MySQL 20101206(DTT#7)
 
Spiderの最新動向 20131009
Spiderの最新動向 20131009Spiderの最新動向 20131009
Spiderの最新動向 20131009
 
Mroonga 20141129
Mroonga 20141129Mroonga 20141129
Mroonga 20141129
 
Introducing Spider 20101206(DTT#7)
Introducing Spider 20101206(DTT#7)Introducing Spider 20101206(DTT#7)
Introducing Spider 20101206(DTT#7)
 
Advanced Sharding Techniques with Spider (MUC2010)
Advanced Sharding Techniques with Spider (MUC2010)Advanced Sharding Techniques with Spider (MUC2010)
Advanced Sharding Techniques with Spider (MUC2010)
 
hs_spider_hs_something_20110906
hs_spider_hs_something_20110906hs_spider_hs_something_20110906
hs_spider_hs_something_20110906
 
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
 
Mroonga 20131129
Mroonga 20131129Mroonga 20131129
Mroonga 20131129
 
Galaxy Big Data with MariaDB
Galaxy Big Data with MariaDBGalaxy Big Data with MariaDB
Galaxy Big Data with MariaDB
 
Spider HA 20100922(DTT#7)
Spider HA 20100922(DTT#7)Spider HA 20100922(DTT#7)
Spider HA 20100922(DTT#7)
 
Spider Performance Test(Bench Mark04242009)
Spider Performance Test(Bench Mark04242009)Spider Performance Test(Bench Mark04242009)
Spider Performance Test(Bench Mark04242009)
 
MariaDB ColumnStore 20160721
MariaDB ColumnStore 20160721MariaDB ColumnStore 20160721
MariaDB ColumnStore 20160721
 
MariaDB Spider Mroonga 20140218
MariaDB Spider Mroonga 20140218MariaDB Spider Mroonga 20140218
MariaDB Spider Mroonga 20140218
 
Sharding with spider solutions 20160721
Sharding with spider solutions 20160721Sharding with spider solutions 20160721
Sharding with spider solutions 20160721
 
Using spider for sharding in production
Using spider for sharding in productionUsing spider for sharding in production
Using spider for sharding in production
 
Spiderストレージエンジンのご紹介
Spiderストレージエンジンのご紹介Spiderストレージエンジンのご紹介
Spiderストレージエンジンのご紹介
 

Semelhante a Spider Shibuya.pm #12

Sql server data store data access internals
Sql server data store data access internalsSql server data store data access internals
Sql server data store data access internals
Masayuki Ozawa
 
中規模Androidアプリ開発の過程に生じた問題と対策の紹介
中規模Androidアプリ開発の過程に生じた問題と対策の紹介中規模Androidアプリ開発の過程に生じた問題と対策の紹介
中規模Androidアプリ開発の過程に生じた問題と対策の紹介
NilOne Ltd.
 
Rails初心者レッスン lesson1 3rd edition
Rails初心者レッスン lesson1 3rd editionRails初心者レッスン lesson1 3rd edition
Rails初心者レッスン lesson1 3rd edition
Goh Matsumoto
 
Sql server 構築 運用 tips
Sql server 構築 運用 tipsSql server 構築 運用 tips
Sql server 構築 運用 tips
Masayuki Ozawa
 

Semelhante a Spider Shibuya.pm #12 (20)

Lv1から始めるWebサービスのインフラ構築
Lv1から始めるWebサービスのインフラ構築Lv1から始めるWebサービスのインフラ構築
Lv1から始めるWebサービスのインフラ構築
 
超実践 Cloud Spanner 設計講座
超実践 Cloud Spanner 設計講座超実践 Cloud Spanner 設計講座
超実践 Cloud Spanner 設計講座
 
Slub data structure
Slub data structureSlub data structure
Slub data structure
 
Sql server data store data access internals
Sql server data store data access internalsSql server data store data access internals
Sql server data store data access internals
 
中規模Androidアプリ開発の過程に生じた問題と対策の紹介
中規模Androidアプリ開発の過程に生じた問題と対策の紹介中規模Androidアプリ開発の過程に生じた問題と対策の紹介
中規模Androidアプリ開発の過程に生じた問題と対策の紹介
 
Db2をAWS上に構築する際のヒント&TIPS 2019年7月版
Db2をAWS上に構築する際のヒント&TIPS 2019年7月版Db2をAWS上に構築する際のヒント&TIPS 2019年7月版
Db2をAWS上に構築する際のヒント&TIPS 2019年7月版
 
What's new in Couchbase Server 4.0 ja
What's new in Couchbase Server 4.0 jaWhat's new in Couchbase Server 4.0 ja
What's new in Couchbase Server 4.0 ja
 
LINEのMySQL運用について
LINEのMySQL運用についてLINEのMySQL運用について
LINEのMySQL運用について
 
LINEのMySQL運用について 修正版
LINEのMySQL運用について 修正版LINEのMySQL運用について 修正版
LINEのMySQL運用について 修正版
 
DB2をAWS上に構築する際のヒント&TIPS
DB2をAWS上に構築する際のヒント&TIPSDB2をAWS上に構築する際のヒント&TIPS
DB2をAWS上に構築する際のヒント&TIPS
 
Rails初心者レッスン lesson1 3rd edition
Rails初心者レッスン lesson1 3rd editionRails初心者レッスン lesson1 3rd edition
Rails初心者レッスン lesson1 3rd edition
 
DB2をAWS上に構築する際のヒント&TIPS 2018年1月版
DB2をAWS上に構築する際のヒント&TIPS 2018年1月版DB2をAWS上に構築する際のヒント&TIPS 2018年1月版
DB2をAWS上に構築する際のヒント&TIPS 2018年1月版
 
SAP Application(DB)のソースエンドポイントとしての利用
SAP Application(DB)のソースエンドポイントとしての利用SAP Application(DB)のソースエンドポイントとしての利用
SAP Application(DB)のソースエンドポイントとしての利用
 
Web技術勉強会 第25回
Web技術勉強会 第25回Web技術勉強会 第25回
Web技術勉強会 第25回
 
MySQL Cluster 新機能解説 7.5 and beyond
MySQL Cluster 新機能解説 7.5 and beyondMySQL Cluster 新機能解説 7.5 and beyond
MySQL Cluster 新機能解説 7.5 and beyond
 
[db tech showcase Sapporo 2015] A26:SQL Server Data Page Structure Deep Dive ...
[db tech showcase Sapporo 2015] A26:SQL Server Data Page Structure Deep Dive ...[db tech showcase Sapporo 2015] A26:SQL Server Data Page Structure Deep Dive ...
[db tech showcase Sapporo 2015] A26:SQL Server Data Page Structure Deep Dive ...
 
Sql server 構築 運用 tips
Sql server 構築 運用 tipsSql server 構築 運用 tips
Sql server 構築 運用 tips
 
Awsのクラウドデザインパターンをwindows azureに持ってきてみた
Awsのクラウドデザインパターンをwindows azureに持ってきてみたAwsのクラウドデザインパターンをwindows azureに持ってきてみた
Awsのクラウドデザインパターンをwindows azureに持ってきてみた
 
AWS Black Belt Online Seminar 2017 Amazon DynamoDB
AWS Black Belt Online Seminar 2017 Amazon DynamoDB AWS Black Belt Online Seminar 2017 Amazon DynamoDB
AWS Black Belt Online Seminar 2017 Amazon DynamoDB
 
SQL Azure のシームレスな管理
SQL Azure のシームレスな管理SQL Azure のシームレスな管理
SQL Azure のシームレスな管理
 

Mais de Kentoku (6)

An issue of all slaves stop replication
An issue of all slaves stop replicationAn issue of all slaves stop replication
An issue of all slaves stop replication
 
How to migrate_to_sharding_with_spider
How to migrate_to_sharding_with_spiderHow to migrate_to_sharding_with_spider
How to migrate_to_sharding_with_spider
 
Spiderストレージエンジンの使い方と利用事例 他ストレージエンジンの紹介
Spiderストレージエンジンの使い方と利用事例 他ストレージエンジンの紹介Spiderストレージエンジンの使い方と利用事例 他ストレージエンジンの紹介
Spiderストレージエンジンの使い方と利用事例 他ストレージエンジンの紹介
 
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
 

Spider Shibuya.pm #12