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
350
Jupyter and RethinkDB
segphault
1
760
Using RethinkDB with Tornado & EventMachine
segphault
0
730
RethinkDB Training Course
segphault
3
470
Composing frontend Web applications with MontageJS
segphault
4
1.5k
Intro to MontageJS
segphault
1
220
Other Decks in Programming
See All in Programming
生成AIを使ったコードレビューで定性的に品質カバー
chiilog
1
310
AI巻き込み型コードレビューのススメ
nealle
2
2.3k
Go1.26 go fixをプロダクトに適用して困ったこと
kurakura0916
0
300
Metaprogramming isn't real, it can't hurt you
okuramasafumi
0
130
ぼくの開発環境2026
yuzneri
1
290
AI主導でFastAPIのWebサービスを作るときに 人間が構造化すべき境界線
okajun35
0
260
個人開発は儲からない - それでも開発開始1ヶ月で300万円売り上げた方法
taishiyade
0
110
Railsの気持ちを考えながらコントローラとビューを整頓する/tidying-rails-controllers-and-views-as-rails-think
moro
4
340
Rails Girls Tokyo 18th GMO Pepabo Sponsor Talk
yutokyokutyo
0
170
CSC307 Lecture 13
javiergs
PRO
0
300
エージェント開発初心者の僕がエージェントを作った話と今後やりたいこと
thasu0123
0
160
AIによる高速開発をどう制御するか? ガードレール設置で開発速度と品質を両立させたチームの事例
tonkotsuboy_com
7
2.5k
Featured
See All Featured
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
460
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.7k
Marketing to machines
jonoalderson
1
5k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
How to make the Groovebox
asonas
2
2k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
60
42k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
100
We Are The Robots
honzajavorek
0
180
Prompt Engineering for Job Search
mfonobong
0
180
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?