SlideShare a Scribd company logo
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Everything you ever need to know about Front
end Performance Optimization –
Tools, Techniques and Methodology
Haribabu Nandyal (hari.nandyal@gmail.com)
https://in.linkedin.com/in/qualityengineeringleader
Modelling  Web Performance Optimization - FFSUx
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
“Browsing should be as simple
and as fast as turning a page in
a magazine”
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
“Browsing should be as “simple”
and as “fast” as turning a page in
a magazine”
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Performance impact on business metrics
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Website Response time
(+/-)
Result
Amazon +100 ms 1% drop in sales
Yahoo +400 ms 5-9% drop in requests
Google +500 ms 20% drop in requests
Bing +2000 ms 4.3% drop in revenue/user
Shopzilla -4800 ms
7-12% increase in revenue
25 % increase in page views
Mozilla -2200 ms 15.4% increase in downloads
Google Maps
Reduced the file volume by
30%
30% increase in map requests
Walmart -100 ms 1% increase revenue
Performance impact on business metrics
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
• Higher search ranking resulting in increased Customer traffic
• Higher page views.
• Better Conversion Rate resulting in increased Revenue
• Improved Ux and higher Customer Satisfaction
• Retention of Customers
• Reduced cost (Cost Optimization e.g: Infrastructure costs)
Business need for great Performance!
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Why the slowdown?
The median ecommerce page contains 99 resources (images, JS, CSS etc).
A year ago, it was 93 resources. Each of this additional resource incurs
latency and adds up to slower load times.
A median page size is 1436 KB which was 1094 KB a year ago. An
increase of 31% in page size.
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Increase in average no of requests
and page size
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Anatomy of a HTTP Request
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Profiling a HTTP Request
85-90% of website rendering
depends on the performance of
Network and Client Side
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Client Side Performance
Optimization
• Earlier website performance was only about optimizing the server-
side and reducing the generation-time of the HTML. But server-
side does not seem to be the main issue.
• Yahoo found out that on an average only 10-20% of the loading
time is spent on the server-side; 80-90% is spent at the client-side
Average loading time of a website
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Web Page Generation – Desktop vs
Mobile
Http measurements of where time is spent in generating a page for
top 50 k sites.
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Usual suspects for Performance
bottlenecks
Performance bottlenecks because of any/all of these levels:
• Server layer
• Application Architecture/Coding/Design
• Network latency
• Database performance
• Operating Systems
Performance Tuning – zone of focus
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
User Interface: Address bar ,
back/forward button ,
bookmarking menu
Browser Engine: “Bridge” between
user interface (UI) and rendering
engine kernel , plug-ins ,
extensions , add-ons
Rendering Engine: It interprets the HTML, XML, and JavaScript that comprises a
given URL and generates the layout that is displayed in the UI. So HTML parsers,
XML parsers, JS interpreter are the key components of the Rendering Engine.
Data Persistence: Stores data on the client machine. Eg: Cookies, HTML, Cache
Browser Architecture
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
 Starts receiving the data. First packet is about 14 k bytes.
 Parses the HTML and starts constructing the DOM.
 Starts downloading of assets (CSS, Images, JS) – in the same
order as specified in the HTML source code.
 Parses CSS and constructs CSS OM.
 Constructs the Render tree (DOM + CSS OM)
 Calculates layout size and position.
 Paints and composites the layers.
Submitted the request? - Let us go behind
the scene
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Parsing of the HTML document is what constructs the Document Object Model
(DOM). In parallel, the CSS Object Model (CSSOM) is constructed from the specified
stylesheet rules.
DOM and CSSOM are then combined to create the "render tree," at which point the
browser has enough information to perform a layout and paint something to the
screen.
Critical Rendering Path
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Critical Rendering Path
JavaScript execution can issue a synchronous doc.write and block DOM
parsing and construction. Similarly, scripts can query for a computed style
of any object, which means that JavaScript can also block on CSS.
Since JS can change the DOM and the CSS OM, when the browser sees a
<script> tag it will block downloading of other assets until the JS has been
downloaded and executed
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Rendering Engines
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Faster Fewer
Smaller
FFSUx model
UX
Tools, Techniques and
Methodology
Faster content delivery, Fewer in count, Smaller in size,
good User Experience
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Faster content delivery: - Reduce Round Trip Time (RTT)
 Reduce DNS lookup
 Use a CDN (Amazon CloudFront, MaxCDN, Limelight, Akamai)
 Prefetch and Postfetch
 Domain Sharding and Parallelize requests
 Use <link> tag instead of @import
 Externalize JS and CSS
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Fewer in count: - Reduce no of http requests/CSS/JS/Images
 Reduction in number of Round Trips
 CSS Spriting
 Remove duplicate scripts
 Configure Entity tags
 Enable caching
 Set expiry dates / Add an expires header
 Avoid Redirects
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Smaller in size:
 Compression of html/CSS/JS (gzip, deflate)
 Proper image format (Jpeg, WebP, PNG?)
 Minification of html/JS
User Experience
 Time To Interact (TTI)
 CSS on top
 JS in the bottom
 Asynchronous JS
 Above the fold rendering
 Progressive Image loading
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Request without DNS Prefetch
Total Time of request = DNS lookup + Initial Connection + Time to First Byte +
Content Download.
Request with DNS Prefetch
Total time of request = Initial Connection + Time to First Byte + Content Download.
Using DNS prefetch can reduce DNS lookup time by pre resolving DNS (Domain
Name Server).Google PageSpeed has incorporated DNS prefetch (pre resolving
DNS) as one of performance improvement methods.
Typical DNS lookup time is from 20 ms to 120 ms.
Reduce DNS lookups
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Resource Request Waterfall
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
DNS Server Hierarchy
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Most requests are now handled
by the CDN.
So the origin server can handle
greater no of users since each
user is making fewer requests to
the main server
How CDN speeds up resource download?
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Preloading of Components
• Preload components you’ll need in the future
• Unconditional preload : Xero login page preloads all core
components so that the dashboard experience is better
• Conditional preload : Often based on where you think a user
might go to next
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Parallelize downloads across
hostnames
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Parallelize downloads across
hostnames
Browser
Max connections per
hostname
Opera Mini 11
Firefox 27 6
Chrome 34 6
Safari 7.0.1 6
iPad 5 6
iPhone 5 6
Android 4 6
IE 10 8
IE 11 13
www.browserscope.org
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
When CSS @import is used from an external stylesheet, browser is
unable to download stylesheets in parallel. This results in additional
round-trips to the overall page load. If first.css contains,
@import url("second.css")
The browser must download, parse, and execute first.css before it is
able to discover that it needs to download second.css.
Use <link> tag instead of @import.
<link rel="stylesheet" href="first.css"> <link rel="stylesheet"
href="second.css">
This allows the browser to download stylesheets in parallel, which
results in faster page load times.
CSS@Import vs <link>
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Reduce HTTP Requests
Repeat the same for CSS:
Before:
<script src="jquery.js"></script>
<script src="jquery.twitter.js"></script>
<script src="jquery.cookie.js"></script>
<script src="myapp.js"></script>
<link href="all.css"
rel="stylesheet"
type="text/css”/>
After:
<script src="all.js"
type="text/javascript">
</script>
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
How Spriting works:
• Finds background images
• Groups images into sprites
• Generates the sprite
• Injects the sprite into the current page
• Recomputes the CSS background-position
• Combines all small images into one large image
• Use CSS to control displaying of each image
• Spriteme.org, Csssprites.com
CSS Sprites
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
• Webservers can be configured to send an ETag (entity tag) header in file
responses. This ETag can be a Md5 hash of the file. Browser will send the ETag
from its cache in its next request for the same file.
• The server checks if the ETag is still valid (the file hasn’t changed). If valid
server only sends a 304 code (Not Modified ) without sending the file again. If
the file has changed, the server sends the whole file as usual. With this
technique a lot of traffic can be saved, but there’s still a HTTP to be made.
Entity Tag
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
• Use Expires header to tell the browser how long to keep the resource.
• Browsers won't fetch the resource again until its expiry.
• This is perfect for static files when it’s known that they won’t change
during the time specified in the Expires header.
Expires Header
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Impact of Cookies on Response Time
Cookie Size Time Delta
0 bytes 78 ms 0 ms
500 bytes 79 ms +1 ms
1000 bytes 94 ms +16 ms
1500 bytes 109 ms +31 ms
2000 bytes 125 ms +47 ms
2500 bytes 141 ms +63 ms
3000 bytes 156 ms +78 ms
Website Total Cookie
Size
Amazon 60 bytes
Google 72 bytes
Yahoo 122 bytes
CNN 184 bytes
YouTube 218 bytes
MSN 268 bytes
eBay 331 bytes
MySpace 500 bytes
Cookie sizes across websites
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Reduce cookie weight
• Cookie’s are sent back with every request
• Keep cookie size small and only store what’s required – use
server-side storage for everything else
• Consider cookie free domains for static content
Keep it clean
• Always asynchronous
• Use JSON over XML
 Accessing JSON faster and cheaper
 Less overhead compared to XML
• Use GET requests over POSTs wherever possible
 POST is a 2-step process: send headers, send body
 POST without a body is essentially a GET anyway
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
• Add an Expires header
 Not just for images – should be used on all static content
 Set a “Never expire” or far future expires policy if you can
 Reduces HTTP requests – once component is served, the browser
never asks for it again
 Date stamping in file names makes it easier
“Empty cache” means the browser has to request the components
instead of pulling them from the browser disk cache.
Maximize the cache
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Gzip Deflate
Size Size Savings Size Savings
Script 3.3K 1.1K 67% 1.1K 66%
Script 39.7K 14.5K 64% 16.6K 58%
Style
Sheet
1.0K 0.4K 56% 0.5K 52%
Style
sheet
14.1K 3.7K 73% 4.7K 67%
Gzip compresses better and is
supported in more no of
browsers
Gzip vs. Deflate
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Spot the difference
Original PNG:
75,628 bytes
After compression:
19,996 bytes
(73% smaller)
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
<img src="photos/awesome_cat.png" width="800">
awesome_cat.png 350 KB
awesome_cat.jpg 80 KB
awesome_cat.webp 60 KB
Note: .webp - supported on chrome/opera/android browsers.
Servers can do UA or Accept Check to send the .jpg or .webp image
based on the browser.
Optimize images
Images are one of the greatest impediments for performance.
 Either in the wrong format
 Uncompressed
 Not optimized to load progressively
 All of the above.
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Minification is the process of removing all unnecessary characters from source
code, without changing its functionality. Includes white spaces, new line characters,
comments, and sometimes block delimiters, which adds readability to the code but
are not required for execution.
Minify all static content
(CSS, JavaScript, XML, JSON, HTML)
Reduced 24% from the original sizeTools: JSMin, CSSTidy, YUI Compressor
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Analysis of the Alexa top 1000 sites found:
 42% don't gzip
 44% have more than 2 css files
 56% serve css from a cookied domain
 62% don't minify
 31% have more than 100k size css
Top 1000 retail sites
 50% aren't doing both keep-alive and compression (the 2
easiest things!!)
Industry Observations: Alexa
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Ten fastest websites based on TTI
Time to Interact (TTI) is a interesting metric for user interaction.
TTI is defined as the point at which a page’s primary content has
been rendered and ready for interaction.
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
CSS external and on top
● Move all inline CSS to external style sheets for both reuse and caching
● Put all style sheet references at the top
JavaScript external and below
• Promotes better script design
• Push scripts as low as possible
• Be pragmatic – think about splitting JavaScript into “must be loaded” and “can be loaded
on demand”
• Scripts will block both downloading and rendering until parsed
• Remove duplicate scripts (IE has a habit of downloading them again)
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
 YSlow
 PageSpeed
 WebPagetest (www.webpagetest.org)
 GTMetrix.com
 Pingdom.com
 Yottaa.com
 Ultratools.com
 Websitepulse.com
Tools to Grade performance of a
website
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
 Time to Start Render
 Time to Display
 Time to Interact
 Bounce Rate
 Time on Site
 Pages Per Visit
 Conversion Rate
 Abandonment Rate
 Order Value
 Revenue
10 user Engagement Metrics
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
YSlow
Yahoo’s YSlow is a plugin for Firebug which can test a
website for many basic optimizations. The tests are based
on the best practices from Yahoo’s Performance team.
Grades performance – not about response times but about
how well a site has adopted the suggested techniques.
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Google Page Speed
Google Page Speed is also Firebug plugin based on performance rules. It
also includes minifying of HTML, CSS and JS files.
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Google Page Speed
https://developers.google.com/speed/pagespeed/insights/
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
WebpageTest.org
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Google Service - PageSpeed
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
GTMetrix – combination of Yslow and
PageSpeed – gtmetrix.com
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Quick Recap
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Premature Optimization is the root of all evil
Donald Knuth
Performance is not a checklist, it is a continuous process
Ilya Grigorik
Parting Thoughts:
Performance Tuning = Front End + Back End
www.unicomlearning.com/Test_Automation_Summit_Bangalore/
Haribabu Nandyal (hari.nandyal@gmail.com)
https://in.linkedin.com/in/qualityengineeringleader

More Related Content

PPTX
Green Nanotechnology
PPT
ISPAC2013 plenary talk - Environmental Forensics and PAHs
PPTX
Nanotechnology & its application (By- Saquib Khan)
PDF
Ke kähulu pepeke piko
PPTX
Chlorination & measurement
PPTX
Nanotechnology
PPTX
Impact Of Municipal Solid Waste Dump On Ground Water Quality in kattamanchi, ...
PPTX
Security testing fundamentals - must need basics to learn Penetration Testing
Green Nanotechnology
ISPAC2013 plenary talk - Environmental Forensics and PAHs
Nanotechnology & its application (By- Saquib Khan)
Ke kähulu pepeke piko
Chlorination & measurement
Nanotechnology
Impact Of Municipal Solid Waste Dump On Ground Water Quality in kattamanchi, ...
Security testing fundamentals - must need basics to learn Penetration Testing

Similar to Modelling Web Performance Optimization - FFSUx (20)

PPTX
Building high performing web pages
PPTX
SearchLove San Diego 2018 | Mat Clayton | Site Speed for Digital Marketers
PPT
Frontend performance
PDF
Website Development Guidelines
PPTX
Web Performance Optimization
PPT
TSSJS2010 Presenatation on: Performance Anti Patterns In Ajax Applications
PPT
Performance anti patterns in ajax applications
PDF
Web Performance Optimization (WPO)
PPT
Web performance tuning
PPTX
Presentation Tier optimizations
PDF
The Technical SEO Full Course how to do
PDF
Advanced Technical SEO - Index Bloat & Discovery: from Facets to Javascript F...
PDF
Web Performance Optimierung - DWX13
PPTX
JS Fest 2019/Autumn. Александр Товмач. JAMstack
PPTX
WordCamp Denmark Keynote
PPTX
Front end optimization
PPTX
Website Performance
PDF
Beyond Breakpoints: Improving Performance for Responsive Sites
PPTX
SEO 101 - Google Page Speed Insights Explained
PPT
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
Building high performing web pages
SearchLove San Diego 2018 | Mat Clayton | Site Speed for Digital Marketers
Frontend performance
Website Development Guidelines
Web Performance Optimization
TSSJS2010 Presenatation on: Performance Anti Patterns In Ajax Applications
Performance anti patterns in ajax applications
Web Performance Optimization (WPO)
Web performance tuning
Presentation Tier optimizations
The Technical SEO Full Course how to do
Advanced Technical SEO - Index Bloat & Discovery: from Facets to Javascript F...
Web Performance Optimierung - DWX13
JS Fest 2019/Autumn. Александр Товмач. JAMstack
WordCamp Denmark Keynote
Front end optimization
Website Performance
Beyond Breakpoints: Improving Performance for Responsive Sites
SEO 101 - Google Page Speed Insights Explained
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
Ad

Recently uploaded (20)

PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Machine learning based COVID-19 study performance prediction
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Modernizing your data center with Dell and AMD
PDF
cuic standard and advanced reporting.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Big Data Technologies - Introduction.pptx
NewMind AI Weekly Chronicles - August'25 Week I
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
“AI and Expert System Decision Support & Business Intelligence Systems”
Machine learning based COVID-19 study performance prediction
Per capita expenditure prediction using model stacking based on satellite ima...
Modernizing your data center with Dell and AMD
cuic standard and advanced reporting.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
20250228 LYD VKU AI Blended-Learning.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
NewMind AI Monthly Chronicles - July 2025
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Chapter 3 Spatial Domain Image Processing.pdf
Big Data Technologies - Introduction.pptx
Ad

Modelling Web Performance Optimization - FFSUx

Editor's Notes

  • #10: The average size for top 1000 websites is found to be around 1999 KB in 2015 – 40% increase from last year