3. 2013
HISTORY & MOTIVATION
‣ Druid was started in 2011
‣ Power interactive data applications
‣ Multi-tenancy: lots of concurrent users
‣ Scalability: trillions events/day, sub-second queries
‣ Real-time analysis
4. HISTORY & MOTIVATION
‣ Questions lead to more questions
‣ Dig into the dataset using filters, aggregates, and comparisons
‣ All interesting queries cannot be determined upfront
5. DEMO
IN CASE THE INTERNET DIDN’T WORK
PRETEND YOU SAW SOMETHING COOL
6. 2015
A GENERAL SOLUTION?
‣ Load all your data into Hadoop. Query it. Done!
‣ Good job guys, let’s go home
10. 2015
MAKE QUERIES FASTER
‣ Optimizing business intelligence (OLAP) queries
• Aggregate measures over time, broken down by dimensions
• Revenue over time broken down by product type
• Top selling products by volume in San Francisco
• Number of unique visitors broken down by age
• Not dumping the entire dataset
• Not examining individual events
14. 2015
‣ Pre-computation
• Pre-compute every possible query
• Pre-compute a subset of queries
• Exponential scaling costs
‣ Range scans
• Primary key: dimensions/attributes
• Value: measures/metrics (things to aggregate)
• Still too slow!
KEY/VALUE STORES
16. 2015
‣ Load/scan exactly what you need for a query
‣ Different compression algorithms for different columns
‣ Encoding for string columns
‣ Compression for measure columns
‣ Different indexes for different columns
COLUMN STORES
20. 2015
DATA!
timestamp page language city country ... added deleted
2011-01-01T00:01:35Z Justin Bieber en SF USA 10 65
2011-01-01T00:01:63Z Justin Bieber en SF USA 15 62
2011-01-01T01:02:51Z Justin Bieber en SF USA 32 45
2011-01-01T01:01:11Z Ke$ha en Calgary CA 17 87
2011-01-01T01:02:24Z Ke$ha en Calgary CA 43 99
2011-01-01T02:03:12Z Ke$ha en Calgary CA 12 53
...
21. 2015
PRE-AGGREGATION/ROLL-UP
timestamp page language city country ... added deleted
2011-01-01T00:00:00Z Justin Bieber en SF USA 25 127
2011-01-01T01:00:00Z Justin Bieber en SF USA 32 45
2011-01-01T01:00:00Z Ke$ha en Calgary CA 60 186
2011-01-01T02:00:00Z Ke$ha en Calgary CA 12 53
...
timestamp page language city country ... added deleted
2011-01-01T00:01:35Z Justin Bieber en SF USA 10 65
2011-01-01T00:01:63Z Justin Bieber en SF USA 15 62
2011-01-01T01:02:51Z Justin Bieber en SF USA 32 45
2011-01-01T01:01:11Z Ke$ha en Calgary CA 17 87
2011-01-01T01:02:24Z Ke$ha en Calgary CA 43 99
2011-01-01T02:03:12Z Ke$ha en Calgary CA 12 53
...
22. 2015
PARTITION DATA
timestamp page language city country ... added deleted
2011-01-01T00:00:00Z Justin Bieber en SF USA 25 127
2011-01-01T01:00:00Z Justin Bieber en SF USA 32 45
2011-01-01T01:00:00Z Ke$ha en Calgary CA 60 186
2011-01-01T02:00:00Z Ke$ha en Calgary CA 12 53
‣ Shard data by time
‣ Immutable blocks of data called “segments”
Segment 2011-01-01T02/2011-01-01T03
Segment 2011-01-01T01/2011-01-01T02
Segment 2011-01-01T00/2011-01-01T01
23. 2015
IMMUTABLE SEGMENTS
‣ Fundamental storage unit in Druid
‣ No contention between reads and writes
‣ One thread scans one segment
‣ Multiple threads can access same underlying data
24. 2015
COLUMNAR STORAGE
‣ Scan/load only what you need
‣ Compression!
‣ Indexes!
timestamp page language city country ... added deleted
2011-01-01T00:01:35Z Justin Bieber en SF USA 10 65
2011-01-01T00:03:63Z Justin Bieber en SF USA 15 62
2011-01-01T00:04:51Z Justin Bieber en SF USA 32 45
2011-01-01T01:00:00Z Ke$ha en Calgary CA 17 87
2011-01-01T02:00:00Z Ke$ha en Calgary CA 43 99
2011-01-01T02:00:00Z Ke$ha en Calgary CA 12 53
...
25. 2013
COLUMN COMPRESSION · DICTIONARIES
‣ Create ids
• Justin Bieber -> 0, Ke$ha -> 1
‣ Store
• page -> [0 0 0 1 1 1]
• language -> [0 0 0 0 0 0]
timestamp page language city country ... added deleted
2011-01-01T00:01:35Z Justin Bieber en SF USA 10 65
2011-01-01T00:03:63Z Justin Bieber en SF USA 15 62
2011-01-01T00:04:51Z Justin Bieber en SF USA 32 45
2011-01-01T01:00:00Z Ke$ha en Calgary CA 17 87
2011-01-01T02:00:00Z Ke$ha en Calgary CA 43 99
2011-01-01T02:00:00Z Ke$ha en Calgary CA 12 53
...
26. 2013
BITMAP INDICES
‣ Justin Bieber -> [0, 1, 2] -> [111000]
‣ Ke$ha -> [3, 4, 5] -> [000111]
timestamp page language city country ... added deleted
2011-01-01T00:01:35Z Justin Bieber en SF USA 10 65
2011-01-01T00:03:63Z Justin Bieber en SF USA 15 62
2011-01-01T00:04:51Z Justin Bieber en SF USA 32 45
2011-01-01T01:00:00Z Ke$ha en Calgary CA 17 87
2011-01-01T02:00:00Z Ke$ha en Calgary CA 43 99
2011-01-01T02:00:00Z Ke$ha en Calgary CA 12 53
...
34. 2015
MORE PROBLEMS
‣ We’ve solved the query problem
• Druid gave us arbitrary data exploration & fast queries
‣ But what about data freshness?
• Batch loading is slow!
• We want “real-time”
• Alerts, operational monitoring, etc.
35. 2015
FAST LOADING WITH DRUID
‣ We have an indexing system
‣ We have a serving system that runs queries on data
‣ We can serve queries while building indexes!
‣ Real-time indexing workers do this
36. 2015
‣ Write-optimized data structure:
hash map in heap
‣ Convert write optimized -> read
optimized
‣ Read-optimized data structure:
Druid segments
‣ Query data immediately
REAL-TIME NODES
Memory
Segment
Events
Queries
Convert
39. 2015
APPROXIMATE ANSWERS
‣ Drastically reduce storage space and compute time
• Cardinality estimation
• Histograms
• Quantiles
• Add your own proprietary modules
42. 2015
THE COMMUNITY
‣ Growing Community
• 130+ contributors from many different companies
• In production at many different companies, we’re hoping for more!
• Ad-tech, network traffic, operations, activity streams, etc.
• We love contributions!
43. 2015
PRODUCTION READY
‣ High availability through replication
‣ Rolling restarts
‣ 4 years of no down time for software updates and restarts
‣ Battle tested
‣ Used by hundreds of companies in production
45. 2014
CLUSTER SIZE
>500TB OF SEGMENTS (>50 TRILLION RAW EVENTS)
>5000 CORES (>400 NODES, >100TB RAM)
IT’S CHEAP
MOST COST EFFECTIVE AT THIS SCALE
DRUID IN PRODUCTION
49. 2015
TAKE-AWAYS
‣ When Druid?
• You want to power user-facing data applications
• You want to do your analysis on data as it’s happening (realtime)
• Arbitrary data exploration with sub-second ad-hoc queries
• OLAP, BI, Pivot (anything involved aggregates)
• You need availability, extensibility and flexibility
50. DRUID IS OPEN SOURCE
WWW.DRUID.IO
twitter @druidio
irc.freenode.net #druid-dev