SlideShare ist ein Scribd-Unternehmen logo
1 von 14
Redis @ 6Wunderkinder
    - more than just a cache -
         Sebastian Kreutzberger, CTO
About 6Wunderkinder
•   Startup based in Berlin, 18 employees

•   VC-backed

•   „Wunderlist“ - free, multi-platform task app

    -   >600k registered users, >1,6 million downloads

    -   Android, iPhone, iPad, Web, Mac & Windows

    -   App of the Week in 69 Apple App Stores

•   „Wunderkit“ - productivity platform, currently
    in development, „next big thing“
Redis @ Wunderlist
• Wunderlist backend based on LAMP
• No cache was used in the beginning
• After incredible growth in userbase the
  marketing & BI needed statistics
• Solution: Redis!
• Why? Persistent, fast & super-simple
Statistics with Redis
• Store 2 types of statistical data:
 - simple daily increments to count
     syncs, hits & registrations, etc.
 -   daily Sets of user-ids who are active on
     that day, important for marketing to see
     how many people are using Wunderlist
     for how many days
Example
<?php

     $cache = new Redis();
     /* .... connection stuff .... */

     // increment daily sync counter
     $key = "sync: " . date("Ymd"); // day-based key
     $cache->incr($key);


     // store current user in today’s active-users Set
     $key = "active: " . date("Ymd");
     $cache->sAdd($key, $user_id);


     // get all user-ids who were active yesterday
     $yesterday = strtotime("-1 days 00:00");
     $key 
        = "active: " . date("Ymd", $time);
     $users        = $cache->sMembers($key);

?>
More details ...
• PHPRedis as module for PHP is very fast!
• Wrote cache abstraction layer for possible
  replacement of Redis with Memcached
• Currently just do caching on user objects
• Tasks & lists change too often for caching
• Put a complete object into cache, not just a
  database row
Redis @ Wunderkit

• Wunderkit uses MongoDB + async jobs
• Redis is fundamental part of architecture
• Even more important than database
• Heavy usage of Redis Lists (a.k.a. queues)
Usage at Wunderkit

• Caching of nearly all objects
• Statistics
• Logging
• Job Queue
Logging with Redis
• Wrote own PHP Error Handler
• Extended it for own logging
• Store PHP errors & log in Redis List
• Keys are based upon day & log level
• Very simple retrieval
• High-performance & scalable
Job Queue I

• Queue is a simple Redis List
• Wrote a helper class for easy queue input
• Every app server can „outsource“
  processing by putting a job onto the queue
• Each job contains the following data:
  a URL to a worker server + parameters
  => very simple, light-weight & scalable!
Job Queue II

• Dozens of parallel PHP scripts running as
  daemon(!) listen for new jobs on the queue
• brPop($key, $time) listens for new jobs
• No concurrencies, Redis is single-threaded
• Job URL is optimistically called, no waiting
  for response, „fire & forget“
  => many jobs per second!
Example Daemon
<?php

     /* ... do crazy PHP daemon stuff here ... */

     $cache = new Redis();
     /* .... connection stuff .... */

     while (1) // infinite loop
     {
       $ret = $cache->brPop("queue", 30); // listen for 30 seconds
       if ($ret != false) // something new on the queue
       {
       
 fireAsyncRequest($ret["url"], $ret["params"]);
       }
     }

?>
Todos
• Replacing PHP daemon with Erlang
• Adding of message queue incl. callbacks
• Diving into Redis Sharding
• Putting even more stuff into Redis. Why?
  Because we love Redis!
Thanks!
• Contact:
  Twitter: @skreutzb
  E-Mail: sebastiank@6wunderkinder.com
  Web:   www.6wunderkinder.com


• P.S.: We are hiring!

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Mongo Web Apps: OSCON 2011
Mongo Web Apps: OSCON 2011Mongo Web Apps: OSCON 2011
Mongo Web Apps: OSCON 2011
 
Front End Development Automation with Grunt
Front End Development Automation with GruntFront End Development Automation with Grunt
Front End Development Automation with Grunt
 
Code decoupling from Symfony (and others frameworks) - PHP Conference Brasil ...
Code decoupling from Symfony (and others frameworks) - PHP Conference Brasil ...Code decoupling from Symfony (and others frameworks) - PHP Conference Brasil ...
Code decoupling from Symfony (and others frameworks) - PHP Conference Brasil ...
 
Mysqlnd uh
Mysqlnd uhMysqlnd uh
Mysqlnd uh
 
Create Rest API in Nodejs
Create Rest API in Nodejs Create Rest API in Nodejs
Create Rest API in Nodejs
 
Elastic Search
Elastic SearchElastic Search
Elastic Search
 
URI handlers
URI handlersURI handlers
URI handlers
 
Ansible to provision your machines
Ansible to provision your machinesAnsible to provision your machines
Ansible to provision your machines
 
MongoDB使用技巧
MongoDB使用技巧MongoDB使用技巧
MongoDB使用技巧
 
What is AWS S3?
What is AWS S3?What is AWS S3?
What is AWS S3?
 
Yesplan: 10 Years later
Yesplan: 10 Years laterYesplan: 10 Years later
Yesplan: 10 Years later
 
Secrets with Ansible
Secrets with AnsibleSecrets with Ansible
Secrets with Ansible
 
Banquet 36
Banquet 36Banquet 36
Banquet 36
 
Easy REST with OpenAPI
Easy REST with OpenAPIEasy REST with OpenAPI
Easy REST with OpenAPI
 
Quick start guide to java script frameworks for sharepoint add ins oslo
Quick start guide to java script frameworks for sharepoint add ins osloQuick start guide to java script frameworks for sharepoint add ins oslo
Quick start guide to java script frameworks for sharepoint add ins oslo
 
Server side scripting smack down - Node.js vs PHP
Server side scripting smack down - Node.js vs PHPServer side scripting smack down - Node.js vs PHP
Server side scripting smack down - Node.js vs PHP
 
Create a RESTful API with NodeJS, Express and MongoDB
Create a RESTful API with NodeJS, Express and MongoDBCreate a RESTful API with NodeJS, Express and MongoDB
Create a RESTful API with NodeJS, Express and MongoDB
 
Tornado my
Tornado myTornado my
Tornado my
 
elasticsearch basics workshop
elasticsearch basics workshopelasticsearch basics workshop
elasticsearch basics workshop
 
Why MongoDB over other Databases - Habilelabs
Why MongoDB over other Databases - HabilelabsWhy MongoDB over other Databases - Habilelabs
Why MongoDB over other Databases - Habilelabs
 

Ähnlich wie Redis At 6Wunderkinder

Buildingsocialanalyticstoolwithmongodb
BuildingsocialanalyticstoolwithmongodbBuildingsocialanalyticstoolwithmongodb
Buildingsocialanalyticstoolwithmongodb
MongoDB APAC
 
Redis everywhere - PHP London
Redis everywhere - PHP LondonRedis everywhere - PHP London
Redis everywhere - PHP London
Ricard Clau
 
First Hive Meetup London 2012-07-10 - Tomas Cervenka - VisualDNA
First Hive Meetup London 2012-07-10 - Tomas Cervenka - VisualDNAFirst Hive Meetup London 2012-07-10 - Tomas Cervenka - VisualDNA
First Hive Meetup London 2012-07-10 - Tomas Cervenka - VisualDNA
Tomas Cervenka
 
De-Bugging Hive with Hadoop-in-the-Cloud
De-Bugging Hive with Hadoop-in-the-CloudDe-Bugging Hive with Hadoop-in-the-Cloud
De-Bugging Hive with Hadoop-in-the-Cloud
DataWorks Summit
 
One Tool to Rule Them All- Seamless SQL on MongoDB, MySQL and Redis with Apac...
One Tool to Rule Them All- Seamless SQL on MongoDB, MySQL and Redis with Apac...One Tool to Rule Them All- Seamless SQL on MongoDB, MySQL and Redis with Apac...
One Tool to Rule Them All- Seamless SQL on MongoDB, MySQL and Redis with Apac...
Tim Vaillancourt
 
How Shopify Scales Rails
How Shopify Scales RailsHow Shopify Scales Rails
How Shopify Scales Rails
jduff
 

Ähnlich wie Redis At 6Wunderkinder (20)

Buildingsocialanalyticstoolwithmongodb
BuildingsocialanalyticstoolwithmongodbBuildingsocialanalyticstoolwithmongodb
Buildingsocialanalyticstoolwithmongodb
 
PlayNice.ly: Using Redis to store all our data, hahaha (Redis London Meetup)
PlayNice.ly: Using Redis to store all our data, hahaha (Redis London Meetup)PlayNice.ly: Using Redis to store all our data, hahaha (Redis London Meetup)
PlayNice.ly: Using Redis to store all our data, hahaha (Redis London Meetup)
 
Redis everywhere - PHP London
Redis everywhere - PHP LondonRedis everywhere - PHP London
Redis everywhere - PHP London
 
Top ten-list
Top ten-listTop ten-list
Top ten-list
 
Wmware NoSQL
Wmware NoSQLWmware NoSQL
Wmware NoSQL
 
Fundamentals of performance tuning PHP on IBM i
Fundamentals of performance tuning PHP on IBM i  Fundamentals of performance tuning PHP on IBM i
Fundamentals of performance tuning PHP on IBM i
 
First Hive Meetup London 2012-07-10 - Tomas Cervenka - VisualDNA
First Hive Meetup London 2012-07-10 - Tomas Cervenka - VisualDNAFirst Hive Meetup London 2012-07-10 - Tomas Cervenka - VisualDNA
First Hive Meetup London 2012-07-10 - Tomas Cervenka - VisualDNA
 
De-Bugging Hive with Hadoop-in-the-Cloud
De-Bugging Hive with Hadoop-in-the-CloudDe-Bugging Hive with Hadoop-in-the-Cloud
De-Bugging Hive with Hadoop-in-the-Cloud
 
Debugging Hive with Hadoop-in-the-Cloud
Debugging Hive with Hadoop-in-the-CloudDebugging Hive with Hadoop-in-the-Cloud
Debugging Hive with Hadoop-in-the-Cloud
 
Document Locking with Redis in Symfony2
Document Locking with Redis in Symfony2Document Locking with Redis in Symfony2
Document Locking with Redis in Symfony2
 
RedisConf18 - Writing modular & encapsulated Redis code
RedisConf18 - Writing modular & encapsulated Redis codeRedisConf18 - Writing modular & encapsulated Redis code
RedisConf18 - Writing modular & encapsulated Redis code
 
Icinga 2009 at OSMC
Icinga 2009 at OSMCIcinga 2009 at OSMC
Icinga 2009 at OSMC
 
Redis. Performance on custom searches. Production screw up
Redis. Performance on custom searches. Production screw upRedis. Performance on custom searches. Production screw up
Redis. Performance on custom searches. Production screw up
 
Webinar: Managing Real Time Risk Analytics with MongoDB
Webinar: Managing Real Time Risk Analytics with MongoDB Webinar: Managing Real Time Risk Analytics with MongoDB
Webinar: Managing Real Time Risk Analytics with MongoDB
 
Boosting the Performance of your Rails Apps
Boosting the Performance of your Rails AppsBoosting the Performance of your Rails Apps
Boosting the Performance of your Rails Apps
 
One Tool to Rule Them All- Seamless SQL on MongoDB, MySQL and Redis with Apac...
One Tool to Rule Them All- Seamless SQL on MongoDB, MySQL and Redis with Apac...One Tool to Rule Them All- Seamless SQL on MongoDB, MySQL and Redis with Apac...
One Tool to Rule Them All- Seamless SQL on MongoDB, MySQL and Redis with Apac...
 
How Shopify Scales Rails
How Shopify Scales RailsHow Shopify Scales Rails
How Shopify Scales Rails
 
SQL To NoSQL - Top 6 Questions Before Making The Move
SQL To NoSQL - Top 6 Questions Before Making The MoveSQL To NoSQL - Top 6 Questions Before Making The Move
SQL To NoSQL - Top 6 Questions Before Making The Move
 
Hadoop-Quick introduction
Hadoop-Quick introductionHadoop-Quick introduction
Hadoop-Quick introduction
 
05 integrate redis
05 integrate redis05 integrate redis
05 integrate redis
 

Kürzlich hochgeladen

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Kürzlich hochgeladen (20)

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 

Redis At 6Wunderkinder

  • 1. Redis @ 6Wunderkinder - more than just a cache - Sebastian Kreutzberger, CTO
  • 2. About 6Wunderkinder • Startup based in Berlin, 18 employees • VC-backed • „Wunderlist“ - free, multi-platform task app - >600k registered users, >1,6 million downloads - Android, iPhone, iPad, Web, Mac & Windows - App of the Week in 69 Apple App Stores • „Wunderkit“ - productivity platform, currently in development, „next big thing“
  • 3. Redis @ Wunderlist • Wunderlist backend based on LAMP • No cache was used in the beginning • After incredible growth in userbase the marketing & BI needed statistics • Solution: Redis! • Why? Persistent, fast & super-simple
  • 4. Statistics with Redis • Store 2 types of statistical data: - simple daily increments to count syncs, hits & registrations, etc. - daily Sets of user-ids who are active on that day, important for marketing to see how many people are using Wunderlist for how many days
  • 5. Example <?php $cache = new Redis(); /* .... connection stuff .... */ // increment daily sync counter $key = "sync: " . date("Ymd"); // day-based key $cache->incr($key); // store current user in today’s active-users Set $key = "active: " . date("Ymd"); $cache->sAdd($key, $user_id); // get all user-ids who were active yesterday $yesterday = strtotime("-1 days 00:00"); $key = "active: " . date("Ymd", $time); $users = $cache->sMembers($key); ?>
  • 6. More details ... • PHPRedis as module for PHP is very fast! • Wrote cache abstraction layer for possible replacement of Redis with Memcached • Currently just do caching on user objects • Tasks & lists change too often for caching • Put a complete object into cache, not just a database row
  • 7. Redis @ Wunderkit • Wunderkit uses MongoDB + async jobs • Redis is fundamental part of architecture • Even more important than database • Heavy usage of Redis Lists (a.k.a. queues)
  • 8. Usage at Wunderkit • Caching of nearly all objects • Statistics • Logging • Job Queue
  • 9. Logging with Redis • Wrote own PHP Error Handler • Extended it for own logging • Store PHP errors & log in Redis List • Keys are based upon day & log level • Very simple retrieval • High-performance & scalable
  • 10. Job Queue I • Queue is a simple Redis List • Wrote a helper class for easy queue input • Every app server can „outsource“ processing by putting a job onto the queue • Each job contains the following data: a URL to a worker server + parameters => very simple, light-weight & scalable!
  • 11. Job Queue II • Dozens of parallel PHP scripts running as daemon(!) listen for new jobs on the queue • brPop($key, $time) listens for new jobs • No concurrencies, Redis is single-threaded • Job URL is optimistically called, no waiting for response, „fire & forget“ => many jobs per second!
  • 12. Example Daemon <?php /* ... do crazy PHP daemon stuff here ... */ $cache = new Redis(); /* .... connection stuff .... */ while (1) // infinite loop { $ret = $cache->brPop("queue", 30); // listen for 30 seconds if ($ret != false) // something new on the queue { fireAsyncRequest($ret["url"], $ret["params"]); } } ?>
  • 13. Todos • Replacing PHP daemon with Erlang • Adding of message queue incl. callbacks • Diving into Redis Sharding • Putting even more stuff into Redis. Why? Because we love Redis!
  • 14. Thanks! • Contact: Twitter: @skreutzb E-Mail: sebastiank@6wunderkinder.com Web: www.6wunderkinder.com • P.S.: We are hiring!

Hinweis der Redaktion

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n