SlideShare a Scribd company logo
1 of 36
Real Time Analytics
LA Cassandra User’s Group

with Cassandra, Hive,
and Solr

By Aaron Stannard
and Caglar Oner   March 2013
What is MarkedUp?
                                                                               2




                 MarkedUp: powerful analytics
                    tools for native apps.




      Understand your            Monitor your               Drive
        audience.                app’s health.            more sales.
         Gain valuable data on   Log errors and crashes   Better data = more
              your users.               remotely.              revenue.
What Our Customers See
                         3
The Analytics CAP Theorem - SCV
                                  4
SCV Examples
               5
The Truth about Analytics
                              6




Real time analytics isn’t
inherently superior or
necessary.
Analytic Speed is a Business Decision
                                        7
MarkedUp is a Blend of Both
                              8
Why Cassandra for Real Time?
                               9
Our Technology Stack
                       10
Cassandra Setup on EC2
                         11
Schema Strategy
                  12
Write Strategy
                 13
Read Strategy
                14
Time Series Schema 0: All Knowns
                                   15
Time Series Schema 1: Bounded Number of Unknowns
                                                   16
Time Series Schema 2: Unbounded Number of Unknowns
                                                     17
Schema Design Considerations
                               18
Data, data and more data
                                                                    19




                     More Data = More Problems
• Every day is our peak day.
• Every day we sign up more apps and our apps sign up more users.
How Do We Manage this Data?
                                                       20



                                   TM




                                             TM




                                        TM


                              TM




                                                  TM
Managing a Cluster
                     21
Hadoop Overview
                                               22

                          TM




• Two components:
  • HDFS
  • Map / Reduce
• Mimics Google File System and Map / Reduce
               TM




• Started by Yahoo!
                     TM




• Part of Apache Foundation
• Mature and has rich ecosystem
• Scalable
• Highly available
• SLOOOOOWW
Hive Overview
                                                                  23




         TM




• A SQL Map / Reduce abstraction
• Originally developed as a BI tool for data warehousing @ Facebook
                                                                      TM




• Rich data types (structs, lists and maps)
• Efficient implementation of joins, group-by's
• Scalable – easy to shard across nodes
• Tunable performance
• Extensible
Hive in Production
                                                          24



• Simple Aggregations
      SELECT applicationId, COUNT(1) AS dataPoints FROM
      ApplicationTable
      GROUP BY applicationId WHERE date = “2013-03-12”

• Data Mining
   User Retention
   User Engagement
• Ad hoc Analysis
   How many sales by X?
Hive Syntax
                                                                 25


 Query: count the number items where “key” is greater than 100


RDBMS> select key, count(1) from kv1
where key > 100 group by key;

Hive> select key, count(1) from kv1
where key > 100 group by key;
Hive Tables vs. Cassandra Column Families
                                                                        26




• When working with Cassandra, Hive still requires its own tables
• These are stored in HDFS typically
   • In DataStax Enterprise Edition it’s implemented into a dedicated
               TM




     Cassandra key space
• Hive tables are mapped directly onto Cassandra column families
Mapping Hive to Cassandra
                                                                                              27




CREATE EXTERNAL TABLE AverageTime (rowkey binary, dates bigint, total bigint)
STORED BY 'org.apache.hadoop.hive.cassandra.CassandraStorageHandler'
WITH SERDEPROPERTIES ("cassandra.ks.name" = “myKeySpace","cassandra.cf.name" =
“myColumnFamily", "cassandra.columns.mapping" = ":key, :column, :value" )
TBLPROPERTIES ( "cassandra.range.size" = "100", "cassandra.slice.predicate.size" = "100" );
Writing from Hive to Cassandra
                                                                                          28




INSERT OVERWRITE TABLE AverageTime

SELECT secondQuery.Project, secondQuery.SessionDay, AVG(secondQuery.SessionSum)
FROM
(
     SELECT firstQuery.Project, firstQuery.SessionDay, SUM(firstQuery.SessionLength) as
     SessionSum FROM
     (
           SELECT HSessions.Project as Project, HSessions.Day as SessionDay,
           HSessions.Length as SessionLength, HSessions.User as UserId
           FROM HSessions
     ) firstQuery
     GROUP BY firstQuery.Project, firstQuery.SessionDay, firstQuery.UserId
) secondQuery
GROUP BY secondQuery.Project, secondQuery.SessionDay;
Hive User-Defined Functions
                                                  29




# export
HIVE_AUX_JARS_PATH=/home/user/scripts
# custom function
hive> create temporary function myFunc as
'com.markedup.hive.udf.Compositor';


SELECT myFunc(Apps.AppId, “DailySessions”) FROM
Apps WHERE ….
Hive Tips and Tricks
                                                                     30




• Don’t write data from Hive back to a hot Cassandra column family
• Created dedicated Cassandra column families for Hive
• You can write to multiple places on a single Hive read
• Use sampling to test Hive queries on scaled-down data sets
Solr
                                       31




           TM




• Solr: Lucene-based indexing engine
• Part of Apache Foundation
• Full-text search
• Faceted search
• Distributed
• Integrates well with Cassandra
Real World Example
                               32




How do you count a billion
distinct items in real-time?
Solr Index Setup
                   33
Solr Search
              34
We Are Hiring!
                    35




We’re hiring.
markedup.com/jobs
THANK YOU
                                  36




Questions?    markedup.com
              team@markedup.com

More Related Content

Recently uploaded

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 

Recently uploaded (20)

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 

Featured

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data ScienceChristy Abraham Joy
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slidesAlireza Esmikhani
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 

Featured (20)

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 

Real time analytics with cassandra hive and solr

  • 1. Real Time Analytics LA Cassandra User’s Group with Cassandra, Hive, and Solr By Aaron Stannard and Caglar Oner March 2013
  • 2. What is MarkedUp? 2 MarkedUp: powerful analytics tools for native apps. Understand your Monitor your Drive audience. app’s health. more sales. Gain valuable data on Log errors and crashes Better data = more your users. remotely. revenue.
  • 4. The Analytics CAP Theorem - SCV 4
  • 6. The Truth about Analytics 6 Real time analytics isn’t inherently superior or necessary.
  • 7. Analytic Speed is a Business Decision 7
  • 8. MarkedUp is a Blend of Both 8
  • 9. Why Cassandra for Real Time? 9
  • 15. Time Series Schema 0: All Knowns 15
  • 16. Time Series Schema 1: Bounded Number of Unknowns 16
  • 17. Time Series Schema 2: Unbounded Number of Unknowns 17
  • 19. Data, data and more data 19 More Data = More Problems • Every day is our peak day. • Every day we sign up more apps and our apps sign up more users.
  • 20. How Do We Manage this Data? 20 TM TM TM TM TM
  • 22. Hadoop Overview 22 TM • Two components: • HDFS • Map / Reduce • Mimics Google File System and Map / Reduce TM • Started by Yahoo! TM • Part of Apache Foundation • Mature and has rich ecosystem • Scalable • Highly available • SLOOOOOWW
  • 23. Hive Overview 23 TM • A SQL Map / Reduce abstraction • Originally developed as a BI tool for data warehousing @ Facebook TM • Rich data types (structs, lists and maps) • Efficient implementation of joins, group-by's • Scalable – easy to shard across nodes • Tunable performance • Extensible
  • 24. Hive in Production 24 • Simple Aggregations SELECT applicationId, COUNT(1) AS dataPoints FROM ApplicationTable GROUP BY applicationId WHERE date = “2013-03-12” • Data Mining User Retention User Engagement • Ad hoc Analysis How many sales by X?
  • 25. Hive Syntax 25 Query: count the number items where “key” is greater than 100 RDBMS> select key, count(1) from kv1 where key > 100 group by key; Hive> select key, count(1) from kv1 where key > 100 group by key;
  • 26. Hive Tables vs. Cassandra Column Families 26 • When working with Cassandra, Hive still requires its own tables • These are stored in HDFS typically • In DataStax Enterprise Edition it’s implemented into a dedicated TM Cassandra key space • Hive tables are mapped directly onto Cassandra column families
  • 27. Mapping Hive to Cassandra 27 CREATE EXTERNAL TABLE AverageTime (rowkey binary, dates bigint, total bigint) STORED BY 'org.apache.hadoop.hive.cassandra.CassandraStorageHandler' WITH SERDEPROPERTIES ("cassandra.ks.name" = “myKeySpace","cassandra.cf.name" = “myColumnFamily", "cassandra.columns.mapping" = ":key, :column, :value" ) TBLPROPERTIES ( "cassandra.range.size" = "100", "cassandra.slice.predicate.size" = "100" );
  • 28. Writing from Hive to Cassandra 28 INSERT OVERWRITE TABLE AverageTime SELECT secondQuery.Project, secondQuery.SessionDay, AVG(secondQuery.SessionSum) FROM ( SELECT firstQuery.Project, firstQuery.SessionDay, SUM(firstQuery.SessionLength) as SessionSum FROM ( SELECT HSessions.Project as Project, HSessions.Day as SessionDay, HSessions.Length as SessionLength, HSessions.User as UserId FROM HSessions ) firstQuery GROUP BY firstQuery.Project, firstQuery.SessionDay, firstQuery.UserId ) secondQuery GROUP BY secondQuery.Project, secondQuery.SessionDay;
  • 29. Hive User-Defined Functions 29 # export HIVE_AUX_JARS_PATH=/home/user/scripts # custom function hive> create temporary function myFunc as 'com.markedup.hive.udf.Compositor'; SELECT myFunc(Apps.AppId, “DailySessions”) FROM Apps WHERE ….
  • 30. Hive Tips and Tricks 30 • Don’t write data from Hive back to a hot Cassandra column family • Created dedicated Cassandra column families for Hive • You can write to multiple places on a single Hive read • Use sampling to test Hive queries on scaled-down data sets
  • 31. Solr 31 TM • Solr: Lucene-based indexing engine • Part of Apache Foundation • Full-text search • Faceted search • Distributed • Integrates well with Cassandra
  • 32. Real World Example 32 How do you count a billion distinct items in real-time?
  • 35. We Are Hiring! 35 We’re hiring. markedup.com/jobs
  • 36. THANK YOU 36 Questions? markedup.com team@markedup.com