SlideShare a Scribd company logo
1 of 18
Download to read offline
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

More Related Content

Viewers also liked

วิธีแก้ปัญหาระบบควบคุมเครื่องคอมพิวเตอร์
วิธีแก้ปัญหาระบบควบคุมเครื่องคอมพิวเตอร์วิธีแก้ปัญหาระบบควบคุมเครื่องคอมพิวเตอร์
วิธีแก้ปัญหาระบบควบคุมเครื่องคอมพิวเตอร์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
 

Viewers also liked (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
 

Recently uploaded

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 

Recently uploaded (20)

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 

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