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
810
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
770
Realtime web apps with RethinkDB and full-stack Ruby
segphault
2
340
Jupyter and RethinkDB
segphault
1
760
Using RethinkDB with Tornado & EventMachine
segphault
0
720
RethinkDB Training Course
segphault
3
460
Composing frontend Web applications with MontageJS
segphault
4
1.5k
Intro to MontageJS
segphault
1
210
Other Decks in Programming
See All in Programming
GISエンジニアから見たLINKSデータ
nokonoko1203
0
200
AIフル活用時代だからこそ学んでおきたい働き方の心得
shinoyu
0
120
余白を設計しフロントエンド開発を 加速させる
tsukuha
7
2.1k
React 19でつくる「気持ちいいUI」- 楽観的UIのすすめ
himorishige
11
5.8k
今から始めるClaude Code超入門
448jp
6
7.2k
16年目のピクシブ百科事典を支える最新の技術基盤 / The Modern Tech Stack Powering Pixiv Encyclopedia in its 16th Year
ahuglajbclajep
5
950
Architectural Extensions
denyspoltorak
0
250
AI Agent の開発と運用を支える Durable Execution #AgentsInProd
izumin5210
7
2.2k
カスタマーサクセス業務を変革したヘルススコアの実現と学び
_hummer0724
0
460
[KNOTS 2026登壇資料]AIで拡張‧交差する プロダクト開発のプロセス および携わるメンバーの役割
hisatake
0
190
そのAIレビュー、レビューしてますか? / Are you reviewing those AI reviews?
rkaga
6
4.4k
大規模Cloud Native環境におけるFalcoの運用
owlinux1000
0
260
Featured
See All Featured
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.8k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.9k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
34k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
2k
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
Deep Space Network (abreviated)
tonyrice
0
37
Music & Morning Musume
bryan
47
7.1k
We Have a Design System, Now What?
morganepeng
54
8k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
87
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.4k
How to build a perfect <img>
jonoalderson
1
4.9k
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?