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
Evolution of a Real-Time Web Analytics Platform
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Geoff Wagstaff
October 18, 2013
Technology
380
1
Share
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
More Decks by Geoff Wagstaff
See All by Geoff Wagstaff
GoSquared Presentation at AWS for Startups
thedeveloper
1
690
Other Decks in Technology
See All in Technology
小さいVue.jsを30分で作る
hal_spidernight
0
130
QAエンジニアはどうやって プロダクト議論の場に入れるのか?
moritamasami
2
340
雑談は、センサーだった
bitkey
PRO
2
190
AI バイブコーティングでキーボード不要?!
samakada
0
680
知ってた?JavaScriptの"正しさ"を検証するテストが5万以上もあること(Test262)
riyaamemiya
1
130
MySQL 9.7がやってきた ~これまでのあらすじと基本情報~ @ 日本MySQLユーザ会会2026年04月 / mysql97-yattekita
sakaik
0
170
ハーネスエンジニアリング入門
knishioka
0
110
20260428_Product Management Summit_tadokoroyoshiro
tadokoro_yoshiro
15
18k
AIが盛んな時代に 技術記事を書き始めて起きた私の中での小さな変化
peintangos
0
340
20年前の「OSS革命」に学ぶ AI時代の生存戦略
samakada
0
530
AWS Transform CustomでIaCコードを自由自在に変換しよう
duelist2020jp
0
240
エージェント時代の UIとAPI、CLI戦略
coincheck_recruit
0
120
Featured
See All Featured
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.1k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
360
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
340
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
120
The Limits of Empathy - UXLibs8
cassininazir
1
320
Making the Leap to Tech Lead
cromwellryan
135
9.8k
Writing Fast Ruby
sferik
630
63k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
130
The Curse of the Amulet
leimatthew05
1
12k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
780
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.5k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
230
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