SlideShare a Scribd company logo
asynchronous personalization
   [and CDNs and A/B testing and stuff]

               Jon Pliske
    Performance Engineering, Groupon

                   @jonpliske
             jpliske@groupon.com
You might know me from this leaked photo on TechCrunch



           Jon Pliske
Performance Engineering, Groupon

                    @jonpliske
              jpliske@groupon.com
overview

 background
 CDN caching
 async personalization
 a/b/multivariate testing /w finch.js
performance anxiety

 big rails app                 performance issues
 big team          ===         development process hurdles
 big traffic                   drinking problems


    Reaching limit of Rails' caching
    Low-level optimizations too "incremental"
    Rewriting SQL is boring
    Improve platform architecture
super bowl party
prelude:
jan 1. "btw we have pre/post super bowl commercials"
jan 15. "scored an in-game spot, we good?"
feb 15. offend the world

"spike mode":
   CDN cache it all!
   disable login
   offload geocoding/subscriptions/orders to EC2
   limited functionality === unhappy users
pics or it didn't happen
pics or it didn't happen
CDNs are neat
pros                           cons
low latency                    dynamic content
"edge side nodes"              personalization
high capacity                  complexity
static content                 overkill?


        specifically:
        personalized content (login menu, deals)
        analytics tracking
        a/b testing
        Rails developers
async personalization
target: deal/division pages (> 50% of traffic)

approach:
1. cache "anonymous" page in CDN
2. hide stuff
3. make AJAX request for personalized data/content
4. show stuff


See Chris Williams' "Rails’ Best Caching Method is JavaScript"
from GoRuCo 2010
obligatory omnigraffle diagram
Asynchronous Personalization at Groupon - JSConf 2011
Asynchronous Personalization at Groupon - JSConf 2011
"Anonymous" user
before:
initial page response time: 0.8 sec
rendering time (e.g. loading css/js/images): 1 sec
total: 1.8 sec

after:
initial page response time: 0.1 sec
rendering time: 1 sec
total: 1.1 sec

only a little bit faster...(1.1 vs 1.8 sec)
basically no server load => huge capacity increase!
Logged-in User / Subscriber
before:
initial page response time: 3 sec
rendering time (e.g. loading js/css/images): 1 sec
total time: 4 sec

after:
initial page response time: 0.1 sec
rendering time (include AJAX call:1 sec): 1 sec
total time: 1.1 sec

Capacity constant: AJAX call still needs to hit Rails
300% faster!
[wait for applause]
development implications

less Rails, more JS
1 user !== 1 (Rails) request

goodbye:
current_user
session
cookies

testing
onCurrentUserReady(callback)
callback when personalize API returns (or callback immediately
for anonymous user)

before:
- if logged_in?
   do stuff for logged-in user
- else
   do stuff for anonymous user

after:
Groupon.onCurrentUserReady(function(){
 if (Groupon.currentUser.isAuthenticated) {
   do stuff for logged-in user
 } else { do stuff for anonymous user }
});
analytics
Problem: Request logging
Solution: Tracking pixel (hit Nginx only, not Rails)

Problem: Content changes
Solution: Dynamic tracking pixel

Problem: Tracking params (e.g. utm params, affiliate id, etc...)
Solution: Store in cookie; append params to API request
a/b testing with Finch
Problem: Finch uses view/controller logic to choose and track
experiments and variants

- experiment 'Two vs. Three Step Subscription' do |e|

   - e.variant 'Original' do
     %h1 Fill out this form to subscribe now

   - e.variant 'Two Step' do
     %h4 Follow these two steps to subscribe

   - e.variant 'Three Step' do
     %p Subscribe now - it only takes a few seconds
Finch.js
Finch.Experiments.DelayedJSExperiment = {
  defer: function() {
    var experiment = this;
    FinchDemo.onCurrentUserReady(function() {
     experiment.deferedRun(this);
    });
  },
  before: function() { $('#delayed').hide(); },
  after: function() { $('#delayed').show(); },
  variants: {
    original: function() { $('#delayed .original').show(); },
    alternate: function() { $('#delayed .alternate').show();},
  }
};
$(function() {
  Finch.run(window);
});
Finch.js
 based on Google's "Overlapping Experiment Infrastructure"
 written in coffee-script
 open source soon-ishly
 ~ 15k of JS
 doesn't handle tracking/analytics/analysis side of testing
 (yet?)
the future
pure-JSON API requests
client-side rendering (/w mustache.js)
HTML5 storage
decouple from Rails

development practices:
front/back-end integration
better testing
better monitoring
Thank you!




      @jonpliske
jpliske@groupon.com
groupon.com/techjobs

More Related Content

PDF
"Backbone React Flux" Артем Тритяк
PDF
Backbone.js with React Views - Server Rendering, Virtual DOM, and More!
PDF
Backbone & React Together Forever
PDF
Avoiding Common Pitfalls in Ember.js
PPTX
Measuring web performance
PPT
Velocity EU 2012 - Third party scripts and you
PDF
Making the web faster
PDF
Service Worker Presentation
"Backbone React Flux" Артем Тритяк
Backbone.js with React Views - Server Rendering, Virtual DOM, and More!
Backbone & React Together Forever
Avoiding Common Pitfalls in Ember.js
Measuring web performance
Velocity EU 2012 - Third party scripts and you
Making the web faster
Service Worker Presentation

What's hot (20)

PDF
The Mysteries Of JavaScript-Fu (RailsConf Ediition)
PPTX
Ci of js and apex using jasmine, phantom js and drone io df14
PDF
Cucumber.js: Cuke up your JavaScript!
PDF
Service worker - Offline Web
PPTX
HTML5 Web Workers-unleashed
PPT
Automating your plugin with WP-Cron
PPTX
Retrofitting Continuous Delivery
PPTX
BDD / cucumber /Capybara
PDF
DevOps and Hybrid Applications: What You Need to Know
PPTX
Selenium with protractor
ODP
Kickstart Jpa
PDF
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
PPTX
JavaScript Task Runners - Gulp & Grunt
PPTX
SQL Server - CLR integration
PPTX
Packing for the Web with Webpack
PDF
Alexander Mostovenko "'Devide at impera' with GraphQL and SSR"
PPTX
CSS Regression Tests
PDF
Testing Mobile JavaScript
PDF
Bundle your modules with Webpack
PDF
Search 500-video-clips
The Mysteries Of JavaScript-Fu (RailsConf Ediition)
Ci of js and apex using jasmine, phantom js and drone io df14
Cucumber.js: Cuke up your JavaScript!
Service worker - Offline Web
HTML5 Web Workers-unleashed
Automating your plugin with WP-Cron
Retrofitting Continuous Delivery
BDD / cucumber /Capybara
DevOps and Hybrid Applications: What You Need to Know
Selenium with protractor
Kickstart Jpa
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
JavaScript Task Runners - Gulp & Grunt
SQL Server - CLR integration
Packing for the Web with Webpack
Alexander Mostovenko "'Devide at impera' with GraphQL and SSR"
CSS Regression Tests
Testing Mobile JavaScript
Bundle your modules with Webpack
Search 500-video-clips
Ad

Similar to Asynchronous Personalization at Groupon - JSConf 2011 (20)

PDF
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
PPTX
JavaScript Performance Patterns
PPTX
JavaScript performance patterns
PDF
Progressive web apps
PPTX
Presentation Tier optimizations
PPTX
Operational API design anti-patterns (Jason Harmon)
PPTX
Take Your XPages Development to the Next Level
PDF
Continuous Deployment: The Dirty Details
PPT
Tips for a Faster Website
PDF
Serverless in production, an experience report (FullStack 2018)
PPTX
Google I/O 2012 - Protecting your user experience while integrating 3rd party...
PDF
Performance on the Yahoo! Homepage
PDF
Building performance into the new yahoo homepage presentation
PPT
Scaling 101
PPT
Scaling 101 test
PDF
Serverless in production, an experience report (IWOMM)
PDF
Антон Серпутько “Testing and optimization of client-side performance”
PDF
Web Development Foundation & Team Collaboration
PDF
Grunt.js and Yeoman, Continous Integration
PDF
Serverless in Production, an experience report (AWS UG South Wales)
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
JavaScript Performance Patterns
JavaScript performance patterns
Progressive web apps
Presentation Tier optimizations
Operational API design anti-patterns (Jason Harmon)
Take Your XPages Development to the Next Level
Continuous Deployment: The Dirty Details
Tips for a Faster Website
Serverless in production, an experience report (FullStack 2018)
Google I/O 2012 - Protecting your user experience while integrating 3rd party...
Performance on the Yahoo! Homepage
Building performance into the new yahoo homepage presentation
Scaling 101
Scaling 101 test
Serverless in production, an experience report (IWOMM)
Антон Серпутько “Testing and optimization of client-side performance”
Web Development Foundation & Team Collaboration
Grunt.js and Yeoman, Continous Integration
Serverless in Production, an experience report (AWS UG South Wales)
Ad

Recently uploaded (20)

PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Encapsulation theory and applications.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
MYSQL Presentation for SQL database connectivity
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
sap open course for s4hana steps from ECC to s4
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Empathic Computing: Creating Shared Understanding
Digital-Transformation-Roadmap-for-Companies.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Encapsulation theory and applications.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
MYSQL Presentation for SQL database connectivity
MIND Revenue Release Quarter 2 2025 Press Release
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Per capita expenditure prediction using model stacking based on satellite ima...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Chapter 3 Spatial Domain Image Processing.pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
sap open course for s4hana steps from ECC to s4

Asynchronous Personalization at Groupon - JSConf 2011

  • 1. asynchronous personalization [and CDNs and A/B testing and stuff] Jon Pliske Performance Engineering, Groupon @jonpliske jpliske@groupon.com
  • 2. You might know me from this leaked photo on TechCrunch Jon Pliske Performance Engineering, Groupon @jonpliske jpliske@groupon.com
  • 3. overview background CDN caching async personalization a/b/multivariate testing /w finch.js
  • 4. performance anxiety big rails app performance issues big team === development process hurdles big traffic drinking problems Reaching limit of Rails' caching Low-level optimizations too "incremental" Rewriting SQL is boring Improve platform architecture
  • 5. super bowl party prelude: jan 1. "btw we have pre/post super bowl commercials" jan 15. "scored an in-game spot, we good?" feb 15. offend the world "spike mode": CDN cache it all! disable login offload geocoding/subscriptions/orders to EC2 limited functionality === unhappy users
  • 6. pics or it didn't happen
  • 7. pics or it didn't happen
  • 8. CDNs are neat pros cons low latency dynamic content "edge side nodes" personalization high capacity complexity static content overkill? specifically: personalized content (login menu, deals) analytics tracking a/b testing Rails developers
  • 9. async personalization target: deal/division pages (> 50% of traffic) approach: 1. cache "anonymous" page in CDN 2. hide stuff 3. make AJAX request for personalized data/content 4. show stuff See Chris Williams' "Rails’ Best Caching Method is JavaScript" from GoRuCo 2010
  • 13. "Anonymous" user before: initial page response time: 0.8 sec rendering time (e.g. loading css/js/images): 1 sec total: 1.8 sec after: initial page response time: 0.1 sec rendering time: 1 sec total: 1.1 sec only a little bit faster...(1.1 vs 1.8 sec) basically no server load => huge capacity increase!
  • 14. Logged-in User / Subscriber before: initial page response time: 3 sec rendering time (e.g. loading js/css/images): 1 sec total time: 4 sec after: initial page response time: 0.1 sec rendering time (include AJAX call:1 sec): 1 sec total time: 1.1 sec Capacity constant: AJAX call still needs to hit Rails 300% faster!
  • 16. development implications less Rails, more JS 1 user !== 1 (Rails) request goodbye: current_user session cookies testing
  • 17. onCurrentUserReady(callback) callback when personalize API returns (or callback immediately for anonymous user) before: - if logged_in? do stuff for logged-in user - else do stuff for anonymous user after: Groupon.onCurrentUserReady(function(){ if (Groupon.currentUser.isAuthenticated) { do stuff for logged-in user } else { do stuff for anonymous user } });
  • 18. analytics Problem: Request logging Solution: Tracking pixel (hit Nginx only, not Rails) Problem: Content changes Solution: Dynamic tracking pixel Problem: Tracking params (e.g. utm params, affiliate id, etc...) Solution: Store in cookie; append params to API request
  • 19. a/b testing with Finch Problem: Finch uses view/controller logic to choose and track experiments and variants - experiment 'Two vs. Three Step Subscription' do |e| - e.variant 'Original' do %h1 Fill out this form to subscribe now - e.variant 'Two Step' do %h4 Follow these two steps to subscribe - e.variant 'Three Step' do %p Subscribe now - it only takes a few seconds
  • 20. Finch.js Finch.Experiments.DelayedJSExperiment = { defer: function() { var experiment = this; FinchDemo.onCurrentUserReady(function() { experiment.deferedRun(this); }); }, before: function() { $('#delayed').hide(); }, after: function() { $('#delayed').show(); }, variants: { original: function() { $('#delayed .original').show(); }, alternate: function() { $('#delayed .alternate').show();}, } }; $(function() { Finch.run(window); });
  • 21. Finch.js based on Google's "Overlapping Experiment Infrastructure" written in coffee-script open source soon-ishly ~ 15k of JS doesn't handle tracking/analytics/analysis side of testing (yet?)
  • 22. the future pure-JSON API requests client-side rendering (/w mustache.js) HTML5 storage decouple from Rails development practices: front/back-end integration better testing better monitoring
  • 23. Thank you! @jonpliske jpliske@groupon.com groupon.com/techjobs