Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
RethinkDB Cluster Monitoring
Ryan Paul
February 17, 2015
Programming
0
410
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
700
Introduction to Basejump
segphault
1
1k
Realtime data visualization with RethinkDB and Epoch
segphault
1
580
Realtime web apps with RethinkDB and full-stack Ruby
segphault
2
270
Jupyter and RethinkDB
segphault
1
450
Using RethinkDB with Tornado & EventMachine
segphault
0
450
RethinkDB Training Course
segphault
3
360
Composing frontend Web applications with MontageJS
segphault
4
980
Intro to MontageJS
segphault
1
170
Other Decks in Programming
See All in Programming
JGS594 Lecture 23
javiergs
PRO
0
400
Oculus Interaction SDK 概説 / xrdnk-caunity-LT4
xrdnk
0
170
アプリのログをチーム外で活用してもらうためにやったこと
shotakashihara
0
190
ebpfとWASMに思いを馳せる2022 / techfeed-conference-2022-ebpf-wasm-amsy810
masayaaoyama
0
660
Where and how to run UI tests (Droidcon London, 2021)
nonews
0
210
読みやすいコードを書こう
yutorin
0
400
The future of trust stores in Python
sethmlarson
0
180
Yumemi.apk #6 ~ゆめみのAndroidエンジニア 日頃の成果大発表会!~ Session 2
blendthink
1
210
Enterprise Angular: Frontend Moduliths with Nx and Standalone Components @jax2022
manfredsteyer
PRO
0
300
tfcon2022_Web3Dひとめぐり.pdf
emadurandal
0
940
機能横断型チームにおける技術改善
takeshiakutsu
3
450
Android Architecture Design With Koin
agiuliani
0
230
Featured
See All Featured
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
237
19k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
655
120k
A Tale of Four Properties
chriscoyier
149
20k
It's Worth the Effort
3n
172
25k
Designing with Data
zakiwarfel
91
3.9k
Building Applications with DynamoDB
mza
83
4.6k
Designing for humans not robots
tammielis
241
23k
The Invisible Side of Design
smashingmag
289
48k
What’s in a name? Adding method to the madness
productmarketing
11
1.5k
Why You Should Never Use an ORM
jnunemaker
PRO
47
5.5k
Building Adaptive Systems
keathley
25
1.1k
Unsuck your backbone
ammeep
659
55k
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?