Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

GDC 2015 - Game Analytics with AWS Redshift, Kinesis, and the Mobile SDK

4,932 views

Published on

See the latest analytics architectures for companies succeeding in the free-to-play space, such as Supercell, GREE, and Rovio. Also see how to create a real-time analytics pipeline to connect to your players, enabling you to deliver deeper experiences.

Published in: Technology

GDC 2015 - Game Analytics with AWS Redshift, Kinesis, and the Mobile SDK

  1. 1. 1 GDC 2015 – Amazon Developer Day Connecting With Your Players Using AWS Analytics Nate Wiger Principal, Gaming Solutions @nateware nateware@amazon.com
  2. 2. AWS Gaming Solutions Projected Mobile App Revenue 0 10000 20000 30000 40000 50000 60000 70000 80000 90000 2011 2012 2013 2014 2015 2016 2017 Ads IAP Paid Source: Gartner
  3. 3. AWS Gaming Solutions More Screens = More Revenue
  4. 4. AWS Gaming Solutions Analytics at Supercell “You cannot predict success. You will only find out after releasing it.” - Ilkka Paananen, CEO, Supercell
  5. 5. AWS Gaming Solutions Analyze What? Emotions •  Enjoying game •  Engaged •  Like/dislike new content •  Stuck on a level •  Bored •  Giving up Behaviors •  Hours played day/week •  Number of sessions/day •  Level progression •  Friend invites/referrals •  Response to mobile push •  Money spent/week
  6. 6. AWS Gaming Solutions Winning at Free to Play •  Phase 1: Collect Data •  Phase 2: Analyze •  Phase 3: Profit
  7. 7. AWS Gaming Solutions Example: Level Progression (One Metric) 0 2 4 6 8 10 L1 L2 L3 L4 L5 L6 L7 L8 L9 L10 Tries / Level # of Tries
  8. 8. AWS Gaming Solutions Example: Level Progression (Two Metrics) 0 10 20 30 40 50 60 0 2 4 6 8 10 L1 L2 L3 L4 L5 L6 L7 L8 L9 L10 Tries / Level % Highest Level # of Tries
  9. 9. AWS Gaming Solutions Wooga – Player Attrition
  10. 10. AWS Gaming Solutions Wooga – Level Analysis
  11. 11. AWS Gaming Solutions Solution – Level of the Week
  12. 12. AWS Gaming Solutions Solution – Level of the Week
  13. 13. AWS Gaming Solutions Events & Metrics •  Event = Moment in Time –  Login/quit –  Game start/end –  Level up –  In-app purchase •  Metrics = What to Measure –  KISS –  Numbers –  Booleans –  Strings (Enums) •  Context = Always Include –  User –  Action –  Session (context-dependent) –  Timestamp in ISO8601 2014-­‐03-­‐16T16:28:26
  14. 14. AWS Gaming Solutions Off The Shelf Analytics •  Easy To Integrate •  Pre-Baked Reports •  Limited Flexibility •  Retention Windows •  Data Ownership
  15. 15. AWS Gaming Solutions Ok, A Real Business Plan Ingest Store Process Analyze
  16. 16. AWS Gaming Solutions Ok, A Real Business Plan Ingest •  S3 PUT •  Analytics SDK •  Kinesis Store •  S3 •  DynamoDB •  HDFS Process •  Redshift •  EMR (Hadoop) •  Spark Analyze •  Tableau •  Pentaho •  Jaspersoft
  17. 17. AWS Gaming Solutions •  Collect Events on Device •  Periodically Store in S3 •  Process Data into Redshift •  Analyze with GUI Visualization Tool Start Simple 2015-­‐03-­‐03,nateware,e4df,login   2015-­‐03-­‐03,nateware,e4df,gamestart   2015-­‐03-­‐03,nateware,e4df,gameend   2015-­‐03-­‐03,nateware,a88c,login   2015-­‐03-­‐03,nateware,a88c,friendlist   2015-­‐03-­‐03,nateware,a88c,gamestart   Profit!
  18. 18. AWS Gaming Solutions Redshift at a Glance 10 GigE (HPC) Ingestion Backup Restore SQL Clients/BI Tools 128GB RAM 16TB disk 16 cores Amazon S3/DynamoDB JDBC/ODBC 128GB RAM 16TB disk 16 coresCompute Node 128GB RAM 16TB disk 16 coresCompute Node 128GB RAM 16TB disk 16 coresCompute Node Leader Node •  Leader Node –  SQL endpoint –  Stores metadata –  Coordinates query execution •  Compute Nodes –  Columnar table storage –  Load, backup, restore via Amazon S3 –  Parallel load from Amazon DynamoDB •  Single node version available
  19. 19. AWS Gaming Solutions Tableau + Redshift
  20. 20. AWS Gaming Solutions Plumbing ①  Create S3 bucket ("mygame-analytics-events") ②  Request a security token for your mobile app: http://docs.aws.amazon.com/STS/latest/UsingSTS/Welcome.html ③  Upload data from your users' devices ④  Run a scheduled copy to Redshift ⑤  Setup Tableau to access Redshift ⑥  Go to the Beach
  21. 21. AWS Gaming Solutions Loading Redshift from S3 copy  events   from  's3://mygame-­‐analytics-­‐events'   credentials  'aws_access_key_id=<access-­‐key-­‐id>;   aws_secret_access_key=<secret-­‐access-­‐key>'   delimiter=',';   Scheduled Redshift Load using Data Pipeline: http://aws.amazon.com/articles/1143507459230804 Search Slideshare for "BDT303" – re:Invent 2014
  22. 22. AWS Gaming Solutions http://tinyurl.com/k2elyhb
  23. 23. AWS Gaming Solutions •  Collect Server Logs •  Periodically Send to S3 •  Process into Redshift •  External Analytics Data Too More Data Sources EC2 External Analytics
  24. 24. AWS Gaming Solutions Logrotate to S3 /var/log/apache2/*.log  {      sharedscripts      postrotate          sudo  /usr/sbin/apache2ctl  graceful          s3cmd  sync  /var/log/*.gz  s3://mygame-­‐logs/      endscript   }   Blog Entry on Log Rotation: http://www.dowdandassociates.com/blog/content/howto-rotate-logs-to-s3/ ELB Access Logs: http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/ access-log-collection.html
  25. 25. AWS Gaming Solutions •  Different File Formats •  Device vs Apache vs CDN •  Cleanup with EMR Job •  Output to Clean Bucket •  Load into Redshift Dealing With Messy Data EC2
  26. 26. AWS Gaming Solutions Redshift vs Elastic MapReduce Redshift •  Columnar DB •  Familiar SQL •  Structured Data •  Batch Load •  Faster to Query •  Long-term Storage Elastic MapReduce •  Hadoop •  Custom Java / Python •  Unstructured Data •  Streaming Loop •  Scales > PB's •  Transient
  27. 27. AWS Gaming Solutions •  Game Servers Uses DynamoDB •  Directly Export to Redshift •  Or Stage to S3 Integrate With Your Game Database EC2 DynamoDB
  28. 28. AWS Gaming Solutions AWS Mobile Analytics SDK
  29. 29. AWS Gaming Solutions Amazon Mobile Analytics Engagement + Monetization Active Users Sessions In-app Revenue Lifetime Value (LTV) Retention Post-install Retention Funnel Behavior Custom Events
  30. 30. AWS Gaming Solutions Integrating Mobile Analytics is Simple Initialize the MobileAnalyticsManager. For Custom Events activity reports, add events. Handle OnResume() and OnPause() private static MobileAnalyticsManager analytics; analytics = MobileAnalyticsManager.getOrCreateInstance( this.getApplicationContext(),"yourCompany.yourAppId", Regions  .US_EAST_1, config, cognitoProvider ); EventClient eventClient = analytics.getEventClient(); MobileAnalyticsEvent visitEvent = eventClient.createEvent("level1Complete"); eventClient.recordEvent(visitEvent); analytics.getSessionClient().resumeSession(); analytics.getSessionClient().pauseSession(); analytics.getEventClient().submitEvents();
  31. 31. AWS Gaming Solutions Key Business Metrics (with one line of code) 1.  Monthly Active Users (MAU) 2.  Daily Active Users (DAU) 3.  New Users, 4.  Daily Sessions, 5.  Sticky Factor, 6.  1-Day Retention, 7.  Avg. Revenue per DAU, 8.  Daily Paying Users, 9.  Avg. Paying DAU
  32. 32. AWS Gaming Solutions Amazon Mobile Analytics Post-install Retention Funnel
  33. 33. AWS Gaming Solutions # of Likes /Shares Player Abort Rates per Level # of Plays per Hour In-app Item Popularity Track Custom Events
  34. 34. AWS Gaming Solutions Custom Events public  void  onLevelComplete(String  levelName,  String  difficulty,  double   timeToComplete,  int  playerState)  {            //  Create  a  Level  Complete  event  with  some  attributes  and  metrics          AnalyticsEvent  levelCompleteEvent  =                            analytics.getEventClient().createEvent("LevelComplete")                          .withAttribute("LevelName",  levelName)                          .withAttribute("Difficulty",  difficulty)                          .withAttribute("EndState",  playerState)                          .withMetric("TimeToComplete",  timeToComplete);            //Record  the  Level  Complete  event          analytics.getEventClient().recordEvent(levelCompleteEvent);   }  
  35. 35. AWS Gaming Solutions Amazon Mobile Analytics Fast Event data is processed in < 60 minutes Affordable Free 100 MM Events per Month $1 per MM Events beyond the free tier Private You own your data We do not use your data, or share with 3rd parties
  36. 36. AWS Gaming Solutions Exporting to S3 or Redshift S3 Redshift
  37. 37. AWS Gaming Solutions •  Collect Events w/ Mobile Analytics SDK •  Auto-Export to S3 •  Process Data into Redshift •  Analyze with GUI Visualization Tool Mobile Analytics Auto-Export to S3
  38. 38. AWS Gaming Solutions •  Collect Events w/ Mobile Analytics SDK •  Auto-Export Directly to Redshift •  Analyze with GUI Visualization Tool Start Simple
  39. 39. AWS Gaming Solutions Setup Analytics Auto-Export to Redshift
  40. 40. AWS Gaming Solutions Setup Analytics Auto-Export to Redshift
  41. 41. AWS Gaming Solutions Setup Analytics Auto-Export to Redshift http://amzn.to/mobile-redshift-export
  42. 42. AWS Gaming Solutions Exporting to Amazon Redshift 172.16.0.0/20 Public Subnet 172.16.0.0/22 172.16.0.0/20 Local 0.0.0.0/0 IGW Amazon Mobile Analytics EC2
  43. 43. AWS Gaming Solutions SQL with Redshift – Mobile Analytics Data
  44. 44. AWS Gaming Solutions SQL – User Segmentation
  45. 45. AWS Gaming Solutions DAU and MAU in SQL select  date,                count(*)  over  (partition  by                              date_trunc('day',  date)  order  by                          date)  as  dau,                count(*)  over  (partition  by                          date_trunc('month',  date)  order  by                          date)  as  mau   from  user_sessions   order  by  date;  
  46. 46. AWS Gaming Solutions Measure Retention: Repeated Plays create  view  events_by_user_by_month  as   select  user_id,   date_trunc('month',  event_date)   as  month_active,   count(*)  as  total_events   from  events   group  by  user_id,  month_active;    
  47. 47. AWS Gaming Solutions First-Pass Retention – Individual Plays 0 5 10 15 20 25 30 35 40 # Play Sessions / Month nateware Lazyd0g AK187 3strikes
  48. 48. AWS Gaming Solutions Cohorts & Cambria •  Enables calculating relative metrics •  Group users by a common attribute –  Month game installed –  Demographics •  Run analysis by cohort –  Join with metrics •  Use Redshift as it's SQL –  Example of where SQL is a good fit
  49. 49. AWS Gaming Solutions Creating Cohorts with Redshift create  view  cohort_by_first_event_date  as   select  user_id,   date_trunc('month',  min(event_date))   as  first_month   from  events   group  by  user_id;     http://snowplowanalytics.com/analytics/customer- analytics/cohort-analysis.html
  50. 50. AWS Gaming Solutions Retention by Cohort – Join Events 0 5 10 15 20 25 Week 1 Week 2 Week 3 Week 5 Week 6 Week 7 # Sessions / Week 2013-11 2013-12 2014-01 2014-02 2014-03 2014-04
  51. 51. AWS Gaming Solutions Moar Cohorts •  Define multiple cohorts –  By activity, time, demographics –  As many as you like •  Change cohort depending on analysis •  Join same metrics with different cohorts –  Retention by date –  Retention by demographic –  Retention by average plays/month quartile
  52. 52. AWS Gaming Solutions 5-9 notifications retain 1.5x better than 10-14 notifications Forza: Push Notifications vs Retention
  53. 53. AWS Gaming Solutions
  54. 54. AWS Gaming Solutions Data Collection •  Mobile Devices •  Game Servers •  Ad Networks •  Size of event ~ 1 KB •  500M+ events/day •  500G+/day & growing •  JSON format Source of Data Data Size & Growth
  55. 55. AWS Gaming Solutions Redshift Schema •  Every game has its own database •  Each game event = table (e.g., battle_fight, iap) •  40-50 tables per DB schema •  All game titles ~ 1000 tables in DW
  56. 56. AWS Gaming Solutions {"player_id":"323726381807586881","player_level":169,"device":"iPhone 5","version":"iOS 7.1.2”,"platfrom":"ios","client_build":"440”, "db":”mw_dw_ios","table":"player_login", "uuid":"1414566719-rsl3hvhu7o","time_created":"2014-10-29 00:11:59”} {"fight_time":"2014-10-29 00:11:59","attacker_id":"413142642356365377”, "attacker_clan_size":500,"attacker_level":270, "db":"mw_dw_ios","table":"battle_fight", "uuid":"1414566719-p0oogk0bep","time_created":"2014-10-29 00:11:59"} •  PHP/Python Web Services •  Client side analytics SDK •  JSON data format Data Stream
  57. 57. AWS Gaming Solutions Analytics Store Architecture S3 S3 Consumer Game DB Game Servers Kinesis Amazon Redshift Elastic MapReduce DSV JSON
  58. 58. AWS Gaming Solutions Writing to a Kinesis Stream POST  /  HTTP/1.1   Host:  kinesis.<region>.<domain>   x-­‐amz-­‐Date:  <Date>   Authorization:  AWS4-­‐HMAC-­‐SHA256  Credential=<Credential>,  SignedHeaders=content-­‐ type;date;host;user-­‐agent;x-­‐amz-­‐date;x-­‐amz-­‐target;x-­‐amzn-­‐requestid,   Signature=<Signature>   User-­‐Agent:  <UserAgentString>   Content-­‐Type:  application/x-­‐amz-­‐json-­‐1.1   Content-­‐Length:  <PayloadSizeBytes>   Connection:  Keep-­‐Alive   X-­‐Amz-­‐Target:  Kinesis_20131202.PutRecord     {      "StreamName":  "exampleStreamName",      "Data":  "XzxkYXRhPl8x",      "PartitionKey":  "partitionKey"   }  
  59. 59. AWS Gaming Solutions Amazon S3 Spark SQL JDBC Server SQL Dashboard Redshift Consumer EMR Consumer Game DB Game Servers Kinesis DynamoDB DSV JSON
  60. 60. AWS Gaming Solutions Saving Money… EC2 Spot Instances You bid your own price for instances c3.large $0.105/hour $0.0161/hour* m3.2xlarge $0.560/hour $0.0641/hour* On-Demand Spot On-Demand Spot * Price in US-East @ Feb 26, 2014 – 9:40AM PST 85% off 88% off
  61. 61. AWS Gaming Solutions Example Price History
  62. 62. AWS Gaming Solutions Auto Scaling: Let AWS Optimize For You as-create-launch-config spotlc-5cents --image-id ami-e565ba8c --instance-type m1.small --spot-price “0.05” . . . as-create-auto-scaling-group spotasg --launch-configuration spotlc-5cents --availability-zones “us-east-1a,us-east-1b” --max-size 16 --min-size 1 --desiredcapacity 3
  63. 63. AWS Gaming Solutions EMR Cluster With Spot aws emr create-cluster --name "Multiple task instance group cluster" --ami-version 3.2.3 --ec2-attributes AvailabilityZone=eu-west-1b --instance-groups InstanceGroupType=MASTER,Name="Master",InstanceCount=1,InstanceType=m3.xlarge InstanceGroupType=CORE,Name="Core",InstanceCount=4,InstanceType=m3.xlarge InstanceGroupType=TASK,Name="Task1",InstanceCount=25,InstanceType=m3.xlarge,BidPrice=0.28 InstanceGroupType=TASK,Name="Task2",InstanceCount=10,InstanceType=r3.xlarge,BidPrice=0.28
  64. 64. AWS Gaming Solutions •  S3 as Data Lake •  Redshift for Analysis •  Collect Everything •  Iterate on Reports Bring It All Back EC2 External Analytics
  65. 65. AWS Gaming Solutions Amazon S3 Spark SQL JDBC Server SQL Dashboard Redshift Consumer EMR Consumer Game DB Game Servers Kinesis DynamoDB DSV JSON
  66. 66. 67 Nate Wiger Principal, Gaming Solutions @nateware nateware@amazon.com

×