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
780
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
1.1k
Introduction to Basejump
segphault
1
1.4k
Realtime data visualization with RethinkDB and Epoch
segphault
1
740
Realtime web apps with RethinkDB and full-stack Ruby
segphault
2
320
Jupyter and RethinkDB
segphault
1
730
Using RethinkDB with Tornado & EventMachine
segphault
0
700
RethinkDB Training Course
segphault
3
440
Composing frontend Web applications with MontageJS
segphault
4
1.5k
Intro to MontageJS
segphault
1
200
Other Decks in Programming
See All in Programming
『リコリス・リコイル』に学ぶ!! 〜キャリア戦略における計画的偶発性理論と変わる勇気の重要性〜
wanko_it
1
590
マイコンでもRustのtestがしたい その2/KernelVM Tokyo 18
tnishinaga
2
2.3k
Claude Code と OpenAI o3 で メタデータ情報を作る
laket
0
140
開発チーム・開発組織の設計改善スキルの向上
masuda220
PRO
13
7.2k
AWS Serverless Application Model入門_20250708
smatsuzaki
0
120
decksh - a little language for decks
ajstarks
4
21k
TDD 実践ミニトーク
contour_gara
0
140
【第4回】関東Kaggler会「Kaggleは執筆に役立つ」
mipypf
0
740
tool ディレクティブを導入してみた感想
sgash708
1
150
Dart 参戦!!静的型付き言語界の隠れた実力者
kno3a87
0
200
あのころの iPod を どうにか再生させたい
orumin
2
2.5k
学習を成果に繋げるための個人開発の考え方 〜 「学習のための個人開発」のすすめ / personal project for leaning
panda_program
1
110
Featured
See All Featured
Code Review Best Practice
trishagee
70
19k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3.1k
A designer walks into a library…
pauljervisheath
207
24k
Java REST API Framework Comparison - PWX 2021
mraible
33
8.8k
Building a Scalable Design System with Sketch
lauravandoore
462
33k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
283
13k
Six Lessons from altMBA
skipperchong
28
4k
4 Signs Your Business is Dying
shpigford
184
22k
Balancing Empowerment & Direction
lara
2
580
GitHub's CSS Performance
jonrohan
1031
460k
Scaling GitHub
holman
462
140k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
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?