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
710
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
980
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
320
Jupyter and RethinkDB
segphault
1
680
Using RethinkDB with Tornado & EventMachine
segphault
0
650
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
これが俺の”自分戦略” プロセスを楽しんでいこう! - Developers CAREER Boost 2024
niftycorp
PRO
0
190
Refactor your code - refactor yourself
xosofox
1
250
Semantic Kernelのネイティブプラグインで知識拡張をしてみる
tomokusaba
0
180
Security_for_introducing_eBPF
kentatada
0
110
.NET 9アプリをCGIとして レンタルサーバーで動かす
mayuki
1
770
[JAWS-UG横浜 #76] イケてるアップデートを宇宙いち早く紹介するよ!
maroon1st
0
450
今年のアップデートで振り返るCDKセキュリティのシフトレフト/2024-cdk-security-shift-left
tomoki10
0
190
CSC305 Lecture 25
javiergs
PRO
0
130
わたしの星のままで一番星になる ~ 出産を機にSIerからEC事業会社に転職した話 ~
kimura_m_29
0
180
開発者とQAの越境で自動テストが増える開発プロセスを実現する
92thunder
1
180
テストコード文化を0から作り、変化し続けた組織
kazatohiei
2
1.5k
Recoilを剥がしている話
kirik
5
6.6k
Featured
See All Featured
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.3k
Thoughts on Productivity
jonyablonski
67
4.4k
A Philosophy of Restraint
colly
203
16k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
It's Worth the Effort
3n
183
28k
Designing Experiences People Love
moore
138
23k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
170
We Have a Design System, Now What?
morganepeng
51
7.3k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Building Applications with DynamoDB
mza
91
6.1k
Agile that works and the tools we love
rasmusluckow
328
21k
Designing for Performance
lara
604
68k
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?