SlideShare ist ein Scribd-Unternehmen logo
1 von 18
Downloaden Sie, um offline zu lesen
web performance 
assets pipeline in Play 2.3
Speed is a feature 
● Faster sites lead to better user 
engagement 
● Faster sites lead to better user retention 
● Faster sites lead to higher conversions 
Source: 
http://chimera.labs.oreilly.com/books/1230000000545/ch01.html#SPEED_FEATURE
better performance 
● less bytes 
● less requests 
● less latency
less bytes (1) 
● gzip encoding 
● doc: 
https://www.playframework.com/document 
ation/latest/GzipEncoding
less bytes (2) 
● conditional requests 
● Last-Modified and ETag headers provide 
validation mechanisms
Last-Modified 
● Server sets Last-Modified header 
● Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT 
● Browser issues an If-Modified-Since 
request header to validate the cached 
document 
● Server answers with 304 Not Modified 
or 200 OK
Etag 
● Server sets Etag header 
● Etag: "15f0fff99ed5aae4edffdd6496d7131f" 
● Browser issues an If-None-Match 
request header to validate the cached 
document 
● Server answers with 304 Not Modified 
or 200 OK
Conditional requests 
● Last-modified: based on time 
● Etag: based on content 
● Since play 2.0.2
less requests 
● Cache-Control switches on caching in 
the browser 
● avoid requests
Cache-Control 
● Cache-Control:public 
● Cache-Control:private 
● Cache-Control:public, max-age=31536000 
● Cache-Control:public 
Expires: Mon, 25 Jun 2012 21:31:12 GMT
real world 
● Caching strategies different from browser 
to browser
perfect world 
● in developement: always the last version 
● in production: 
– cache the assets as long as they are not 
modified 
– be sure that a browser does not use an 
outdated cached asset
play 2.3 
● pipelineStages := Seq(digest, gzip) 
● in production mode 
● content-based hash in the filename 
● different content -> different fingerprint 
● sets a very long cache
reduce latency 
● Content delivery network (CDN) 
● distributes content around globe 
● location near from client 
● request without cookie 
● downside: one more DNS lookup
play 2.3 
● webjars 
● pipelineStages := Seq(rjs, digest, gzip) 
● assets from http://cdn.jsdelivr.net/
under the cover 
● assets pipeline managed with sbt-web 
and plugins: 
https://github.com/sbt/sbt-web 
● not play specific 
● versioned assets controller in play 2.3
Code 
https://github.com/leanovate/moodly
web perf - more info 
● High Performance Browser Networking 
http://chimera.labs.oreilly.com/books/12 
30000000545/index.html 
● https://devcenter.heroku.com/articles/inc 
reasing-application-performance-with-http 
-cache-headers 
● https://developers.google.com/web/fundam 
entals/performance/optimizing-content-ef 
ficiency/http-caching

Weitere ähnliche Inhalte

Andere mochten auch

วิธีแก้ปัญหาระบบควบคุมเครื่องคอมพิวเตอร์
วิธีแก้ปัญหาระบบควบคุมเครื่องคอมพิวเตอร์วิธีแก้ปัญหาระบบควบคุมเครื่องคอมพิวเตอร์
วิธีแก้ปัญหาระบบควบคุมเครื่องคอมพิวเตอร์Sun Dev
 
Structure your Play application with the cake pattern (and test it)
Structure your Play application with the cake pattern (and test it)Structure your Play application with the cake pattern (and test it)
Structure your Play application with the cake pattern (and test it)yann_s
 
Introduction to type classes in Scala
Introduction to type classes in ScalaIntroduction to type classes in Scala
Introduction to type classes in Scalayann_s
 
Performance optimisation with GraphQL
Performance optimisation with GraphQLPerformance optimisation with GraphQL
Performance optimisation with GraphQLyann_s
 
Introduction to rust: a low-level language with high-level abstractions
Introduction to rust: a low-level language with high-level abstractionsIntroduction to rust: a low-level language with high-level abstractions
Introduction to rust: a low-level language with high-level abstractionsyann_s
 
Introduction to GraphQL at API days
Introduction to GraphQL at API daysIntroduction to GraphQL at API days
Introduction to GraphQL at API daysyann_s
 

Andere mochten auch (8)

La tecnología
La tecnologíaLa tecnología
La tecnología
 
Language
LanguageLanguage
Language
 
วิธีแก้ปัญหาระบบควบคุมเครื่องคอมพิวเตอร์
วิธีแก้ปัญหาระบบควบคุมเครื่องคอมพิวเตอร์วิธีแก้ปัญหาระบบควบคุมเครื่องคอมพิวเตอร์
วิธีแก้ปัญหาระบบควบคุมเครื่องคอมพิวเตอร์
 
Structure your Play application with the cake pattern (and test it)
Structure your Play application with the cake pattern (and test it)Structure your Play application with the cake pattern (and test it)
Structure your Play application with the cake pattern (and test it)
 
Introduction to type classes in Scala
Introduction to type classes in ScalaIntroduction to type classes in Scala
Introduction to type classes in Scala
 
Performance optimisation with GraphQL
Performance optimisation with GraphQLPerformance optimisation with GraphQL
Performance optimisation with GraphQL
 
Introduction to rust: a low-level language with high-level abstractions
Introduction to rust: a low-level language with high-level abstractionsIntroduction to rust: a low-level language with high-level abstractions
Introduction to rust: a low-level language with high-level abstractions
 
Introduction to GraphQL at API days
Introduction to GraphQL at API daysIntroduction to GraphQL at API days
Introduction to GraphQL at API days
 

Kürzlich hochgeladen

Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintMahmoud Rabie
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Brian Pichman
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IES VE
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-pyJamie (Taka) Wang
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URLRuncy Oommen
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopBachir Benyammi
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdfPedro Manuel
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfJamie (Taka) Wang
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.YounusS2
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1DianaGray10
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostMatt Ray
 

Kürzlich hochgeladen (20)

Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-py
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URL
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdf
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1
 
201610817 - edge part1
201610817 - edge part1201610817 - edge part1
201610817 - edge part1
 
20150722 - AGV
20150722 - AGV20150722 - AGV
20150722 - AGV
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
 

Web performance-play-2.3

  • 1. web performance assets pipeline in Play 2.3
  • 2. Speed is a feature ● Faster sites lead to better user engagement ● Faster sites lead to better user retention ● Faster sites lead to higher conversions Source: http://chimera.labs.oreilly.com/books/1230000000545/ch01.html#SPEED_FEATURE
  • 3. better performance ● less bytes ● less requests ● less latency
  • 4. less bytes (1) ● gzip encoding ● doc: https://www.playframework.com/document ation/latest/GzipEncoding
  • 5. less bytes (2) ● conditional requests ● Last-Modified and ETag headers provide validation mechanisms
  • 6. Last-Modified ● Server sets Last-Modified header ● Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT ● Browser issues an If-Modified-Since request header to validate the cached document ● Server answers with 304 Not Modified or 200 OK
  • 7. Etag ● Server sets Etag header ● Etag: "15f0fff99ed5aae4edffdd6496d7131f" ● Browser issues an If-None-Match request header to validate the cached document ● Server answers with 304 Not Modified or 200 OK
  • 8. Conditional requests ● Last-modified: based on time ● Etag: based on content ● Since play 2.0.2
  • 9. less requests ● Cache-Control switches on caching in the browser ● avoid requests
  • 10. Cache-Control ● Cache-Control:public ● Cache-Control:private ● Cache-Control:public, max-age=31536000 ● Cache-Control:public Expires: Mon, 25 Jun 2012 21:31:12 GMT
  • 11. real world ● Caching strategies different from browser to browser
  • 12. perfect world ● in developement: always the last version ● in production: – cache the assets as long as they are not modified – be sure that a browser does not use an outdated cached asset
  • 13. play 2.3 ● pipelineStages := Seq(digest, gzip) ● in production mode ● content-based hash in the filename ● different content -> different fingerprint ● sets a very long cache
  • 14. reduce latency ● Content delivery network (CDN) ● distributes content around globe ● location near from client ● request without cookie ● downside: one more DNS lookup
  • 15. play 2.3 ● webjars ● pipelineStages := Seq(rjs, digest, gzip) ● assets from http://cdn.jsdelivr.net/
  • 16. under the cover ● assets pipeline managed with sbt-web and plugins: https://github.com/sbt/sbt-web ● not play specific ● versioned assets controller in play 2.3
  • 18. web perf - more info ● High Performance Browser Networking http://chimera.labs.oreilly.com/books/12 30000000545/index.html ● https://devcenter.heroku.com/articles/inc reasing-application-performance-with-http -cache-headers ● https://developers.google.com/web/fundam entals/performance/optimizing-content-ef ficiency/http-caching