Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Evolution of a Real-Time Web Analytics Platform
Geoff Wagstaff
October 18, 2013
Technology
1
330
Evolution of a Real-Time Web Analytics Platform
Talk about data stores in use at GoSquared at the AllYourBase conference.
Geoff Wagstaff
October 18, 2013
Tweet
Share
More Decks by Geoff Wagstaff
See All by Geoff Wagstaff
GoSquared Presentation at AWS for Startups
thedeveloper
1
470
Other Decks in Technology
See All in Technology
BFFとmicroservicesアーキテクチャ
hirac1220
0
110
次期LTSに備えよ!AOS 6.1 HCI Core 編
smzksts
0
180
Scrum Fest Niigata 2022 開発エンジニアに聞いてみよう!
moritamasami
1
550
信頼性の階層の一段目を積み上げる/Monitoring Dashboard
shonansurvivors
0
180
Learning from AWS Customer Security Incidents [2022]
ramimac
0
1.3k
ITエンジニアを取り巻く環境とキャリアパス / A career path for Japanese IT engineers
takatama
0
600
我々はなぜテストをするのか?
kawaguti
PRO
0
570
Microsoft Build 2022 - Azure のデータ & 分析サービス 最新アップデート / Microsoft Build 2022 Updates on Azure Data and Analytics Services
nakazax
1
180
失敗を経験したあなたへ〜建設的なインシデントの振り返りを行うために実践するべきこと〜
nobuakikikuchi
0
210
開発者のための GitHub Organization の安全な運用と 継続的なモニタリング
flatt_security
3
3.9k
Dagu | オンプレ向けワークフローエンジン(WebUI 同梱)
yohamta
0
200
Oracle Cloud Infrastructure:2022年5月度サービス・アップデート
oracle4engineer
PRO
0
130
Featured
See All Featured
Java REST API Framework Comparison - PWX 2021
mraible
PRO
11
4.6k
Art Directing for the Web. Five minutes with CSS Template Areas
malarkey
196
9.4k
Music & Morning Musume
bryan
35
4.2k
KATA
mclloyd
7
8.6k
Web development in the modern age
philhawksworth
197
9.3k
The Cult of Friendly URLs
andyhume
68
4.7k
A Philosophy of Restraint
colly
192
14k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
236
1M
Typedesign – Prime Four
hannesfritz
33
1.3k
Streamline your AJAX requests with AmplifyJS and jQuery
dougneiner
125
8.5k
Happy Clients
brianwarren
89
5.5k
JazzCon 2018 Closing Keynote - Leadership for the Reluctant Leader
reverentgeek
172
8.3k
Transcript
The Evolution of a Real-Time Analytics Platform Geoff Wagstaff @TheDeveloper
The Now dashboard
The Trends dashboard
Building Real-Time Analytics Behind the “Now” dashboard
Back in 2009 1 server LAMP stack Conventional hosting
LiveStats v1
None
Meltdown!
Problem? First taste of scale WRITES
Reads are easy to scale Primary Writes Replica 1 Replica
2 Replica 3 Reads Reads Reads
Writes? Not so much. Primary MANY WRITES! Replica 1 Replica
2 Replica 3 Reads Reads Reads :(
Scale Horizontally
Node Node Node Requests Requests Requests NginX -> PHP-FPM <-->
Memcache
Problems
Stupidly high data transfer: several TB per day DB ->
app -> DB round trips High latency on DB ops Race conditions
Redis to the rescue! “Advanced in-memory key-value store”
Rich Data types
Rich Data types Keys Hashes Lists Sets Sorted Sets GET
SET HGET HSET HMSET LPUSH LPOP BLPOP SADD SREM SRANGE ZADD ZREM ZRANGE ZINTERSTORE
Distributed locks Service Service Service Fast counters Fan-out Pub/Sub broadcast
Message queues redis-1 redis-2 Solved concurrency problems
ACID
A C I D tomic onsistent solated urable MySQL MongoDB
Other ACID DBs:
Fast
Fast Redis 2.6.16 on 2.4GHz i7 MBP
Single-process, one per core Run on m1.medium - 1 core,
3.5GB memory Redis cluster is coming! Now on Elasticache Redis deployment
Behind the “Trends” dashboard Building Historical Analytics
Trends v1
Sharded MySQL from outset Aging Unreliable Trends v1
The Trends dashboard
MongoDB vs Cassandra
MongoDB Document store: no schema, flexible Compelling replication & sharding
features Fast in-place field updates similar to Redis
Attempt #1: Store & aggregate Document for each list item,
timestamp and site Aggregation framework: match, group, sort Collection per list type Flexible Made app simpler Huge number of documents Slow aggregate queries: ~1s+ ✔ ✔ X X
Attempt #2 Document per list, timestamp and site Collection per
list type Faster lookups (no aggregation) Fewer documents Smaller _id Document size limit Unordered High data transfer ✔ ✔ ✔ X X X
MongoStat
Downsides High random I/O Document size & relocation Fragmentation Database
lock
K.O. MongoDB
Cassandra Distributed hash ring: masterless Linear scalability Built for scale
+ write throughput
CQL
CQL SELECT sql AS cql FROM mysql WHERE query_language =
“good” Not as scary as Column Families + Thrift SQL Schemas + Querying
CQL CREATE TABLE d_aggregate_day ( sid int, ts int, s
text, v counter PRIMARY KEY (sid, ts, s)) partition key cluster key Distributed counters!
B ASE
B A S E asically vailable oft-state ventually consistent
Eventual consistency isn’t a problem More efficient with the disk
Low maintenance Cheap
Redis + Cassandra = win Redis as a speed layer
+ aggregator for lists Cassandra as timeseries counter storage Collector Redis Cassandra Periodic flushes to Cassandra
Exploit DBs strengths Build an indestructible service Use the best
tools for the job
Thanks! Geoff Wagstaff @TheDeveloper engineering.gosquared.com