Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Vitessの基礎.pdf
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
yosshi_
July 01, 2019
Technology
1.6k
7
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Vitessの基礎.pdf
yosshi_
July 01, 2019
More Decks by yosshi_
See All by yosshi_
From Vanilla Kubernetes to a Batteries-Included Platform: Developer Experience at 1,300+ Clusters
yosshi_
0
680
From 5 to 1,300+ Clusters: Declarative Scaling for Private Kubernetes
yosshi_
1
83
Scaling In Kubernetes Safely on On-Prem KaaS Across 1,300+ Clusters and 40,000+ Nodes
yosshi_
1
130
Getting Started with Kubernetes Observability
yosshi_
8
2.8k
PromQL_Compatibility_Testing_Recap
yosshi_
1
1.2k
プロダクト誕生の背景から学ぶ PrometheusとGrafana Loki
yosshi_
11
3.9k
これから学ぶKubernetesのReconciliation Loop
yosshi_
16
5.3k
伝統的なエンプラ企業で取り組むインフラの設計書のモダナイゼーション.pdf
yosshi_
13
6.4k
KubeCon2019_NA_Recap__NATS_.pdf
yosshi_
0
230
Other Decks in Technology
See All in Technology
あるけみー式LTスライド作成術
alchemy1115
1
160
プロダクト思考 × 基盤思考を AIで実現する Compound Engineering
tkc66buzz
1
310
Sigmaで作る業務アプリ
kazushiro_honma
0
110
Omarchy Quattro の日本語設定周り
simosako
2
140
AI時代のAPI品質を支えるガードレール / API Guardrails for API quality in the AI era
yokawasa
1
210
When Does a Local Qwen Start to Break
morshoto
0
200
幾何アルゴリズムで なめらかなピン操作を / iOSDC Japan 2026 / smoothpin
kazumanagano
0
250
アプリをもっと"iOSアプリっぽく"する小さな工夫 / Small Touches That Make Your App Feel More Like an iOS App
matsuji
1
300
GuardDuty 検知対応を DevOps Agent で効率化しようとしている話 / GuardDuty Investigations with DevOps Agent
masahirokawahara
1
350
AIに丸投げしないトイル削減 / Eliminating Toil Without Leaving It All to AI
kohbis
4
1.1k
2026-09-09 【sigma_ucj#1】Sigma を IaC 管理したい! / IaC for Sigma
civitaspo
0
110
目の前の楽しいが人生を変える - コミュニティの螺旋の歩き方と楽しむコツ / change your life
soudai
PRO
4
360
Featured
See All Featured
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
470
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
270
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
230
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
A better future with KSS
kneath
240
18k
Believing is Seeing
oripsolob
1
210
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
820
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
2
3.8k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
270
The #1 spot is gone: here's how to win anyway
tamaranovitovic
3
1.2k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
We Have a Design System, Now What?
morganepeng
55
8.3k
Transcript
の基礎 恐るることなかれ! Cloud NativeリレーショナルDB特集!! -- cndjp第12回
自己紹介 • 吉村 翔太 • コミュニケーションズ所属 • データサイエンスチーム • インフラエンジニア
データエンジニアリング • 、 • 趣味:ボードゲーム • コミュニティ活動
本日の目次 • Vitessとは • Vitessのアーキテクチャ • Vitessのシャーディングの仕組み • 参考
とは
Vitessとは • シャーディングによるMySQLの水平スケーリングのた めのデータベース・クラスタリングシステム • YouTubeによって開発された技術 – First Commit in
2010 – In Production at YouTube since 2011 • CNCFに16番目にホストされたプロジェクト(現在は Incubating)
Cloud Native Landscape 参考 https://landscape.cncf.io/ 関連
Cloud Native Landscape DB編 参考 https://landscape.cncf.io/
Vitessの特徴 • パフォーマンス – パフォーマンスを最適化するた めの機能の提供 – トランザクション管理、全体の スループットを最適化 •
データベースの保護 – 潜在的に問題のあるクエリー からの保護 • クラスター管理・監視 – WebベースのGUI、マスター管 理ツール – パフォーマンスの監視・ 診断・分析ツールの提供 • MySQLとの互換性 – MySQLのクエリとの互換性 MySQLクライアントからそのま ま利用可能 – (一部非互換あり)
MySQLに対するVitessの改良点 参考 ttps://vitess.io/docs/overview/whatisvitess/ • 接続プーリング – MySQLに比べて接続のオーバーヘッドが少ないので数千の接続数が可能 • パフォーマンス –
例えばLIMITがないクエリなどをパフォーマンスを低下させるクエリを自動で書き換える • シャード管理 – メタデータをetcdで管理し、ユーザが を経由して接続する方式を取っているため ユーザ側がVitessの構成変更を意識することなく接続できる • ライフサイクルの管理の自動化 – マスターフェイルオーバーやデータバックアップをVitessが自動で管理
Vitessのアーキテクチャ
Vitessのアーキテクチャ
Vitessの構成要素(1/3) • Topology – サーバー、シャーディング・スキームなどの構成情報を 管理するメタデータストア • Kubernetesではetcdを利用 • VTgate
– アプリケーションからのクエリを正しいVTtabletにルー ティングし、統合された結果をクライアントに返す軽量な プロキシサーバー • アプリケーションはデータの配置(Shard)を意識することなく、 VTgateに対して処理を投げるだけ
Vitessの構成要素(2/3) • tablet – mysqldとVTtabletをセットでこう呼ぶ – tabletはmaster/replica/rdonlyなどのタイプが割 り当てられる • VTtablet
– MySQLデータベースの前に置かれているプロキ シサーバー – MySQLインスタンスと1:1、有害なクエリから MySQLを保護
Vitessの構成要素(3/3) • VTctld – Vitessクラスタに対する管理操作を受け付けるHTTPサーバー – GUIも提供 • VTctl –
Vitessクラスタを管理するためのコマンドラインツール
Vitess on Kubernetes
参考 minikube上にhelmで立ち上げた場合 参考 https://github.com/vitessio/vitess/blob/master/examples/helm/101_initial_cluster.yaml
Vitessのアーキテクチャ(おさらい)
Vitessのシャーディングの仕組み
シャーディング • シャーディングとは – 2つ以上のデータベースにデータを分割して格納すること – Shardを追加することでDBのスケールアウトし、パフォーマンスの向上を狙う技 術 • Vitessは2種類のShardingをサポート
– Vertical Sharding(垂直): テーブル毎に複数のデータベースに分けて格納 – Horizontal Sharding(水平): 1つのテーブルを複数のShardに分割し、 複数のデータベースに分けて格納
Vitessのワークロード Level1
Vitessのワークロード Level2 を分割
Vitessのワークロード Level3 をシャーディング
テーブルのシャーディング A列 B列 C列 … … … 1235 20181004 yyy
1236 20181005 zzz … … … A列 B列 C列 … … … 1234 20181003 xxx … … … のルール を定義 { } A列 B列 C列 … … … 1234 20181003 xxx 1235 20181004 yyy 1236 20181005 zzz … … …
シャーディングのロジック Shard -40 40-80 80-C0 C0- Keyspace ID … 7F
FF FF FF 80 00 00 00 80 00 00 01 … Key Range :00 00 00 00 – 3F FF FF FF :3F FF FF FF – 7F FF FF FF :80 00 00 00 – C0 00 00 00 :C0 00 00 00 – FF FF FF FF A列 B列 … … 1234 1235 1236 … … … ※ の名前は (キー範囲)の開始と終了 進数で表示されハイフンで区切られる テーブル { } • Vindexを付与した列からKeyspace IDを算出(Hashなど複数種のサポート) • Keyspace IDとShardとのマッピングに従ってデータを配置
VindexとKeyspace ID • Vindex – キーとなる列とKeyspace IDの算出ロジックを定義 • 算出ロジックは選択可能 –
例:Hash/Functional/Lookup Unique/Lookup NonUnique – テーブルは複数のVindexを持つことができる • プライマリVindex: Shard分割に使用する一意な列を指定(Sharding Key) • セカンダリVindex: プライマリVindexを使用しないWHERE句の最適化を提供 (クロスシャードIndex) • Keyspace ID – 特定の行がどのShardに存在するかを決定・特定するために使用される値 – Vitessが内部的に使用
Vitessのワークロード Level3(おさらい) をシャーディング
参考
の状態 参考 mysqlの操作が可能
参考 VTctldのGUI
参考 VTctldのGUI
参考 VTctldのGUI
参考 VTctldのGUI
参考 vtgateのGUI
参考 vtgateのGUI
Special Thanks!! @cotoc88 本スライドの監修
• JapanContainerDays v18.12 Kubernetesが超強力な分散RDBに vitessの真価を大検証してみた - 早川 博 , 茂
こと(日本オラクル) (https://speakerdeck.com/cotoc/20181204-vitess-jkd-day1) • Kubecon China 2019でのToliver氏の発表 (https://kccncosschn19eng.sched.com/speaker/toliver17?iframe=no&w=100%&sidebar=yes&bg=no) • Vitessの公式サイトのPresentations and Videos (https://vitess.io/docs/resources/presentations/) 参考