SlideShare a Scribd company logo
Isomorphic
React Applications:
Performance & Scalability
Denis Izmaylov
Nov 23, 2015
Denis Izmaylov
• 15 years of Software and Web
development experience
• The last 5 years focused exclusively on
Front-end, Node.js and architecture
• Created 10+ projects, including Single
Page Applications, high-load and React
• Commiter to Redux, webpack and koa
• Speaker at HighLoad++ 2015, MoscowJS
• The author of “Application and Universal
Components” and other articles
, CEO
Why should we stop
developing classic
Single Page Applications?
How isomorphic applications
affect your salary?
What will you do
at this weekend?
You already know
1. React 14
2. webpack
3. ES6
4. Node.js
5. Express / koa
6. Isomorphic (Universal) apps
6
Part 1
Web became a giant
Art

Web Development



Science
Before it was easy
• Create a page
• Add some scripts
• Submit to Production
Before it was easy
Server
Browser
11
Before it was easy
Server
Browser
Does everything
12
Before it was easy
Server
Browser
- HTML
- [CSS, JavaScript]
Does everything
13
It worked
Single Page

Applications

(SPA)
Single Page Application
Server
Browser
16
Single Page Application
Server
Browser
Is the page exists?

Do we need auth?

Do we have access?
17
Single Page Application
Server
Browser
Is the page exists?

Do we need auth?

Do we have access?
- Tiny HTML, [CSS]
- JavaScript bundle
18
Single Page Application
Benefits
• Easy to start
• webpack
• <div id=“root” />
• React, Redux
• build
19
Single Page Application
Benefits
• Easy to start
• Rich features
webpack, <div id=“root” />, React, Redux
20
Single Page Application
Benefits
• Easy to start
• Rich features
• Fast enhancement
webpack, <div id=“root” />, React, Redux
21
Single Page Application
Benefits
• Easy to start
• Rich features
• Fast enhancement
• Responsive UI
webpack, <div id=“root” />, React, Redux
22
Single Page Application
Benefits
• Easy to start
• Rich features
• Fast enhancement
• Responsive UI
• Useful caching
webpack, <div id=“root” />, React, Redux
23
- Wow. Is it so ideal?
Single Page Application
Flaws
• Long-time Start
• JavaScript bundle up to 3-5 Mb
• first request
• execution
• memory
25
Single Page Application
Flaws
• Long-time Start
• Expensive maintenance
• side effects
• memory leak
1st request, CPU, mem
26
Single Page Application
Flaws
• Long-time Start
• Expensive maintenance
• Empty page, one URL
1st request, CPU, mem
side effects, memory leaks
27
Single Page Application
Flaws
• Long-time Start
• Expensive maintenance
• Empty page, one URL
• Legacy Browsers
1st request, CPU, mem
side effects, memory leaks
28
- Why is it “flaws”?
Single Page Application
Flaws
• Long-Time Start
for business
reduced UX
30
Single Page Application
Flaws
• Long-Time Start
• Expensive Maintenance
for business
reduced UX
risks
31
Single Page Application
Flaws
• Long-Time Start
• Expensive Maintenance
• Empty Page
for business
reduced UX
risks
SEO problems
32
Single Page Application
Flaws
• Long-Time Start
• Expensive Maintenance
• Empty Page
• One URL
for business
reduced UX
risks
SEO problems
SMM problems
33
Single Page Application
Flaws
• Long-Time Start
• Expensive Maintenance
• Empty Page
• One URL
• Legacy Browsers
for business
reduced UX
risks
SEO problems
SMM problems
lost audience
34
Single Page Application
Flaws
• Long-Time Start
• Expensive Maintenance
• Empty Page
• One URL
• Legacy Browsers
for business
reduced UX
risks
SEO problems
SMM problems
lost audience
35
Expenses
Single Page Application
Flaws
for business
reduced UX
risks
SEO problems
SMM problems
lost audience
36
Expenses
- What to do?
Take the best
from the both worlds
Isomorphic
Applications
Isomorphic Applications
By isomorphic we mean that any
given line of code (with notable
exceptions) can execute both on
the client and the server.


Charlie Robbins,

18 Oct 2011
Templates
Stylesheets
Locale (i18n)
Configuration
Routes
Access Rules
Models
Schemas
Validation
Services
Isomorphic Applications
server.jsNode.js
worker.js
client.jsBrowser
admin.js
Business Logic
Components
API interfaces
Actions, Reducers
Static Files
Browser
Isomorphic Applications
Front-end
Server
Back-end
Server



Database
Java

etc
Browser
Isomorphic Applications
Front-end
Server
Back-end
Server



Database
Java

etc
Browser
Isomorphic Applications
Front-end
Server
Back-end
Server



Database
Java

etc
- HTML
- [critical CSS]
- …
Front-end
Client
Isomorphic Applications
Front-end
Server
Back-end
Server



Database
Java

etc
- HTML
- [critical CSS]
- JS Bundle
Front-end
Client
Isomorphic Applications
Front-end
Server
Back-end
Server



Database
Java

etc
- HTML
- [critical CSS]
- JS Bundle
Front-end
Client
Isomorphic Applications
Front-end
Server
• One execution
environment

• Shared codebase

• Full control

• Ecosystem
47
- How can we
do that?
Server-Side Rendering

(SSR)
Server-Side Rendering
• Build HTML on Front-end Server
• Render page in user browser
immediately, before it loads JavaScript
• When JavaScript will be loaded,

React will add event handlers only
• It’s very fast
50
Server-Side Rendering
Example code for Server-Side:
import ReactDOMServer from 'react-dom/server';

import Application from './components/application';



const body = ReactDOMServer.renderToString(

<Application />

);
51
Server-Side Rendering
1. Visitors see a page immediately
2. No additional requests to load data
3. The page could work even without JS
4. Full URL-navigation
5. Meta-tags for SEO and SMM
6. This way keeps all JavaScript features
52
Part 2
Performance
And Scalability
Scalability
Functional
Scalability
Server-Side Rendering
That’s super when we have all data for response:
import ReactDOMServer from 'react-dom/server';

import Application from './components/application';



const initialState = { siteName: 'Startup Makers' };

const body = ReactDOMServer.renderToString(

<Application state={initialState} />

);
57
Server-Side Rendering
That’s super when we have all data for response:
import ReactDOMServer from 'react-dom/server';

import Application from './components/application';



const initialState = { siteName: 'Startup Makers' };

const body = ReactDOMServer.renderToString(

<Application state={initialState} />

);
What if we have to
load it async?
58
Server-Side Rendering
How to get asynchronous State:

1. Manual for each page
2. Facebook Relay
3. redux-catch-promise
59
Asynchronous State
Manual for each page:
• Define which data we have to load for
each page
• Load this data and prepare State
• ReactDOMServer.renderToString()
60
Asynchronous State
Facebook Relay:
1. The framework for building data-driven
React applications
2. Declarative. Colocation. Mutations.
3. https://github.com/facebook/relay/
issues/136
4. 1Q2016
61
Asynchronous State
redux-catch-promise:
• Redux - state container для React
• Redux: the best for isomorphic apps,
MoscowJS 25

https://youtu.be/Uyk_8WWna6s
• redux-catch-promise is middleware for
Redux
62
Asynchronous State
redux-catch-promise:
1. Attach a callback to catch Promise-actions
2. Render the component
3. At the component - create a request to DB (or
other data source) and dispatch a Promise of
that
4. Collect all promises and wait until they will be
finished
5. Render component with data 63
Asynchronous State
redux-catch-promise:
1. Example and source code:

https://github.com/DenisIzmaylov/
redux-catch-promise
2. Installation:
npm install redux-catch-promise
64
Performance
Performance
Test stand:
MacBook Pro 15” Retina (Early 2013)
2.4 GHz Intel Core i7
66
Performance
Page size: 56 238 bytes
Performance
Page size: 56 238 bytes
Performance
Page size: 56 238 bytes
Performance
Page size: 56 238 bytes
Performance
Page size: 56 238 bytes
Performance
Page size: 56 238 bytes
Performance
Test with:
ab -n 100 http://localhost:3000/profile

73
Performance
Test with:
ab -n 100 http://localhost:3000/profile
Executing…
74
Performance
Test with:
ab -n 100 http://localhost:3000/profile
Executing…
Time per request: 61.850 ms
75
Performance
61.850 ms

Is it slow or fast?
76
Performance
61.850 ms

Is it slow or fast?



The same template in Handlebars:

8.385 ms



86% less
77
Performance
61.850 ms

Is it slow or fast?



The same template in Handlebars:

8.385 ms



86% less
78
Performance
1. Try to search in Google - nothing
2. Try to ask in Twitter - silence:
79
Performance
Ok, what if we do that?
NODE_ENV=production
Executing…
80
Performance
Ok, what if we do that?
NODE_ENV=production
Executing…
Time per request: 37.943 ms

(vs 61.850 ms)

39% less
81
Performance
Looks better.



But it’s still not funny.
82
Go ahead
GitHub issues
Performance
• “Server rendering is slower with npm react”



https://github.com/facebook/react/issues/812



85
Performance
• “Server rendering is slower with npm react”



https://github.com/facebook/react/issues/812



Solution:

use directly react/dist/react.min.js
86
Performance
Create node_modules/react.js:



if (process.env.NODE_ENV === 'production') {
module.exports = require('react/dist/react.min.js');
} else {
module.exports = require('react/dist/react.js');
}

87
Performance
Create node_modules/react.js:



if (process.env.NODE_ENV === 'production') {
module.exports = require('react/dist/react.min.js');
} else {
module.exports = require('react/dist/react.js');
}

88
How can it influence

on results?
Performance
Server rendering is slower with npm react
react/dist/react.min.js
Executing…
90
Performance
Server rendering is slower with npm react
react/dist/react.min.js
Executing…
Time per request: 38.253 ms

(vs 37.943 ms)

0.08% more
91
Performance
Server rendering is slower with npm react
react/dist/react.min.js
Executing…
Time per request: 38.253 ms

(vs 37.943 ms)

0.08% more
FAILED
92
0
17,5
35
52,5
70
38,25337,943
8,385
61,85
React SSR Handlebars production react.min.js
Results
0
17,5
35
52,5
70
38,25337,943
8,385
61,85
React SSR Handlebars production react.min.js
Results
NODE_ENV=production

39% less
Part 3
Advanced

Solutions
Advanced Solutions
1. Precompilation + Cache
2. Rendering Separation
3. Progressive Rendering
4. Facebook BigPipe
5. HAProxy
97
Precompilation + Cache
• UI = f(state)
• f = React Component
• state = path + [actions] + …

1. Simple solution: redis
2. Deferred server-side rendering:

redis + kue.js + workers 98
Rendering Separation
99
Progressive Rendering
100
Progressive Rendering
• React DOM Stream
• Flushing the Document Early
• “Streams make this library as much as 47% faster
in sending down a full page than
ReactDOM.renderToString”
• Target - 108KB page on Heroku
• Time To First Byte (TTFB) - 55% faster
• https://github.com/aickin/react-dom-stream
101
Facebook BigPipe
• Bundle a page during it’s loading
• Assets is loading parallel
• Resistants to errors
Facebook BigPipe
• Bundle a page during it’s loading
• Assets is loading parallel
• Resistants to errors
Facebook BigPipe
• Bundle a page during it’s loading
• Assets is loading parallel
• Resistants to errors
Facebook BigPipe
105
HAProxy
• Multiple Node.js instance
• Ask your DevOps engineer
106
Epilogue
Recommendations
• Find and join local JavaScript
communities
• Improve your English skills
• Read original articles and technical
blogs (Facebook, AirBnB, Netflix, etc)
• Join and integrate Twitter and
GitHub to your life 108
Useful Links
1. Supercharging page load (100 Days of Google Dev)

https://youtu.be/d5_6yHixpsQ
2. Making Netflix.com Faster

http://techblog.netflix.com/2015/08/making-netflixcom-
faster.html
3. New technologies for the new LinkedIn home page

https://engineering.linkedin.com/frontend/new-technologies-
new-linkedin-home-page
4. Improving performance on Twitter.com

https://blog.twitter.com/2012/improving-performance-on-
twittercom
5. Scaling Isomorphic Javascript Code

http://blog.nodejitsu.com/scaling-isomorphic-javascript-code/
109
Useful Links
6. From AngularJS to React: The Isomorphic Way

https://blog.risingstack.com/from-angularjs-to-react-the-
isomorphic-way/
7. Isomorphic JavaScript: The Future of Web Apps

http://nerds.airbnb.com/isomorphic-javascript-future-web-apps/
8. React server side rendering performance

http://www.slideshare.net/nickdreckshage/react-meetup
9. The Lost Art of Progressive HTML Rendering

http://blog.codinghorror.com/the-lost-art-of-progressive-html-
rendering/
10. Extract and inline Critical Path CSS in HTML pages

https://github.com/addyosmani/critical
110
Quotes
“Almost algorithm problems
could be solved by changing a
data structure”
“Changes is our work”,

Jake Archibald, Google
Why should we stop
developing classic
Single Page Applications?
izmaylov.dm@gmail.com
Submit short information about you
Thank you
Denis Izmaylov
@DenisIzmaylov
https://github.com/DenisIzmaylov
http://startup-makers.com
denis_izmaylov
izmaylov.dm@gmail.com
Secret Slide

More Related Content

PDF
Performance and Scalability Art of Isomorphic React Applications
PDF
React server side rendering performance
PDF
Isomorphic web application
PPSX
Server Side Rendering, caching and performance
PDF
MEAN Stack WeNode Barcelona Workshop
PDF
Client Vs. Server Rendering
PDF
The Dark Side of Single Page Applications
PPTX
MEAN Stack
Performance and Scalability Art of Isomorphic React Applications
React server side rendering performance
Isomorphic web application
Server Side Rendering, caching and performance
MEAN Stack WeNode Barcelona Workshop
Client Vs. Server Rendering
The Dark Side of Single Page Applications
MEAN Stack

What's hot (20)

PDF
Angular 2 vs React
PPTX
Stack Overflow - It's all about performance / Marco Cecconi (Stack Overflow)
PDF
Client vs Server Templating: Speed up initial load for SPA with Angular as an...
PDF
Grokking #9: Building a real-time and offline editing service with Couchbase
PDF
Node.JS: Do you know the dependency of your dependencies dependency
PPTX
Server side rendering review
PPTX
Testing your Single Page Application
PDF
Grunt.js and Yeoman, Continous Integration
PDF
MEAN Stack Workshop at Node Philly, 4/9/14
PPTX
Mini-Training Owin Katana
PDF
BP101: A Modernized Workflow w/ Domino/XPages
PPTX
001. Introduction about React
PDF
WebAssembly vs JavaScript: What is faster?
PDF
Intro to vue.js
PDF
The Evolution of Airbnb's Frontend
PDF
WKWebView in Production
PDF
Integrating React.js Into a PHP Application
PDF
Node, express & sails
PDF
A 20 minute introduction to AngularJS for XPage developers
PDF
Building a Single-Page App: Backbone, Node.js, and Beyond
Angular 2 vs React
Stack Overflow - It's all about performance / Marco Cecconi (Stack Overflow)
Client vs Server Templating: Speed up initial load for SPA with Angular as an...
Grokking #9: Building a real-time and offline editing service with Couchbase
Node.JS: Do you know the dependency of your dependencies dependency
Server side rendering review
Testing your Single Page Application
Grunt.js and Yeoman, Continous Integration
MEAN Stack Workshop at Node Philly, 4/9/14
Mini-Training Owin Katana
BP101: A Modernized Workflow w/ Domino/XPages
001. Introduction about React
WebAssembly vs JavaScript: What is faster?
Intro to vue.js
The Evolution of Airbnb's Frontend
WKWebView in Production
Integrating React.js Into a PHP Application
Node, express & sails
A 20 minute introduction to AngularJS for XPage developers
Building a Single-Page App: Backbone, Node.js, and Beyond
Ad

Viewers also liked (20)

PDF
JavaScript сегодня: React, Redux и новая реальность
PDF
Изоморфные react-приложения
PDF
Микросервисная архитектура на базе CoreOS и Kubernetes
PDF
Изоморфные React-приложения: производительность и масштабирование
PDF
redux: the best for isomorphic apps
PDF
Актуальные технологии и тренды в веб-разработке
PDF
webpack: 7 бед - один ответ
PDF
PreJSS: the final point in the CSS war
PPTX
Com_21
PPTX
Tina Turner La Reina del Rock and Roll
PPTX
Die Königin Rock and Roll
PDF
MOST Creative Camp
PPTX
Tina Turner La Reina del Rock and Roll
PPTX
Die Königin Rock and Roll
PPTX
A Rainha do Rock and Roll
PPTX
The Queen of Rock and Roll
PPTX
A Rainha do Rock and Roll
PPTX
FOTOVIDEO EN DIAPOSITIVA DE LA MATERIA DE ECONOMIA
PPTX
Tina Turner La Regina del Rock and Roll
JavaScript сегодня: React, Redux и новая реальность
Изоморфные react-приложения
Микросервисная архитектура на базе CoreOS и Kubernetes
Изоморфные React-приложения: производительность и масштабирование
redux: the best for isomorphic apps
Актуальные технологии и тренды в веб-разработке
webpack: 7 бед - один ответ
PreJSS: the final point in the CSS war
Com_21
Tina Turner La Reina del Rock and Roll
Die Königin Rock and Roll
MOST Creative Camp
Tina Turner La Reina del Rock and Roll
Die Königin Rock and Roll
A Rainha do Rock and Roll
The Queen of Rock and Roll
A Rainha do Rock and Roll
FOTOVIDEO EN DIAPOSITIVA DE LA MATERIA DE ECONOMIA
Tina Turner La Regina del Rock and Roll
Ad

Similar to Isomorphic React Applications: Performance And Scalability (20)

PDF
Lessons Learned from Using Next.js in Production
PPTX
intro to react| React: dynamic UIs, component-based, virtual DOM, JSX, effici...
PDF
React js vs react native a comparative analysis
PPTX
Full Stack_Reac web Development and Application
PDF
React Js vs Node Js_ Which Framework to Choose for Your Next Web Application
PPTX
React And Express Tutorial
PPTX
React JS - A quick introduction tutorial
PDF
Why Use React Js A Complete Guide (1).pdf
PDF
React Native in Production
PDF
FRONTEND DEVELOPMENT WITH REACT.JS
PPTX
Web Performance & Latest in React
PDF
What is Server-side Rendering? How to Render Your React App on the Server-sid...
PDF
Creating Hyper Performant Web Apps with React
PPTX
Next.js - ReactPlayIO.pptx
PPTX
React js
PDF
Top Reasons to Use ReactJS for Web Development
PDF
Build High-End Web Applications With Reactjs And Nodejs
PDF
React native vs react js
PDF
React Js Simplified
PDF
NextJS - Online Summit for Frontend Developers September 2020
Lessons Learned from Using Next.js in Production
intro to react| React: dynamic UIs, component-based, virtual DOM, JSX, effici...
React js vs react native a comparative analysis
Full Stack_Reac web Development and Application
React Js vs Node Js_ Which Framework to Choose for Your Next Web Application
React And Express Tutorial
React JS - A quick introduction tutorial
Why Use React Js A Complete Guide (1).pdf
React Native in Production
FRONTEND DEVELOPMENT WITH REACT.JS
Web Performance & Latest in React
What is Server-side Rendering? How to Render Your React App on the Server-sid...
Creating Hyper Performant Web Apps with React
Next.js - ReactPlayIO.pptx
React js
Top Reasons to Use ReactJS for Web Development
Build High-End Web Applications With Reactjs And Nodejs
React native vs react js
React Js Simplified
NextJS - Online Summit for Frontend Developers September 2020

Recently uploaded (20)

PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
Transform Your Business with a Software ERP System
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPTX
L1 - Introduction to python Backend.pptx
PPTX
Reimagine Home Health with the Power of Agentic AI​
PPTX
ai tools demonstartion for schools and inter college
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPTX
Introduction to Artificial Intelligence
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
medical staffing services at VALiNTRY
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
System and Network Administraation Chapter 3
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Transform Your Business with a Software ERP System
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Softaken Excel to vCard Converter Software.pdf
2025 Textile ERP Trends: SAP, Odoo & Oracle
L1 - Introduction to python Backend.pptx
Reimagine Home Health with the Power of Agentic AI​
ai tools demonstartion for schools and inter college
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
How to Migrate SBCGlobal Email to Yahoo Easily
Introduction to Artificial Intelligence
Design an Analysis of Algorithms I-SECS-1021-03
medical staffing services at VALiNTRY
Which alternative to Crystal Reports is best for small or large businesses.pdf
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
System and Network Administraation Chapter 3
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...

Isomorphic React Applications: Performance And Scalability