SlideShare a Scribd company logo
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
Ad

More Related Content

What's hot (20)

Single page application and Framework
Single page application and FrameworkSingle page application and Framework
Single page application and Framework
Chandrasekar 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 Beyond
Spike Brehm
 
Building single page applications
Building single page applicationsBuilding single page applications
Building single page applications
SC5.io
 
Single Page Application
Single Page ApplicationSingle Page Application
Single Page Application
Isuru Madusanka
 
Single page applications
Single page applicationsSingle page applications
Single page applications
Prafful Garg
 
Server rendering-talk
Server rendering-talkServer rendering-talk
Server rendering-talk
Daiwei Lu
 
Learning Single page Application chapter 1
Learning Single page Application chapter 1Learning Single page Application chapter 1
Learning Single page Application chapter 1
Puguh Rismadi
 
Single Page Application presentation
Single Page Application presentationSingle Page Application presentation
Single Page Application presentation
John Staveley
 
Iseltech17 - Single Page Applications
Iseltech17 - Single Page ApplicationsIseltech17 - Single Page Applications
Iseltech17 - Single Page Applications
Monica 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 App
Ravi Teja
 
Single page applications
Single page applicationsSingle page applications
Single page applications
Rumesh Hapuarachchi
 
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
Syed 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 webapi
Maurice De Beijer [MVP]
 
Single page App
Single page AppSingle page App
Single page App
Gaurav Gawande
 
MEAN Stack
MEAN Stack MEAN Stack
MEAN Stack
RoshanTak1
 
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
Alexandre Malavasi
 
Refactoring to a Single Page Application
Refactoring to a Single Page ApplicationRefactoring to a Single Page Application
Refactoring to a Single Page Application
Codemotion
 
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 Stack
Dotitude
 
Single page application and Framework
Single page application and FrameworkSingle page application and Framework
Single page application and Framework
Chandrasekar 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 Beyond
Spike Brehm
 
Building single page applications
Building single page applicationsBuilding single page applications
Building single page applications
SC5.io
 
Single page applications
Single page applicationsSingle page applications
Single page applications
Prafful Garg
 
Server rendering-talk
Server rendering-talkServer rendering-talk
Server rendering-talk
Daiwei Lu
 
Learning Single page Application chapter 1
Learning Single page Application chapter 1Learning Single page Application chapter 1
Learning Single page Application chapter 1
Puguh Rismadi
 
Single Page Application presentation
Single Page Application presentationSingle Page Application presentation
Single Page Application presentation
John Staveley
 
Iseltech17 - Single Page Applications
Iseltech17 - Single Page ApplicationsIseltech17 - Single Page Applications
Iseltech17 - Single Page Applications
Monica 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 App
Ravi 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 University
Syed 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 webapi
Maurice 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 3
Alexandre Malavasi
 
Refactoring to a Single Page Application
Refactoring to a Single Page ApplicationRefactoring to a Single Page Application
Refactoring to a Single Page Application
Codemotion
 
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 Stack
Dotitude
 

Viewers also liked (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
AdobeMarketingCloud
 
Nosql ve mongoDB
Nosql ve mongoDBNosql ve mongoDB
Nosql ve mongoDB
Saygın Topatan
 
Getting Single Page Application Security Right
Getting Single Page Application Security RightGetting Single Page Application Security Right
Getting Single Page Application Security Right
Philippe De Ryck
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
Knoldus 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 security
Igor Bossenko
 
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
AdobeMarketingCloud
 
Getting Single Page Application Security Right
Getting Single Page Application Security RightGetting Single Page Application Security Right
Getting Single Page Application Security Right
Philippe De Ryck
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
Knoldus 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 security
Igor Bossenko
 
Ad

Similar to 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
Denis Izmaylov
 
Edge 2016 measuring what matters
Edge 2016 measuring what mattersEdge 2016 measuring what matters
Edge 2016 measuring what matters
akamaidevrel
 
Measuring what matters
Measuring what mattersMeasuring what matters
Measuring what matters
Cliff Crocker
 
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
mattringel
 
Akamai company profile
Akamai company profileAkamai company profile
Akamai company profile
rahulp9999
 
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
Denis Izmaylov
 
Step by Step Mobile Optimization
Step by Step Mobile OptimizationStep by Step Mobile Optimization
Step by Step Mobile Optimization
Guy Podjarny
 
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
Akamai Developers & Admins
 
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
Rafael 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 Studio
CedCommerce
 
Cloudflare Speed Week Recap
Cloudflare Speed Week RecapCloudflare Speed Week Recap
Cloudflare Speed Week Recap
Cloudflare
 
Eureko frameworks
Eureko frameworksEureko frameworks
Eureko frameworks
Görkem Sazara
 
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ć
 
Web Performance Optimization (WPO)
Web Performance Optimization (WPO)Web Performance Optimization (WPO)
Web Performance Optimization (WPO)
Betclic Everest Group Tech Team
 
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
Gokul Anand E, PMP®
 
20 tips for website performance
20 tips for website performance20 tips for website performance
20 tips for website performance
Andrew Siemer
 
WebDev Simplified React.js.pptx
WebDev Simplified React.js.pptxWebDev Simplified React.js.pptx
WebDev Simplified React.js.pptx
SarikaPurohit1
 
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
 
Refactoring to a SPA
Refactoring to a SPARefactoring to a SPA
Refactoring to a SPA
Marcello Teodori
 
Ajax
AjaxAjax
Ajax
baabtra.com - No. 1 supplier of quality freshers
 
Isomorphic React Applications: Performance And Scalability
Isomorphic React Applications: Performance And ScalabilityIsomorphic React Applications: Performance And Scalability
Isomorphic React Applications: Performance And Scalability
Denis Izmaylov
 
Edge 2016 measuring what matters
Edge 2016 measuring what mattersEdge 2016 measuring what matters
Edge 2016 measuring what matters
akamaidevrel
 
Measuring what matters
Measuring what mattersMeasuring what matters
Measuring what matters
Cliff Crocker
 
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
mattringel
 
Akamai company profile
Akamai company profileAkamai company profile
Akamai company profile
rahulp9999
 
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
Denis Izmaylov
 
Step by Step Mobile Optimization
Step by Step Mobile OptimizationStep by Step Mobile Optimization
Step by Step Mobile Optimization
Guy 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 Developer
Rafael 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 Studio
CedCommerce
 
Cloudflare Speed Week Recap
Cloudflare Speed Week RecapCloudflare Speed Week Recap
Cloudflare Speed Week Recap
Cloudflare
 
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 Network
Gokul Anand E, PMP®
 
20 tips for website performance
20 tips for website performance20 tips for website performance
20 tips for website performance
Andrew Siemer
 
WebDev Simplified React.js.pptx
WebDev Simplified React.js.pptxWebDev Simplified React.js.pptx
WebDev Simplified React.js.pptx
SarikaPurohit1
 
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
 
Ad

Recently uploaded (20)

Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
The Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdfThe Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdf
drewplanas10
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
FL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full VersionFL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full Version
tahirabibi60507
 
Download YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full ActivatedDownload YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full Activated
saniamalik72555
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
AxisTechnolabs
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
Expand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchangeExpand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchange
Fexle Services Pvt. Ltd.
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New VersionPixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
saimabibi60507
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Dele Amefo
 
Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
The Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdfThe Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdf
drewplanas10
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
FL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full VersionFL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full Version
tahirabibi60507
 
Download YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full ActivatedDownload YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full Activated
saniamalik72555
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
AxisTechnolabs
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
Expand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchangeExpand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchange
Fexle Services Pvt. Ltd.
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New VersionPixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
saimabibi60507
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Dele Amefo
 
Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 

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