Top Banner
Recording the web: High-fidelity storage and playback Ian Rose [email protected] @ianthomasrose
27

Cassandra Day Atlanta 2015: Recording the Web: High-Fidelity Storage and Playback

Jul 15, 2015

Download

Technology

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Cassandra Day Atlanta 2015: Recording the Web: High-Fidelity Storage and Playback

Recording the web: High-fidelity storage

and playbackIan Rose

[email protected] @ianthomasrose

Page 2: Cassandra Day Atlanta 2015: Recording the Web: High-Fidelity Storage and Playback

What is FullStory?• An Atlanta based startup

• A bunch of former ATL Googlers

• Launched ~9 months ago

• A service for deeply understanding your users

• @fullstorywww.fullstory.com

Page 3: Cassandra Day Atlanta 2015: Recording the Web: High-Fidelity Storage and Playback

What is FullStory?• “Capture everything” approach to understanding

user behavior

• One script on page (think Google Analytics; no wiring events)

• Captures all DOM, changes, CSS, etc.

• A demo shows this way better than I can…

Page 4: Cassandra Day Atlanta 2015: Recording the Web: High-Fidelity Storage and Playback

Demo

Page 5: Cassandra Day Atlanta 2015: Recording the Web: High-Fidelity Storage and Playback

Recording PipelineClients

Page 6: Cassandra Day Atlanta 2015: Recording the Web: High-Fidelity Storage and Playback

Recording PipelineClients App Engine

frontendsDOM

Events

Page 7: Cassandra Day Atlanta 2015: Recording the Web: High-Fidelity Storage and Playback

Recording PipelineClients App Engine

frontendsCompute Engine

DOMEvents

Page 8: Cassandra Day Atlanta 2015: Recording the Web: High-Fidelity Storage and Playback

Recording PipelineClients App Engine

frontends BridgeCompute Engine

DOMEvents HTTP

CQL

Page 9: Cassandra Day Atlanta 2015: Recording the Web: High-Fidelity Storage and Playback

Analysis PipelineCompute Engine

Once a page is finished recording…(either UNLOAD event or idle timeout)

Page 10: Cassandra Day Atlanta 2015: Recording the Web: High-Fidelity Storage and Playback

Analysis PipelineCompute Engine

Read /Delete

“Cookers”

Page 11: Cassandra Day Atlanta 2015: Recording the Web: High-Fidelity Storage and Playback

Analysis PipelineCompute Engine

Read /Delete

“Cookers”

Google CloudStorage

Upload

Page 12: Cassandra Day Atlanta 2015: Recording the Web: High-Fidelity Storage and Playback

System Requirements• Must be reliable

• Must be cheap (high scale)

• Must be scalable

• ~ 1:1 reads/writes (for now…)

Page 13: Cassandra Day Atlanta 2015: Recording the Web: High-Fidelity Storage and Playback

Bundle Schema

CREATE TABLE event_bundles ( org_id ascii, user_id bigint, session_id bigint, page_id bigint, seqno int, bundle blob, PRIMARY KEY ((org_id, user_id, session_id, page_id), seqno));

Page 14: Cassandra Day Atlanta 2015: Recording the Web: High-Fidelity Storage and Playback

Bundle Schema

CREATE TABLE event_bundles ( org_id ascii, user_id bigint, session_id bigint, page_id bigint, seqno int, bundle blob, PRIMARY KEY ((org_id, user_id, session_id, page_id), seqno));

Partition Key

Page 15: Cassandra Day Atlanta 2015: Recording the Web: High-Fidelity Storage and Playback

Bundle Schema

CREATE TABLE event_bundles ( org_id ascii, user_id bigint, session_id bigint, page_id bigint, seqno int, bundle blob, PRIMARY KEY ((org_id, user_id, session_id, page_id), seqno));

Clustering Column

Page 16: Cassandra Day Atlanta 2015: Recording the Web: High-Fidelity Storage and Playback

Bundle Schema

CREATE TABLE event_bundles ( org_id ascii, user_id bigint, session_id bigint, page_id bigint, seqno int, bundle blob, PRIMARY KEY ((org_id, user_id, session_id, page_id), seqno));

Bundle of DOM events

Page 17: Cassandra Day Atlanta 2015: Recording the Web: High-Fidelity Storage and Playback

Bundle Schema• One gotcha: occasionally we have long

tombstone scans

WARN [ReadStage:6] 2015-01-22 12:37:00,185 SliceQueryFilter.java (line 225) Read 0 live and 1048 tombstoned cells in fullstory.event_bundles (see tombstone_warn_threshold).

Page 18: Cassandra Day Atlanta 2015: Recording the Web: High-Fidelity Storage and Playback

Our current usage• 3 nodes (8x cores each)

• 1 TB SSDs each (network attached)

• v2.0.13

• RF=3, QUORUM reads and writes

• 4 week TTL on all bundles

• ~0.5 TB new data per day

Page 19: Cassandra Day Atlanta 2015: Recording the Web: High-Fidelity Storage and Playback

Growing Pains

Page 20: Cassandra Day Atlanta 2015: Recording the Web: High-Fidelity Storage and Playback

Managing Repairs• Manual for a long time

• Luckily our data is duplicate insensitive (due to seqnums)

• Now we have an App Engine cron job that calls forceRepairAsync() via JMX

• Change to incremental repairs would probably help (introduced in v2.1)

Page 21: Cassandra Day Atlanta 2015: Recording the Web: High-Fidelity Storage and Playback

Don’t redline the CPU• CPU spikes happen:

• Compaction

• Read repair

• Node repair

• GC

• Unlucky reads (hitting lots of SSTables)

Page 22: Cassandra Day Atlanta 2015: Recording the Web: High-Fidelity Storage and Playback

Don’t redline your disk either• “Compaction needs free

disk space to write the new SSTable, before the SSTables being compacted are removed.”[1]

• For SizeTiered compaction, worst case is 50% of disk!

• [1] http://www.slideshare.net/planetcassandra/201404-cluster-sizing

Page 23: Cassandra Day Atlanta 2015: Recording the Web: High-Fidelity Storage and Playback

Future Plans

Page 24: Cassandra Day Atlanta 2015: Recording the Web: High-Fidelity Storage and Playback

Future Plans• DateTieredCompactionStrategy

• Committed by Björn Hegerfors (Spotify) Oct 2014

• Incremental Repairs

Page 25: Cassandra Day Atlanta 2015: Recording the Web: High-Fidelity Storage and Playback

Future Plans• New C* cluster!

• The output of event processing is a set of JSON documents

• Currently we store these in Google Cloud Storage (GCS)

• GCS storage is cheap, but we are paying too much for upload requests

Page 26: Cassandra Day Atlanta 2015: Recording the Web: High-Fidelity Storage and Playback

GcsMux• Currently in development

• Idea: gather up multiple small files on disk, merge them into a single file to be uploaded

• How do you retrieve a file later? Store filename & location in Cassandra.

Page 27: Cassandra Day Atlanta 2015: Recording the Web: High-Fidelity Storage and Playback

Thanks!