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
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
680
Other Decks in Technology
See All in Technology
Cortex Codeでデータの仕事を全部Agenticにやりきろう!
gappy50
0
310
最大のアウトプット術は問題を作ること
ryoaccount
0
300
Data Intelligence Engineering Unit 部門と各ポジション紹介
sansantech
PRO
0
120
パワポ作るマンをMCP Apps化してみた
iwamot
PRO
0
300
Webアクセシビリティは“もしも”に備える設計
tomokusaba
0
160
Databricks Lakebaseを用いたAIエージェント連携
daiki_akimoto_nttd
0
150
互換性のある(らしい)DBへの移行など考えるにあたってたいへんざっくり
sejima
PRO
0
550
スケーリングを封じられたEC2を救いたい
senseofunity129
0
140
スクラムを支える内部品質の話
iij_pr
0
280
チームで育てるAI自走環境_20260409
fuktig
0
810
TanStack Start エコシステムの現在地 / TanStack Start Ecosystem 2026
iktakahiro
1
320
ハーネスエンジニアリング×AI適応開発
aictokamiya
3
1.5k
Featured
See All Featured
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
120
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.1k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
2.7k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
210
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.6k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
490
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
350
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
780
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
120
30 Presentation Tips
portentint
PRO
1
270
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