SlideShare ist ein Scribd-Unternehmen logo
1 von 32
Making Single Page Apps Faster
Manuel Alvarez
Enterprise Architect
@MD_A13
Boris Livshutz
Senior Enterprise Architect
@livshitz98
©2016 AKAMAI | FASTER FORWARDTM
• New way to build on the web
• Growing popularity
• Single HTML page
• Navigation using JavaScript, APIs
• Causes performance degradation
• We are here to help!
• Choosing the right framework for
Performance
• Make your SPA perform faster
• Monitor SPA’s performance
Builtwith Data
Why are we talking about SPA today?
©2016 AKAMAI | FASTER FORWARDTM
Choosing the Right Framework
©2016 AKAMAI | FASTER FORWARDTM
SPA and the MVC Architecture
Years of architecture evolution:
• SOFEA: Service-Oriented Front-End
Architecture (2007)
• JavaScript, flash, and AJAX
• MV-X architectures are designed to
separate the view from the model
• Server-side developer focus on business logic
• The client is developed separately, allowing
code reuse for SPA, native apps, SOA, etc.
Model View Controller
View
Model
Controller
Fires Event
(Updates)
Passes
Calls to
Modifies
Image from Rohit Ghatol
©2016 AKAMAI | FASTER FORWARDTM
Current SPA trends
Metric AngularJS Angular 2 Backbone.js Ember.js React.js
Stars on
Github
48k 10k 24k 16k 39k
Commits 7k 4k 3k 18k 6k
StackOverflow
Questions
174k 11k 19k 19k 18k
GitHub
Contributors
1,426 219 282 569 645
Compresses sizes if you are curious
©2016 AKAMAI | FASTER FORWARDTM
• Easy to start, great community support,
and does not have dependencies
• Not very good partnering with 3rd party
JavaScripts
• Great for “ambitious” web apps
• It has dependencies on handlebars and
jQuery
• Handlebars uses <script> tags as
markers, increasing DOM complexity
• It uses the Virtual DOM to minimize real
DOM changes
• React is only the view layer
• It has a minimalistic approach and it
has good compatibility with other JS
libraries
• Dependencies on Underscore.js and
jQuery
Current SPA trends
©2016 AKAMAI | FASTER FORWARDTM
What is the right framework?
Stefan Krause
©2016 AKAMAI | FASTER FORWARDTM
Angular 1 Angular 2 Ember.js React.js
Create 1k
rows (ms)
249.56 192.38 747.01 201.17
Append 1k
rows (ms)
826.88 679.67 729.01 344.25
Clear 10k
rows (ms)
840.63 436.54 1,182.97 2,027.88
Memory (on
load) MB
4.86 17.05 10.1 5.17
Benchmarks
Stefan Krause
Chris Harrington
How are you using tables if at all?
What are your top browsers?
©2016 AKAMAI | FASTER FORWARDTM
• Research them and read a little code
• Evaluate their capabilities; e.g. testing tools
• Implement them
• Play around http://todomvc.com/
• “Hello world” + common tasks in your top browser
• Can you start from an existing project?
• What you are doing is so unique that it is probably on github 
• Use a decision matrix
What is the right framework?
©2016 AKAMAI | FASTER FORWARDTM
AngularJS Ember React
Learn 10 6 8
Develop 9 8 9
Test 8 9 8
Secure 7 8 4
Build 9 10 9
Deploy 10 10 10
Debug 7 10 7
Scale 9 7 10
Maintain 3 5 4
Share 10 10 10
82 83 79
Filler by Matt Raible - http://akamai.me/1pRfU1g
Evaluate Frameworks
Yevgeniy Brikman’s Framework Scorecard
©2016 AKAMAI | FASTER FORWARDTM
Obstacles to Good Performance
©2016 AKAMAI | FASTER FORWARDTM
Does SPA Make Your Site Faster?
• Yes, for 2nd and subsequent pages (soft / virtual pages)
• No, for 1st page (homepage, landing page, deep link)
• 1st page ruins experience (“judge a book by its cover!”)
• Leads to user abandonment
• Frameworks try to do everything
for everybody, causing
“framework overhead”
©2016 AKAMAI | FASTER FORWARDTM
Framework Overhead - Example
Automatic Initialization in Angular
1. DOMContentLoaded event
triggers Initialization
2. Loads the module associated with
the directive
3. Creates the Application Injector
4. Compiles the DOM with ng-app as
root
5. Framework loads all dynamic
content
©2016 AKAMAI | FASTER FORWARDTM
Performance Dive – Waterfall Analysis
©2016 AKAMAI | FASTER FORWARDTM
Constant Reinstall
• Bootstrap process is equivalent to installation
• Visiting the page again (each new browser context) results on
“reinstalling”
• Deep links (search engines landing page) require bootstrap first and
then repaint the linked page (hard + soft navigation in one!)
©2016 AKAMAI | FASTER FORWARDTM
Mobile Magnifies the Problem
• Cellular network – high
latency on API calls
• Limited memory - large
framework
• Weak CPU – heavy JavaScript
processing
CPU = 800MHz dual-c
Memory = 512MB
SunSpider = ~1880ms
CPU = 2.6GHz quad-c
Memory = 16GB
SunSpider = ~145ms
Table from Ilya Grigorik
©2016 AKAMAI | FASTER FORWARDTM
SPA Performance Solutions
©2016 AKAMAI | FASTER FORWARDTM
Light First Visit
• First visit does not have the framework in cache
• Serve a “skeleton” that looks like the real page
but with a reduced version of the framework
• Execute the full framework later
• On the second page
• When user clicks
• Async execution
• Pre-render
©2016 AKAMAI | FASTER FORWARDTM
Server Side Rendering
• Isomorphic App - both Server and client rendering
• Step 1: Server renders page into HTML
• Step 2: Client Side rendering but no impact to perceived timing
• Framework Support
• React - Native support
• AngularJS - Version 2.0 has native support
• Backbone.js - Render library
• Ember.js - FastBoot feature
©2016 AKAMAI | FASTER FORWARDTM
Server Side Rendering: Angular
Step by step process in Angular
1. Process the JS on the Server Side
2. Result served to the client as the page HTML
3. Browser renders HTML as standard web page
4. Preboot starts to listen for user clicks since html is not interactive
5. Angular performs all client side bootstrapping in the background
6. As client side bootstrapping is done, it will redraw using new DOM
7. Preboot will now replay all user clicks captured previously.
©2016 AKAMAI | FASTER FORWARDTM
Server Side Rendering: React
Step by step process in React
1. Process the JS on the Server Side
2. Result served to the client as the page HTML
3. Browser renders HTML as standard web page
4. React performs all client side bootstrapping without affecting html page
5. Result is identical to what is already displayed on the page
6. React smartly identifies that no render change is needed
1. DOM is not touched (usually most expensive step)
2. Event Handler hooks are added to the current page
©2016 AKAMAI | FASTER FORWARDTM
Virtual DOM Library
• Direct DOM manipulation causes constant rerender and reflow
• Use Virtual DOM to avoid reflow and rerender
• React.js - builtin virtual DOM along with rendering engine
• 3rd party Virtual DOM libraries - Mercury, Elm, many more
©2016 AKAMAI | FASTER FORWARDTM
JavaScript Packaging
• Choose a Package Manager
• Fits DevOps build process
• Compromise: network
roundtrips vs caching
• Trial and Error to find
compromise
©2016 AKAMAI | FASTER FORWARDTM
Resource Deferment
• Defer and accelerate loading
Javascript
• AMD - Asynchronous Module
Definition API
• WebPack - Code splitting
• RequireJS - dynamic and async
module loader
• Defer images to future pages
• Use Minimized Libraries
©2016 AKAMAI | FASTER FORWARDTM
• Cache more! at browser and Edge
• Cache JSON responses
• Use advance caching features
• Normalize URL parameters
• Enforce uniform ordering of URL
parameters
/weather?lang=20&latitude=47.43&longitude=19.30
/weather?longitude=19.30&latitude=47.43&lang=20
/weather?zipcode=98122&lang=20
/weather?latitude=47.4&longitude=19.3&lang=20
Rationalize + Re-order
API Caching - Optimizations
©2016 AKAMAI | FASTER FORWARDTM
Monitoring and Testing SPA
©2016 AKAMAI | FASTER FORWARDTM
• The onload event no longer matters
• Soft navigations are not real navigations
• The browser won’t tell you when all resources have been downloaded
Monitoring the Wrong Metrics
* How to provide real user monitoring for single-page applications
©2016 AKAMAI | FASTER FORWARDTM
Misleading Metrics
Is that really
Load Time?
©2016 AKAMAI | FASTER FORWARDTM
Recommended SPA KPIs
Key Metrics
• Framework load time
• Interactive Time
• Load Complete time - first and
virtual pages
• Virtual Page Initial Request time
• API call timings
Trending Metrics
• Memory usage over time
• DOM size growth
• Javascript error rate
• Data Transfer rates (bytes fetched
per page/time)
©2016 AKAMAI | FASTER FORWARDTM
Monitoring and Testing Tools That Work
• User Timing API
• Mark and Measure in your code
• Soasta RUM
• Angular, Backbone, Ember
• Performance / Load Testing
• Webdriver Sampler with JMeter
©2016 AKAMAI | FASTER FORWARDTM
SPA Takeaways
• Before you build
• Does SPA make sense for you?
• Design SPA with performance in mind
• Agree on KPIs and SLAs early on
• As you build
• Evaluate Mobile performance
• Stay up to date
• HTTP/2 Server Push
• W3C Fetch Standard
©2016 AKAMAI | FASTER FORWARDTM
Q & A

Weitere ähnliche Inhalte

Was ist angesagt?

Single page application and Framework
Single page application and FrameworkSingle page application and Framework
Single page application and FrameworkChandrasekar G
 
Building a Single-Page App: Backbone, Node.js, and Beyond
Building a Single-Page App: Backbone, Node.js, and BeyondBuilding a Single-Page App: Backbone, Node.js, and Beyond
Building a Single-Page App: Backbone, Node.js, and BeyondSpike Brehm
 
Building single page applications
Building single page applicationsBuilding single page applications
Building single page applicationsSC5.io
 
Single page applications
Single page applicationsSingle page applications
Single page applicationsPrafful Garg
 
Server rendering-talk
Server rendering-talkServer rendering-talk
Server rendering-talkDaiwei Lu
 
Learning Single page Application chapter 1
Learning Single page Application chapter 1Learning Single page Application chapter 1
Learning Single page Application chapter 1Puguh Rismadi
 
Single Page Application presentation
Single Page Application presentationSingle Page Application presentation
Single Page Application presentationJohn Staveley
 
Iseltech17 - Single Page Applications
Iseltech17 - Single Page ApplicationsIseltech17 - Single Page Applications
Iseltech17 - Single Page ApplicationsMonica Rodrigues
 
Pros and Cons of developing a Thick Clientside App
Pros and Cons of developing a Thick Clientside AppPros and Cons of developing a Thick Clientside App
Pros and Cons of developing a Thick Clientside AppRavi Teja
 
ASP.NET MVC, AngularJS CRUD for Azerbaijan Technical University
ASP.NET MVC, AngularJS CRUD for Azerbaijan Technical UniversityASP.NET MVC, AngularJS CRUD for Azerbaijan Technical University
ASP.NET MVC, AngularJS CRUD for Azerbaijan Technical UniversitySyed Shanu
 
Real World Progressive Web Apps (Building Flipkart Lite)
Real World Progressive Web Apps (Building Flipkart Lite)Real World Progressive Web Apps (Building Flipkart Lite)
Real World Progressive Web Apps (Building Flipkart Lite)Abhinav Rastogi
 
Building great spa’s with angular js, asp.net mvc and webapi
Building great spa’s with angular js, asp.net mvc and webapiBuilding great spa’s with angular js, asp.net mvc and webapi
Building great spa’s with angular js, asp.net mvc and webapiMaurice De Beijer [MVP]
 
Modern Applications With Asp.net Core 5 and Vue JS 3
Modern Applications With Asp.net Core 5 and Vue JS 3Modern Applications With Asp.net Core 5 and Vue JS 3
Modern Applications With Asp.net Core 5 and Vue JS 3Alexandre Malavasi
 
Refactoring to a Single Page Application
Refactoring to a Single Page ApplicationRefactoring to a Single Page Application
Refactoring to a Single Page ApplicationCodemotion
 
A Simpler Web App Architecture (jDays 2016)
A Simpler Web App Architecture (jDays 2016)A Simpler Web App Architecture (jDays 2016)
A Simpler Web App Architecture (jDays 2016)Gustaf Nilsson Kotte
 
MEAN Stack
MEAN StackMEAN Stack
MEAN StackDotitude
 

Was ist angesagt? (20)

Single page application and Framework
Single page application and FrameworkSingle page application and Framework
Single page application and Framework
 
Building a Single-Page App: Backbone, Node.js, and Beyond
Building a Single-Page App: Backbone, Node.js, and BeyondBuilding a Single-Page App: Backbone, Node.js, and Beyond
Building a Single-Page App: Backbone, Node.js, and Beyond
 
Building single page applications
Building single page applicationsBuilding single page applications
Building single page applications
 
Single Page Application
Single Page ApplicationSingle Page Application
Single Page Application
 
Single page applications
Single page applicationsSingle page applications
Single page applications
 
Server rendering-talk
Server rendering-talkServer rendering-talk
Server rendering-talk
 
Learning Single page Application chapter 1
Learning Single page Application chapter 1Learning Single page Application chapter 1
Learning Single page Application chapter 1
 
Single Page Application presentation
Single Page Application presentationSingle Page Application presentation
Single Page Application presentation
 
Iseltech17 - Single Page Applications
Iseltech17 - Single Page ApplicationsIseltech17 - Single Page Applications
Iseltech17 - Single Page Applications
 
Pros and Cons of developing a Thick Clientside App
Pros and Cons of developing a Thick Clientside AppPros and Cons of developing a Thick Clientside App
Pros and Cons of developing a Thick Clientside App
 
Single page applications
Single page applicationsSingle page applications
Single page applications
 
ASP.NET MVC, AngularJS CRUD for Azerbaijan Technical University
ASP.NET MVC, AngularJS CRUD for Azerbaijan Technical UniversityASP.NET MVC, AngularJS CRUD for Azerbaijan Technical University
ASP.NET MVC, AngularJS CRUD for Azerbaijan Technical University
 
Real World Progressive Web Apps (Building Flipkart Lite)
Real World Progressive Web Apps (Building Flipkart Lite)Real World Progressive Web Apps (Building Flipkart Lite)
Real World Progressive Web Apps (Building Flipkart Lite)
 
Building great spa’s with angular js, asp.net mvc and webapi
Building great spa’s with angular js, asp.net mvc and webapiBuilding great spa’s with angular js, asp.net mvc and webapi
Building great spa’s with angular js, asp.net mvc and webapi
 
Single page App
Single page AppSingle page App
Single page App
 
MEAN Stack
MEAN Stack MEAN Stack
MEAN Stack
 
Modern Applications With Asp.net Core 5 and Vue JS 3
Modern Applications With Asp.net Core 5 and Vue JS 3Modern Applications With Asp.net Core 5 and Vue JS 3
Modern Applications With Asp.net Core 5 and Vue JS 3
 
Refactoring to a Single Page Application
Refactoring to a Single Page ApplicationRefactoring to a Single Page Application
Refactoring to a Single Page Application
 
A Simpler Web App Architecture (jDays 2016)
A Simpler Web App Architecture (jDays 2016)A Simpler Web App Architecture (jDays 2016)
A Simpler Web App Architecture (jDays 2016)
 
MEAN Stack
MEAN StackMEAN Stack
MEAN Stack
 

Andere mochten auch

Build single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMBuild single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMAdobeMarketingCloud
 
Getting Single Page Application Security Right
Getting Single Page Application Security RightGetting Single Page Application Security Right
Getting Single Page Application Security RightPhilippe De Ryck
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2Knoldus Inc.
 
AngularJS Security: defend your Single Page Application
AngularJS Security: defend your Single Page Application AngularJS Security: defend your Single Page Application
AngularJS Security: defend your Single Page Application Carlo Bonamico
 
Single-Page-Application & REST security
Single-Page-Application & REST securitySingle-Page-Application & REST security
Single-Page-Application & REST securityIgor Bossenko
 

Andere mochten auch (6)

Build single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMBuild single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEM
 
Nosql ve mongoDB
Nosql ve mongoDBNosql ve mongoDB
Nosql ve mongoDB
 
Getting Single Page Application Security Right
Getting Single Page Application Security RightGetting Single Page Application Security Right
Getting Single Page Application Security Right
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
 
AngularJS Security: defend your Single Page Application
AngularJS Security: defend your Single Page Application AngularJS Security: defend your Single Page Application
AngularJS Security: defend your Single Page Application
 
Single-Page-Application & REST security
Single-Page-Application & REST securitySingle-Page-Application & REST security
Single-Page-Application & REST security
 

Ähnlich wie Making Single Page Applications (SPA) faster

Isomorphic React Applications: Performance And Scalability
Isomorphic React Applications: Performance And ScalabilityIsomorphic React Applications: Performance And Scalability
Isomorphic React Applications: Performance And ScalabilityDenis Izmaylov
 
Measuring what matters
Measuring what mattersMeasuring what matters
Measuring what mattersCliff Crocker
 
Edge 2016 measuring what matters
Edge 2016 measuring what mattersEdge 2016 measuring what matters
Edge 2016 measuring what mattersakamaidevrel
 
Boston Web Performance Meetup: The Render Chain and You
Boston Web Performance Meetup: The Render Chain and YouBoston Web Performance Meetup: The Render Chain and You
Boston Web Performance Meetup: The Render Chain and Youmattringel
 
Akamai company profile
Akamai company profileAkamai company profile
Akamai company profilerahulp9999
 
Performance and Scalability Art of Isomorphic React Applications
Performance and Scalability Art of Isomorphic React ApplicationsPerformance and Scalability Art of Isomorphic React Applications
Performance and Scalability Art of Isomorphic React ApplicationsDenis Izmaylov
 
Step by Step Mobile Optimization
Step by Step Mobile OptimizationStep by Step Mobile Optimization
Step by Step Mobile OptimizationGuy Podjarny
 
Rise and Fall of the Frontend Developer
Rise and Fall of the Frontend DeveloperRise and Fall of the Frontend Developer
Rise and Fall of the Frontend DeveloperRafael Casuso Romate
 
[Webinar] Expanding future mobile commerce with Magento PWA Studio
[Webinar] Expanding future mobile commerce with Magento PWA Studio[Webinar] Expanding future mobile commerce with Magento PWA Studio
[Webinar] Expanding future mobile commerce with Magento PWA StudioCedCommerce
 
Cloudflare Speed Week Recap
Cloudflare Speed Week RecapCloudflare Speed Week Recap
Cloudflare Speed Week RecapCloudflare
 
Where does Laravel fit in the Jamstack concept?
Where does Laravel fit in the Jamstack concept?Where does Laravel fit in the Jamstack concept?
Where does Laravel fit in the Jamstack concept?Tihomir Opačić
 
UI5 with Akamai - Introduction to the Content Delivery Network
UI5 with Akamai - Introduction to the Content Delivery NetworkUI5 with Akamai - Introduction to the Content Delivery Network
UI5 with Akamai - Introduction to the Content Delivery NetworkGokul Anand E, PMP®
 
20 tips for website performance
20 tips for website performance20 tips for website performance
20 tips for website performanceAndrew Siemer
 
WebDev Simplified React.js.pptx
WebDev Simplified React.js.pptxWebDev Simplified React.js.pptx
WebDev Simplified React.js.pptxSarikaPurohit1
 
Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!Jeremy Likness
 

Ähnlich wie Making Single Page Applications (SPA) faster (20)

Isomorphic React Applications: Performance And Scalability
Isomorphic React Applications: Performance And ScalabilityIsomorphic React Applications: Performance And Scalability
Isomorphic React Applications: Performance And Scalability
 
Measuring what matters
Measuring what mattersMeasuring what matters
Measuring what matters
 
Edge 2016 measuring what matters
Edge 2016 measuring what mattersEdge 2016 measuring what matters
Edge 2016 measuring what matters
 
Boston Web Performance Meetup: The Render Chain and You
Boston Web Performance Meetup: The Render Chain and YouBoston Web Performance Meetup: The Render Chain and You
Boston Web Performance Meetup: The Render Chain and You
 
Akamai company profile
Akamai company profileAkamai company profile
Akamai company profile
 
Performance and Scalability Art of Isomorphic React Applications
Performance and Scalability Art of Isomorphic React ApplicationsPerformance and Scalability Art of Isomorphic React Applications
Performance and Scalability Art of Isomorphic React Applications
 
Step by Step Mobile Optimization
Step by Step Mobile OptimizationStep by Step Mobile Optimization
Step by Step Mobile Optimization
 
Optimizing your API to Perform at Scale
Optimizing your API to Perform at ScaleOptimizing your API to Perform at Scale
Optimizing your API to Perform at Scale
 
Rise and Fall of the Frontend Developer
Rise and Fall of the Frontend DeveloperRise and Fall of the Frontend Developer
Rise and Fall of the Frontend Developer
 
[Webinar] Expanding future mobile commerce with Magento PWA Studio
[Webinar] Expanding future mobile commerce with Magento PWA Studio[Webinar] Expanding future mobile commerce with Magento PWA Studio
[Webinar] Expanding future mobile commerce with Magento PWA Studio
 
Cloudflare Speed Week Recap
Cloudflare Speed Week RecapCloudflare Speed Week Recap
Cloudflare Speed Week Recap
 
Eureko frameworks
Eureko frameworksEureko frameworks
Eureko frameworks
 
Where does Laravel fit in the Jamstack concept?
Where does Laravel fit in the Jamstack concept?Where does Laravel fit in the Jamstack concept?
Where does Laravel fit in the Jamstack concept?
 
Web Performance Optimization (WPO)
Web Performance Optimization (WPO)Web Performance Optimization (WPO)
Web Performance Optimization (WPO)
 
UI5 with Akamai - Introduction to the Content Delivery Network
UI5 with Akamai - Introduction to the Content Delivery NetworkUI5 with Akamai - Introduction to the Content Delivery Network
UI5 with Akamai - Introduction to the Content Delivery Network
 
20 tips for website performance
20 tips for website performance20 tips for website performance
20 tips for website performance
 
WebDev Simplified React.js.pptx
WebDev Simplified React.js.pptxWebDev Simplified React.js.pptx
WebDev Simplified React.js.pptx
 
Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!
 
Refactoring to a SPA
Refactoring to a SPARefactoring to a SPA
Refactoring to a SPA
 
Ajax
AjaxAjax
Ajax
 

Kürzlich hochgeladen

WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...masabamasaba
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburgmasabamasaba
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxAnnaArtyushina1
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is insideshinachiaurasa2
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...masabamasaba
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 

Kürzlich hochgeladen (20)

WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 

Making Single Page Applications (SPA) faster

  • 1. Making Single Page Apps Faster Manuel Alvarez Enterprise Architect @MD_A13 Boris Livshutz Senior Enterprise Architect @livshitz98
  • 2. ©2016 AKAMAI | FASTER FORWARDTM • New way to build on the web • Growing popularity • Single HTML page • Navigation using JavaScript, APIs • Causes performance degradation • We are here to help! • Choosing the right framework for Performance • Make your SPA perform faster • Monitor SPA’s performance Builtwith Data Why are we talking about SPA today?
  • 3. ©2016 AKAMAI | FASTER FORWARDTM Choosing the Right Framework
  • 4. ©2016 AKAMAI | FASTER FORWARDTM SPA and the MVC Architecture Years of architecture evolution: • SOFEA: Service-Oriented Front-End Architecture (2007) • JavaScript, flash, and AJAX • MV-X architectures are designed to separate the view from the model • Server-side developer focus on business logic • The client is developed separately, allowing code reuse for SPA, native apps, SOA, etc. Model View Controller View Model Controller Fires Event (Updates) Passes Calls to Modifies Image from Rohit Ghatol
  • 5. ©2016 AKAMAI | FASTER FORWARDTM Current SPA trends Metric AngularJS Angular 2 Backbone.js Ember.js React.js Stars on Github 48k 10k 24k 16k 39k Commits 7k 4k 3k 18k 6k StackOverflow Questions 174k 11k 19k 19k 18k GitHub Contributors 1,426 219 282 569 645 Compresses sizes if you are curious
  • 6. ©2016 AKAMAI | FASTER FORWARDTM • Easy to start, great community support, and does not have dependencies • Not very good partnering with 3rd party JavaScripts • Great for “ambitious” web apps • It has dependencies on handlebars and jQuery • Handlebars uses <script> tags as markers, increasing DOM complexity • It uses the Virtual DOM to minimize real DOM changes • React is only the view layer • It has a minimalistic approach and it has good compatibility with other JS libraries • Dependencies on Underscore.js and jQuery Current SPA trends
  • 7. ©2016 AKAMAI | FASTER FORWARDTM What is the right framework? Stefan Krause
  • 8. ©2016 AKAMAI | FASTER FORWARDTM Angular 1 Angular 2 Ember.js React.js Create 1k rows (ms) 249.56 192.38 747.01 201.17 Append 1k rows (ms) 826.88 679.67 729.01 344.25 Clear 10k rows (ms) 840.63 436.54 1,182.97 2,027.88 Memory (on load) MB 4.86 17.05 10.1 5.17 Benchmarks Stefan Krause Chris Harrington How are you using tables if at all? What are your top browsers?
  • 9. ©2016 AKAMAI | FASTER FORWARDTM • Research them and read a little code • Evaluate their capabilities; e.g. testing tools • Implement them • Play around http://todomvc.com/ • “Hello world” + common tasks in your top browser • Can you start from an existing project? • What you are doing is so unique that it is probably on github  • Use a decision matrix What is the right framework?
  • 10. ©2016 AKAMAI | FASTER FORWARDTM AngularJS Ember React Learn 10 6 8 Develop 9 8 9 Test 8 9 8 Secure 7 8 4 Build 9 10 9 Deploy 10 10 10 Debug 7 10 7 Scale 9 7 10 Maintain 3 5 4 Share 10 10 10 82 83 79 Filler by Matt Raible - http://akamai.me/1pRfU1g Evaluate Frameworks Yevgeniy Brikman’s Framework Scorecard
  • 11. ©2016 AKAMAI | FASTER FORWARDTM Obstacles to Good Performance
  • 12. ©2016 AKAMAI | FASTER FORWARDTM Does SPA Make Your Site Faster? • Yes, for 2nd and subsequent pages (soft / virtual pages) • No, for 1st page (homepage, landing page, deep link) • 1st page ruins experience (“judge a book by its cover!”) • Leads to user abandonment • Frameworks try to do everything for everybody, causing “framework overhead”
  • 13. ©2016 AKAMAI | FASTER FORWARDTM Framework Overhead - Example Automatic Initialization in Angular 1. DOMContentLoaded event triggers Initialization 2. Loads the module associated with the directive 3. Creates the Application Injector 4. Compiles the DOM with ng-app as root 5. Framework loads all dynamic content
  • 14. ©2016 AKAMAI | FASTER FORWARDTM Performance Dive – Waterfall Analysis
  • 15. ©2016 AKAMAI | FASTER FORWARDTM Constant Reinstall • Bootstrap process is equivalent to installation • Visiting the page again (each new browser context) results on “reinstalling” • Deep links (search engines landing page) require bootstrap first and then repaint the linked page (hard + soft navigation in one!)
  • 16. ©2016 AKAMAI | FASTER FORWARDTM Mobile Magnifies the Problem • Cellular network – high latency on API calls • Limited memory - large framework • Weak CPU – heavy JavaScript processing CPU = 800MHz dual-c Memory = 512MB SunSpider = ~1880ms CPU = 2.6GHz quad-c Memory = 16GB SunSpider = ~145ms Table from Ilya Grigorik
  • 17. ©2016 AKAMAI | FASTER FORWARDTM SPA Performance Solutions
  • 18. ©2016 AKAMAI | FASTER FORWARDTM Light First Visit • First visit does not have the framework in cache • Serve a “skeleton” that looks like the real page but with a reduced version of the framework • Execute the full framework later • On the second page • When user clicks • Async execution • Pre-render
  • 19. ©2016 AKAMAI | FASTER FORWARDTM Server Side Rendering • Isomorphic App - both Server and client rendering • Step 1: Server renders page into HTML • Step 2: Client Side rendering but no impact to perceived timing • Framework Support • React - Native support • AngularJS - Version 2.0 has native support • Backbone.js - Render library • Ember.js - FastBoot feature
  • 20. ©2016 AKAMAI | FASTER FORWARDTM Server Side Rendering: Angular Step by step process in Angular 1. Process the JS on the Server Side 2. Result served to the client as the page HTML 3. Browser renders HTML as standard web page 4. Preboot starts to listen for user clicks since html is not interactive 5. Angular performs all client side bootstrapping in the background 6. As client side bootstrapping is done, it will redraw using new DOM 7. Preboot will now replay all user clicks captured previously.
  • 21. ©2016 AKAMAI | FASTER FORWARDTM Server Side Rendering: React Step by step process in React 1. Process the JS on the Server Side 2. Result served to the client as the page HTML 3. Browser renders HTML as standard web page 4. React performs all client side bootstrapping without affecting html page 5. Result is identical to what is already displayed on the page 6. React smartly identifies that no render change is needed 1. DOM is not touched (usually most expensive step) 2. Event Handler hooks are added to the current page
  • 22. ©2016 AKAMAI | FASTER FORWARDTM Virtual DOM Library • Direct DOM manipulation causes constant rerender and reflow • Use Virtual DOM to avoid reflow and rerender • React.js - builtin virtual DOM along with rendering engine • 3rd party Virtual DOM libraries - Mercury, Elm, many more
  • 23. ©2016 AKAMAI | FASTER FORWARDTM JavaScript Packaging • Choose a Package Manager • Fits DevOps build process • Compromise: network roundtrips vs caching • Trial and Error to find compromise
  • 24. ©2016 AKAMAI | FASTER FORWARDTM Resource Deferment • Defer and accelerate loading Javascript • AMD - Asynchronous Module Definition API • WebPack - Code splitting • RequireJS - dynamic and async module loader • Defer images to future pages • Use Minimized Libraries
  • 25. ©2016 AKAMAI | FASTER FORWARDTM • Cache more! at browser and Edge • Cache JSON responses • Use advance caching features • Normalize URL parameters • Enforce uniform ordering of URL parameters /weather?lang=20&latitude=47.43&longitude=19.30 /weather?longitude=19.30&latitude=47.43&lang=20 /weather?zipcode=98122&lang=20 /weather?latitude=47.4&longitude=19.3&lang=20 Rationalize + Re-order API Caching - Optimizations
  • 26. ©2016 AKAMAI | FASTER FORWARDTM Monitoring and Testing SPA
  • 27. ©2016 AKAMAI | FASTER FORWARDTM • The onload event no longer matters • Soft navigations are not real navigations • The browser won’t tell you when all resources have been downloaded Monitoring the Wrong Metrics * How to provide real user monitoring for single-page applications
  • 28. ©2016 AKAMAI | FASTER FORWARDTM Misleading Metrics Is that really Load Time?
  • 29. ©2016 AKAMAI | FASTER FORWARDTM Recommended SPA KPIs Key Metrics • Framework load time • Interactive Time • Load Complete time - first and virtual pages • Virtual Page Initial Request time • API call timings Trending Metrics • Memory usage over time • DOM size growth • Javascript error rate • Data Transfer rates (bytes fetched per page/time)
  • 30. ©2016 AKAMAI | FASTER FORWARDTM Monitoring and Testing Tools That Work • User Timing API • Mark and Measure in your code • Soasta RUM • Angular, Backbone, Ember • Performance / Load Testing • Webdriver Sampler with JMeter
  • 31. ©2016 AKAMAI | FASTER FORWARDTM SPA Takeaways • Before you build • Does SPA make sense for you? • Design SPA with performance in mind • Agree on KPIs and SLAs early on • As you build • Evaluate Mobile performance • Stay up to date • HTTP/2 Server Push • W3C Fetch Standard
  • 32. ©2016 AKAMAI | FASTER FORWARDTM Q & A