Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
RethinkDB Cluster Monitoring
Search
Ryan Paul
February 17, 2015
Programming
0
700
RethinkDB Cluster Monitoring
Display RethinkDB cluster statistics in a live graph using Go, Socket.io, and Epoch.
Ryan Paul
February 17, 2015
Tweet
Share
More Decks by Ryan Paul
See All by Ryan Paul
Using Async Iterators in Node.js
segphault
0
970
Introduction to Basejump
segphault
1
1.3k
Realtime data visualization with RethinkDB and Epoch
segphault
1
690
Realtime web apps with RethinkDB and full-stack Ruby
segphault
2
310
Jupyter and RethinkDB
segphault
1
670
Using RethinkDB with Tornado & EventMachine
segphault
0
640
RethinkDB Training Course
segphault
3
410
Composing frontend Web applications with MontageJS
segphault
4
1.4k
Intro to MontageJS
segphault
1
190
Other Decks in Programming
See All in Programming
EventSourcingの理想と現実
wenas
5
2k
今日で分かる!カスタムコップの作り方
krpk1900
2
360
Vaporモードを大規模サービスに最速導入して学びを共有する
kazukishimamoto
4
4.2k
cXML という電子商取引の トランザクションを支える プロトコルと向きあっている話
phigasui
2
2k
watsonx.ai Dojo #3 プロンプトエンジニアリング入門
oniak3ibm
PRO
0
490
組織に自動テストを書く文化を根付かせる戦略(2024秋版) / Building Automated Test Culture 2024 Autumn Edition
twada
PRO
10
4.3k
弊社の「意識チョット低いアーキテクチャ」10選
texmeijin
4
13k
Googleのテストサイズを活用したテスト環境の構築
toms74209200
0
240
テスト駆動開発✅️
akitoshiga
1
210
Nuxtベースの「WXT」でChrome拡張を作成する | Vue Fes 2024 ランチセッション
moshi1121
1
290
Re:proS_案内資料
rect
0
260
讓數據說話:用 Python、Prometheus 和 Grafana 講故事
eddie
0
320
Featured
See All Featured
Building Adaptive Systems
keathley
38
2.2k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
32
1.8k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Ruby is Unlike a Banana
tanoku
96
11k
Six Lessons from altMBA
skipperchong
26
3.4k
Documentation Writing (for coders)
carmenintech
65
4.4k
Building Better People: How to give real-time feedback that sticks.
wjessup
363
19k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
664
120k
What's new in Ruby 2.0
geeforr
342
31k
What's in a price? How to price your products and services
michaelherold
243
11k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Transcript
RethinkDB Cluster Monitoring
Ryan Paul RethinkDB Evangelist @segphault
None
RethinkDB 1.16 • Changefeeds • Cluster admin • System tables
Backend Go and RethinkDB
Watch cluster stats r.Db("rethinkdb").Table("stats").Changes()
"new_val": { "id": ["cluster"], "query_engine": { "client_connections": 10, "clients_active": 2,
"queries_per_sec": 12.971126524000002, "read_docs_per_sec": 0, "written_docs_per_sec": 7.4114252490000005 } }
Watch cluster stats r.Db("rethinkdb").Table("stats"). Filter(r.Row.Field("id").AtIndex(0).Eq("cluster")). Changes()
server, _ := socketio.NewServer(nil) stats, _ := r.Db("rethinkdb").Table("stats"). Filter(r.Row.Field("id").AtIndex(0).Eq("cluster")). Changes().Run(conn)
go func() { var change r.WriteChanges for stats.Next(&change) { server.BroadcastTo( "monitor", "stats", change.NewValue) } }() Pass changes to Socket.io
Frontend Epoch and Polymer
Epoch A realtime charting library for building high performance visualizations.
Plot data with Epoch function timestamp() { return (new Date).getTime()
/ 1000; } var chart = $("#chart").epoch({ type: "time.line", axes: ["left", "bottom"], data: [ {label: "Writes", values: [{time: timestamp(), y: 0}]}, {label: "Reads", values: [{time: timestamp(), y: 0}]} ] }); var socket = io.connect(); socket.on("stats", function(data) { cluster.stats = data.query_engine; chart.push([ {time: timestamp(), y: cluster.stats.written_docs_per_sec}, {time: timestamp(), y: cluster.stats.read_docs_per_sec} ]); });
Bonus IRC bot for issue notification
Initialize bot ircConf := irc.NewConfig("mybot") ircConf.Server = "localhost:6667" bot :=
irc.Client(ircConf) bot.HandleFunc("connected", func(conn *irc.Conn, line *irc.Line) { log.Println("Connected to IRC server") conn.Join("#mychannel") })
Attach changefeed type Issue struct { Description, Type string }
issues, _ := r.Db("rethinkdb").Table("current_issues"). Filter(r.Row.Field("critical").Eq(true)). Changes().Field("new_val").Run(db) go func() { var issue Issue for issues.Next(&issue) { if issue.Type != "" { text := strings.Split(issue.Description, "\n")[0] message := fmt.Sprintf("(%s) %s", issue.Type, text) bot.Privmsg("#mychannel", message) } } }()
Resources • http://rethinkdb.com/blog/realtime-cluster-monitoring/ • https://github.com/rethinkdb/rethink-status/tree/go-backend • http://rethinkdb.com/docs/quickstart/ Questions?