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
600
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
870
Introduction to Basejump
segphault
1
1.2k
Realtime data visualization with RethinkDB and Epoch
segphault
1
640
Realtime web apps with RethinkDB and full-stack Ruby
segphault
2
290
Jupyter and RethinkDB
segphault
1
600
Using RethinkDB with Tornado & EventMachine
segphault
0
580
RethinkDB Training Course
segphault
3
390
Composing frontend Web applications with MontageJS
segphault
4
1.3k
Intro to MontageJS
segphault
1
180
Other Decks in Programming
See All in Programming
イベントストーミングによるオブジェクトモデリング・オブジェクト指向プログラミングの適用・開発プロセスの変遷・アーキテクチャの変革 / Object modeling with Event Storming.
nrslib
12
3.1k
品質が高いコードって何?Rev2.1
ickx
1
490
15分間でふんわり理解するDocker @ Matsuriba MAX
ukwhatn
PRO
1
340
Kotlinを用いたDSL的な設計手法と使用上の注意
kohii00
3
530
PHPでOfficeファイルを取り扱う! PHP Officeライブラリを プロダクトに組み込んだ話
hirobe1999
0
840
導入から5年が経って見えた Datadog APM 運用の課題
bgpat
2
540
上手な探索的テストとその上達方法について
matsu802
4
660
GitHub Copilot Tips and Tricks
yuichielectric
26
7.5k
Open Source Swiftc Workshop
kitasuke
1
290
決断するための勇気、そのためのBacklog / Courage to make decisions, Backlog for that.
seike460
PRO
4
1.9k
Building a Smaller App Binary
kateinoigakukun
2
210
LLMチャットボットのアプリケーション設計Tips
os1ma
4
660
Featured
See All Featured
WebSockets: Embracing the real-time Web
robhawkes
59
6.9k
Mobile First: as difficult as doing things right
swwweet
215
8.5k
[RailsConf 2023] Rails as a piece of cake
palkan
21
3.8k
Building an army of robots
kneath
300
41k
Statistics for Hackers
jakevdp
789
220k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
34
8.8k
Adopting Sorbet at Scale
ufuk
66
8.5k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
8
8.2k
Optimising Largest Contentful Paint
csswizardry
7
2.3k
What's new in Ruby 2.0
geeforr
335
31k
BBQ
matthewcrist
78
8.7k
Embracing the Ebb and Flow
colly
78
4.1k
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?