SlideShare a Scribd company logo
ActionEmbedding Phil Cowans - LRUG, July 2010
Pagelets (http://www.facebook.com/notes/facebook-engineering/bigpipe-pipelining-web-pages-for-high-performance/389414033919)
 
Characteristics Of Pagelets Substantial content. Independence from the containing page. Potential to be handled by a back-end service. Can typically be cached. Localisation.
Why Think About Pages This Way? Helps define a ubiquitous language. Clean code: separation of responsibilities. Code reuse. Scalability.
Existing Tools / Patterns / Work Rails: ActionController::Components in early versions of Rails - dropped for performance reasons. Cells - plugin implementing similar functionality. Embedded Actions - another plugin. Elsewhere: Kohana - PHP framework based on Hierarchical Model-View-Controller (HMVC) pattern. Facebook BigPipe framework - Javascript tricks to get as much of the page to render as quickly as possible. 
Why Start Again? An excuse to dig around inside of Rails. Experiment with various techniques for composing content. Make it easy for pagelet infrastructure to grow with the application: Easy to start using pagelets without complex infrastructure. Confidence that it will be possible to swap in more sophisticated embedding mechanisms without a rewrite. A couple of niggles with existing work: Wanted to reuse ActionController::Base for pagelets, rather than defining a new class. Use paths/URLs internally rather than controller/action/params.
HMVC Pagelet render handled by secondary internal request. Secondary request handled by standard Rails Controller / View (you can hit it directly if you want).
Request Forwarding Primary application forwards request to back end server Separate tier scales independently. Useful tricks: time out slow back end requests, silently drop pagelet on exception, easy killswitch for feature if necessary.  Use appropriate mix of technologies - back end doesn't need to use same framework as front end, e.g. Sinatra for simple things.
Edge Side Includes Page composition handled by a proxy server. Works with proxies which support Edge Side Includes (e.g. Varnish)
XHR Composition Pagelets are loaded via secondary XHR requests in JavaScript.
Other Options (not yet implemented) Parallel execution. Potential to scale out for latency. BigPipe style composition.
Internals HMVC requests use Rack internally. Easy on Rails 2.3, as routing and controller speak Rack natively - can just inject request into later parts of standard processing pipeline. Rails 2.2 support (needed for SK) - backport bits of 2.3 to push Rack requests into controller.
Practical Experience Songkick activity feeds use ActionEmbedding / HMVC since Thursday. Measurable but relatively insignificant overhead - still room for improvement. Stable so far...
Issues / Todos Try XHR embedding in production. Better exception handling (right now you get the error embedded in the pagelet - should interpret response code). Consistent approach to constructing nested requests: Headers Access to cookies Security / access control. Investigate patterns for configuring pagelets.
Thanks... http://github.com/philcowans/action_embedding [email_address] @philcowans

More Related Content

PDF
Isomorphic server side rendering with Twig
PDF
WEBridge 4 SAP ( Windchill and SAP Integration)
PDF
WEBridge 4 EBS ( Windchill and Oracle EBS Integration )
PDF
Drupal and communication
ODP
iPhone Web Development and Ruby On Rails
PDF
2012-04-18-shibuyarb-offline-mobile-app-has-great-potential
PDF
饿了么工作流介绍
PDF
Apache Gobblin
Isomorphic server side rendering with Twig
WEBridge 4 SAP ( Windchill and SAP Integration)
WEBridge 4 EBS ( Windchill and Oracle EBS Integration )
Drupal and communication
iPhone Web Development and Ruby On Rails
2012-04-18-shibuyarb-offline-mobile-app-has-great-potential
饿了么工作流介绍
Apache Gobblin

What's hot (17)

PPTX
Migration from ASP.NET MVC to ASP.NET Core
PPTX
Building real time app by using asp.Net Core
PDF
Balkan - data eng meetup - data fusion
PPSX
Released WEBridge 4 SAP R 3 on 9/9 of 2014
PDF
Perforce Streams
PPTX
Mca ppt
PDF
Simple cloud reference architecture
PDF
Performance Tuning RocksDB for Kafka Streams’ State Stores
PPT
Intro to SPA using JavaScript & ASP.NET
PPTX
Lucee writing your own debugging template
PPTX
Building Your First Apache Apex (Next Gen Big Data/Hadoop) Application
PPTX
Lucee writing your own debugging template
PPTX
Caching strategies with lucee
ODP
ruby on rails development company in india
PPTX
DBAs vs Developers - JSON in SQL Server
PDF
(ATS6-PLAT03) What's behind Discngine collections
PDF
Streaming your Lyft Ride Prices - Flink Forward SF 2019
Migration from ASP.NET MVC to ASP.NET Core
Building real time app by using asp.Net Core
Balkan - data eng meetup - data fusion
Released WEBridge 4 SAP R 3 on 9/9 of 2014
Perforce Streams
Mca ppt
Simple cloud reference architecture
Performance Tuning RocksDB for Kafka Streams’ State Stores
Intro to SPA using JavaScript & ASP.NET
Lucee writing your own debugging template
Building Your First Apache Apex (Next Gen Big Data/Hadoop) Application
Lucee writing your own debugging template
Caching strategies with lucee
ruby on rails development company in india
DBAs vs Developers - JSON in SQL Server
(ATS6-PLAT03) What's behind Discngine collections
Streaming your Lyft Ride Prices - Flink Forward SF 2019
Ad

Viewers also liked (14)

PDF
Uwa annual report_2007
PPTX
PPT
Careers in law_libraries
PPTX
SR&ED
XLS
Multi office 200 cards per year
PPT
Share pointmysites gs_e
PPS
Philosophy for Old Age
PPT
Kosanostra Present
PPTX
Marketing
PPT
Kosanostra presentacion
PPTX
Subversion
PPS
Philosophy for Old Age
DOCX
Apam 1
PPT
Duct Style Air Heaters
Uwa annual report_2007
Careers in law_libraries
SR&ED
Multi office 200 cards per year
Share pointmysites gs_e
Philosophy for Old Age
Kosanostra Present
Marketing
Kosanostra presentacion
Subversion
Philosophy for Old Age
Apam 1
Duct Style Air Heaters
Ad

Similar to ActionEmbedding (20)

PPTX
Technology Stack Discussion
PPT
St Hilaire Ajax Start Odtug Nov 2009
PPTX
Challenges of angular in production (Tasos Bekos) - GreeceJS #17
PPT
Ruby On Rails Siddhesh
PPTX
Onion Architecture with S#arp
PDF
Front-end optimisation & jQuery Internals (Pycon)
PPT
Introduction To JBoss Seam 2.1
PPT
CAF & Portlet Development Notes
ODP
DiUS Computing Lca Rails Final
PDF
Front-end optimisation & jQuery Internals
PPT
T2 Web Framework
PDF
Angular (v2 and up) - Morning to understand - Linagora
PPTX
Apache phoenix
ODP
Introduction to Seam Applications
ODP
Introduction to seam_applications_formated
ODP
Introduction to seam_applications_formated
PPTX
Modern Frontend Technology
PPTX
java web framework standard.20180412
PDF
Lit there be light
PPTX
Where is my scalable api?
Technology Stack Discussion
St Hilaire Ajax Start Odtug Nov 2009
Challenges of angular in production (Tasos Bekos) - GreeceJS #17
Ruby On Rails Siddhesh
Onion Architecture with S#arp
Front-end optimisation & jQuery Internals (Pycon)
Introduction To JBoss Seam 2.1
CAF & Portlet Development Notes
DiUS Computing Lca Rails Final
Front-end optimisation & jQuery Internals
T2 Web Framework
Angular (v2 and up) - Morning to understand - Linagora
Apache phoenix
Introduction to Seam Applications
Introduction to seam_applications_formated
Introduction to seam_applications_formated
Modern Frontend Technology
java web framework standard.20180412
Lit there be light
Where is my scalable api?

Recently uploaded (20)

PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
sap open course for s4hana steps from ECC to s4
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Spectroscopy.pptx food analysis technology
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
cuic standard and advanced reporting.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
MIND Revenue Release Quarter 2 2025 Press Release
“AI and Expert System Decision Support & Business Intelligence Systems”
Mobile App Security Testing_ A Comprehensive Guide.pdf
sap open course for s4hana steps from ECC to s4
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Unlocking AI with Model Context Protocol (MCP)
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
The Rise and Fall of 3GPP – Time for a Sabbatical?
Spectroscopy.pptx food analysis technology
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Building Integrated photovoltaic BIPV_UPV.pdf
20250228 LYD VKU AI Blended-Learning.pptx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
cuic standard and advanced reporting.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Advanced methodologies resolving dimensionality complications for autism neur...
MIND Revenue Release Quarter 2 2025 Press Release

ActionEmbedding

  • 1. ActionEmbedding Phil Cowans - LRUG, July 2010
  • 3.  
  • 4. Characteristics Of Pagelets Substantial content. Independence from the containing page. Potential to be handled by a back-end service. Can typically be cached. Localisation.
  • 5. Why Think About Pages This Way? Helps define a ubiquitous language. Clean code: separation of responsibilities. Code reuse. Scalability.
  • 6. Existing Tools / Patterns / Work Rails: ActionController::Components in early versions of Rails - dropped for performance reasons. Cells - plugin implementing similar functionality. Embedded Actions - another plugin. Elsewhere: Kohana - PHP framework based on Hierarchical Model-View-Controller (HMVC) pattern. Facebook BigPipe framework - Javascript tricks to get as much of the page to render as quickly as possible. 
  • 7. Why Start Again? An excuse to dig around inside of Rails. Experiment with various techniques for composing content. Make it easy for pagelet infrastructure to grow with the application: Easy to start using pagelets without complex infrastructure. Confidence that it will be possible to swap in more sophisticated embedding mechanisms without a rewrite. A couple of niggles with existing work: Wanted to reuse ActionController::Base for pagelets, rather than defining a new class. Use paths/URLs internally rather than controller/action/params.
  • 8. HMVC Pagelet render handled by secondary internal request. Secondary request handled by standard Rails Controller / View (you can hit it directly if you want).
  • 9. Request Forwarding Primary application forwards request to back end server Separate tier scales independently. Useful tricks: time out slow back end requests, silently drop pagelet on exception, easy killswitch for feature if necessary.  Use appropriate mix of technologies - back end doesn't need to use same framework as front end, e.g. Sinatra for simple things.
  • 10. Edge Side Includes Page composition handled by a proxy server. Works with proxies which support Edge Side Includes (e.g. Varnish)
  • 11. XHR Composition Pagelets are loaded via secondary XHR requests in JavaScript.
  • 12. Other Options (not yet implemented) Parallel execution. Potential to scale out for latency. BigPipe style composition.
  • 13. Internals HMVC requests use Rack internally. Easy on Rails 2.3, as routing and controller speak Rack natively - can just inject request into later parts of standard processing pipeline. Rails 2.2 support (needed for SK) - backport bits of 2.3 to push Rack requests into controller.
  • 14. Practical Experience Songkick activity feeds use ActionEmbedding / HMVC since Thursday. Measurable but relatively insignificant overhead - still room for improvement. Stable so far...
  • 15. Issues / Todos Try XHR embedding in production. Better exception handling (right now you get the error embedded in the pagelet - should interpret response code). Consistent approach to constructing nested requests: Headers Access to cookies Security / access control. Investigate patterns for configuring pagelets.