SlideShare a Scribd company logo
1 of 71
Download to read offline
When dynamic becomes static 
(the next step in web caching techniques) 
Wim Godden 
Cu.be Solutions 
@wimgtr
Who am I ? 
Wim Godden (@wimgtr) 
Founder of Cu.be Solutions (http://cu.be) 
Open Source developer since 1997 
Developer of OpenX, PHPCompatibility, PHPConsistent, ... 
Speaker at Open Source conferences
Who are you ? 
Developers ? 
System/network engineers ? 
Managers ?
Quick note 
Whenever you see 
feel free to think
To understand the present 
Understand the past
The Stone Age 
New blog post by : caveman003
Pre-dynamic : draw it and make html
The Egyptian Era
Old-school dynamic : 'rebuild-every-time'
The Industrial Revolution
Dynamic : let's cache
Dynamic : let's cache
Dynamic : let's cache
Extra ! Extra !
Dynamic content in static content
Dynamic content in static content
Dynamic content in static content
The Modern Era
More load, more webservers
More load, more webservers
More load, more webservers
More load, more webservers
More load, more webservers
More load, more webservers
More load, more webservers
Pushing updates to cache
Today
Adding reverse proxy caching
Adding reverse proxy caching
Typical website structure 
Header 
Latest news 
Article content page 
Page content 
Navigation
Caching blocks with individual TTLs 
Top header 
(cache for 2h) 
Latest news 
Article content page 
Page content 
Navigation 
(cache for 1h)
Caching blocks with individual cache duration 
Top header 
(cache for 2h) 
Latest news (cache for 2m) 
Article content page 
Page content (cache for 30m) 
Navigation 
(cache for 1h)
ESI – how it works 
GET /page GET /page
ESI – how it works 
GET /page GET /page 
<html> 
... 
<esi:include src="/top"/> 
<esi:include src="/nav"/> 
<div id=”something”> 
<esi:include src="/latest-news"/> 
</div> 
<esi:include src="/article/id/732"/> 
... 
</html>
ESI – how it works 
GET /top 
<div id=”top-part”> 
<a href=”/login”>Login</a> 
</div>
ESI – how it works 
GET /page GET /page 
<html> 
... 
<esi:include src="/top"/> 
<esi:include src="/nav"/> 
<div id=”something”> 
<esi:include src="/latest-news"/> 
</div> 
<esi:include src="/article/id/732"/> 
... 
</html>
ESI – how it works 
GET /page GET /page 
<html> 
... 
<div id=”top-part”> 
<a href=”/login”>Login</a> 
</div> 
<esi:include src="/nav"/> 
<div id=”something”> 
<esi:include src="/latest-news"/> 
</div> 
<esi:include src="/article/id/732"/> 
... 
</html>
Varnish - what can/can't be cached ? 
Can : 
Static pages 
Images, js, css 
Static parts of pages that don't change often (ESI) 
Can't : 
POST requests 
Very large files (it's not a file server !) 
Requests with Set-Cookie 
User-specific content
ESI → no caching on user-specific content ? 
Logged in as : Wim Godden 
5 messages 
cache for cache for 5min 
1h 
cache for 0s ?
Error... does not compute !
Back in 2010
Avoid hitting the backend 
GET /page 
DB
No more backend 
GET /page 
+ SLIC
Requesting /page (1st time) 
Nginx 
Shared memory 
1 
2 
3 
4 
/page 
/page
Requesting /page SLIC subrequests (1st time) 
Nginx 
1 
2 
3 
/menu 
/news 
/top (with session cookie) 
/menu 
/news 
/top (in SLIC session)
Requesting /page (next time) 
Nginx 
Shared memory 1 
2 
/page 
/page 
/menu 
/news 
/top (in SLIC session)
SLIC on Nginx 
<slic:include key="top" src="/top" session="true" /> 
<slic:include key="news" src="/news" /> 
<slic:include 
key="menu" 
src="/menu" /> 
Logged in as : Wim Godden 
5 messages ???
New message is sent... 
POST /send 
DB 
insert into... 
set(...) 
top (in SLIC session)
Advantages 
No repeated GET hits to webserver anymore ! 
At login : POST → warm up the cache ! 
No repeated hits for user-specific content 
Not even for non-specific content
News added 
addnews() method 
DB 
insert into... 
set(...) 
Memcache key /news
First release : ESI 
Part of the ESI 1.0 spec 
Only relevant features implemented 
Extension for dynamic session support 
But : unavailable for copyright reasons
Rebuilt from scratch : SLIC 
Control structures : if/else, switch/case, foreach 
Variable handling 
Strings : concatenation, substring, … 
Exception handling, header manipulation, … 
JSON support !
SLIC code samples 
You are logged in as : <slic:session_var("person_name") />
SLIC code samples 
<slic:switch var="session_var('isAdmin')"> 
<slic:case value="1"> 
<slic:include key="admin-buttons" src="/admin-buttons.php" /> 
</slic:case> 
<slic:default> 
<div id="just-a-user"> 
<slic:include key="user-buttons" src="/user-buttons.php" /> 
</div> 
</slic:default> 
</slic:switch>
SLIC code samples 
<slic:foreach item="messageId" src="global_var('thread' + query_var('threadId'))"> 
<slic:include key="'thread-message_' + messageId" 
src="'/thread/message.php?id=' + messageId" /> 
</slic:foreach>
Approaches – full block 
<p id=”LoggedInAs”> 
You are logged in as : Wim Godden 
</p> 
<p id=”MessageCount”> 
You have 5 messages 
</p> 
Logged in as : Wim Godden 
5 messages 
<slic:include key="top" src="/top" session="true" /> 
top_432
Approaches – individual variables 
Logged in as : Wim Godden 
<p id=”LoggedInAs”> 
You are logged in as : <slic:session_var("person_name") /> 
</p> 
<p id=”MessageCount”> 
You have <slic:session_var(“messages”) /> messages 
</p> 
5 messages 
<slic:include key="top" src="/top" session="true" />
Approaches – JSON 
Logged in as : Wim Godden 
5 messages 
<slic:include key="top" src="/top" session="true" /> 
<p id=”LoggedInAs”> 
You are logged in as : <slic:session_var("userData").person_name /> 
</p> 
<p id=”MessageCount”> 
You have <slic:session_var(“userData”).message_count /> messages 
</p>
Identifying the user 
In Nginx configuration : 
slic_session_cookie <name> → Defined by language (or configurable) 
slic_session_identifier <string> → Defined by you 
Example for PHP : 
slic_session_cookie PHPSESSID 
slic_session_identifier UserID
Identifying the user 
Cookie : 
PHPSESSID = 
jpsidc1po35sq9q3og4f3hi6e2 
Nginx + SLIC 
4g3e2t UserID_jpsidc1po35sq9q3og4f3hi6e2
Retrieving user specific content 
Nginx + SLIC 
get userData_432 
Cookie : 
PHPSESSID = 
jpsidc1po35sq9q3og4f3hi6e2
What's the result ?
Figures 
2nd customer : 
No. of web servers : 72 → 8 
No. of db servers : 15 → 4 
Total : 87 → 12 (86% reduction !) 
Last customer : 
No. of total servers : +/- 1350 
Expected reduction : 1350 → 380 
Expected savings : €1.5 Million per year
Why is it so much faster ?
Code changes 
Required 
Template conversion 
Push-to-DB → Push-to-DB + Push-to-Cache 
Choice : 
If user is logged in → push updates to cache 
If user is not logged in → warm up cache on login
Availability 
Good news : 
The concept is solid : ESI version stable at 4 customers 
Open Source 
Bad news : 
First customer holds copyrights 
Total rebuild 
Q2 2015 : v0.1 (include, variable handling, …) 
Final release : Q3 2015 
Site : http://slic.cu.be 
Code : Github
Some technical details 
Written in Lua (with LuaJIT) 
Each SLIC:include is a subrequest 
Groups cache key requests together for multiget 
Shares cache results across all subrequests 
Memcached implemented 
Redis and others in the pipeline 
Not RFC compliant yet 
Unit tested 
Future (1.0 or beyond) : 
Better cache abstraction 
Template compilation 
Translation functionality 
...
So...
Questions ?
Questions ?
Thanks ! 
@wimgtr 
wim@cu.be

More Related Content

What's hot

AtlasCamp 2014: Writing Connect Add-ons for Confluence
AtlasCamp 2014: Writing Connect Add-ons for ConfluenceAtlasCamp 2014: Writing Connect Add-ons for Confluence
AtlasCamp 2014: Writing Connect Add-ons for ConfluenceAtlassian
 
In-browser storage and me
In-browser storage and meIn-browser storage and me
In-browser storage and meJason Casden
 
Up and Running with WordPress - Site Shack Nashville Web Design
Up and Running with WordPress - Site Shack Nashville Web DesignUp and Running with WordPress - Site Shack Nashville Web Design
Up and Running with WordPress - Site Shack Nashville Web DesignJudy Wilson
 
Christmas Trees Made with HTML CSS and JS
Christmas Trees Made with HTML CSS and JSChristmas Trees Made with HTML CSS and JS
Christmas Trees Made with HTML CSS and JSNiamh Foley
 
Incremental DOM and Recent Trend of Frontend Development
Incremental DOM and Recent Trend of Frontend DevelopmentIncremental DOM and Recent Trend of Frontend Development
Incremental DOM and Recent Trend of Frontend DevelopmentAkihiro Ikezoe
 
HTTP 2.0 - Web Unleashed 2015
HTTP 2.0 - Web Unleashed 2015HTTP 2.0 - Web Unleashed 2015
HTTP 2.0 - Web Unleashed 2015dmethvin
 
HTML / CSS / JS Web basics
HTML / CSS / JS Web basicsHTML / CSS / JS Web basics
HTML / CSS / JS Web basicsbtopro
 
Real World Caching with Ruby on Rails
Real World Caching with Ruby on RailsReal World Caching with Ruby on Rails
Real World Caching with Ruby on RailsDavid Roberts
 
Going on an HTTP Diet: Front-End Web Performance
Going on an HTTP Diet: Front-End Web PerformanceGoing on an HTTP Diet: Front-End Web Performance
Going on an HTTP Diet: Front-End Web PerformanceAdam Norwood
 
The Complementarity of React and Web Components
The Complementarity of React and Web ComponentsThe Complementarity of React and Web Components
The Complementarity of React and Web ComponentsAndrew Rota
 
Cache Rules Everything Around Me
Cache Rules Everything Around MeCache Rules Everything Around Me
Cache Rules Everything Around MeRussell Heimlich
 
Front end performance tip
Front end performance tipFront end performance tip
Front end performance tipSteve Yu
 
Front end performance optimization
Front end performance optimizationFront end performance optimization
Front end performance optimizationStevie T
 
Data presentation with dust js technologies backing linkedin
Data presentation with dust js   technologies backing linkedinData presentation with dust js   technologies backing linkedin
Data presentation with dust js technologies backing linkedinRuhaim Izmeth
 
Harder, Better, Faster, Stronger
Harder, Better, Faster, StrongerHarder, Better, Faster, Stronger
Harder, Better, Faster, StrongerDavid Engel
 
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892Deepak Sharma
 
Learning jQuery @ MIT
Learning jQuery @ MITLearning jQuery @ MIT
Learning jQuery @ MITjeresig
 

What's hot (19)

AtlasCamp 2014: Writing Connect Add-ons for Confluence
AtlasCamp 2014: Writing Connect Add-ons for ConfluenceAtlasCamp 2014: Writing Connect Add-ons for Confluence
AtlasCamp 2014: Writing Connect Add-ons for Confluence
 
In-browser storage and me
In-browser storage and meIn-browser storage and me
In-browser storage and me
 
Up and Running with WordPress - Site Shack Nashville Web Design
Up and Running with WordPress - Site Shack Nashville Web DesignUp and Running with WordPress - Site Shack Nashville Web Design
Up and Running with WordPress - Site Shack Nashville Web Design
 
Christmas Trees Made with HTML CSS and JS
Christmas Trees Made with HTML CSS and JSChristmas Trees Made with HTML CSS and JS
Christmas Trees Made with HTML CSS and JS
 
Nanoc
NanocNanoc
Nanoc
 
Incremental DOM and Recent Trend of Frontend Development
Incremental DOM and Recent Trend of Frontend DevelopmentIncremental DOM and Recent Trend of Frontend Development
Incremental DOM and Recent Trend of Frontend Development
 
HTTP 2.0 - Web Unleashed 2015
HTTP 2.0 - Web Unleashed 2015HTTP 2.0 - Web Unleashed 2015
HTTP 2.0 - Web Unleashed 2015
 
HTML / CSS / JS Web basics
HTML / CSS / JS Web basicsHTML / CSS / JS Web basics
HTML / CSS / JS Web basics
 
Real World Caching with Ruby on Rails
Real World Caching with Ruby on RailsReal World Caching with Ruby on Rails
Real World Caching with Ruby on Rails
 
Going on an HTTP Diet: Front-End Web Performance
Going on an HTTP Diet: Front-End Web PerformanceGoing on an HTTP Diet: Front-End Web Performance
Going on an HTTP Diet: Front-End Web Performance
 
The Complementarity of React and Web Components
The Complementarity of React and Web ComponentsThe Complementarity of React and Web Components
The Complementarity of React and Web Components
 
Cache Rules Everything Around Me
Cache Rules Everything Around MeCache Rules Everything Around Me
Cache Rules Everything Around Me
 
Front end performance tip
Front end performance tipFront end performance tip
Front end performance tip
 
Front end performance optimization
Front end performance optimizationFront end performance optimization
Front end performance optimization
 
Data presentation with dust js technologies backing linkedin
Data presentation with dust js   technologies backing linkedinData presentation with dust js   technologies backing linkedin
Data presentation with dust js technologies backing linkedin
 
Front End Performance
Front End PerformanceFront End Performance
Front End Performance
 
Harder, Better, Faster, Stronger
Harder, Better, Faster, StrongerHarder, Better, Faster, Stronger
Harder, Better, Faster, Stronger
 
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
 
Learning jQuery @ MIT
Learning jQuery @ MITLearning jQuery @ MIT
Learning jQuery @ MIT
 

Viewers also liked

3 Ways to Automate App Deployments with NGINX
3 Ways to Automate App Deployments with NGINX3 Ways to Automate App Deployments with NGINX
3 Ways to Automate App Deployments with NGINXNGINX, Inc.
 
What's new in NGINX Plus R9
What's new in NGINX Plus R9What's new in NGINX Plus R9
What's new in NGINX Plus R9NGINX, Inc.
 
NGINX for Application Delivery & Acceleration
NGINX for Application Delivery & AccelerationNGINX for Application Delivery & Acceleration
NGINX for Application Delivery & AccelerationNGINX, Inc.
 
Reduce IT Spend with Software Load Balancing
Reduce IT Spend with Software Load BalancingReduce IT Spend with Software Load Balancing
Reduce IT Spend with Software Load BalancingNGINX, Inc.
 
Improve App Performance & Reliability with NGINX Amplify
Improve App Performance & Reliability with NGINX AmplifyImprove App Performance & Reliability with NGINX Amplify
Improve App Performance & Reliability with NGINX AmplifyNGINX, Inc.
 
Deploying NGINX Plus with Ansible
Deploying NGINX Plus with AnsibleDeploying NGINX Plus with Ansible
Deploying NGINX Plus with AnsibleKevin Jones
 
Content Caching with NGINX and NGINX Plus
Content Caching with NGINX and NGINX PlusContent Caching with NGINX and NGINX Plus
Content Caching with NGINX and NGINX PlusKevin Jones
 
Microservices and Container Management with NGINX Plus and Mesosphere DC/OS
Microservices and Container Management with NGINX Plus and Mesosphere DC/OSMicroservices and Container Management with NGINX Plus and Mesosphere DC/OS
Microservices and Container Management with NGINX Plus and Mesosphere DC/OSNGINX, Inc.
 
Benchmarking NGINX for Accuracy and Results
Benchmarking NGINX for Accuracy and ResultsBenchmarking NGINX for Accuracy and Results
Benchmarking NGINX for Accuracy and ResultsNGINX, Inc.
 
Secure Your Apps with NGINX Plus and the ModSecurity WAF
Secure Your Apps with NGINX Plus and the ModSecurity WAFSecure Your Apps with NGINX Plus and the ModSecurity WAF
Secure Your Apps with NGINX Plus and the ModSecurity WAFNGINX, Inc.
 
NGINX Amplify: Monitoring NGINX with Advanced Filters and Custom Dashboards
NGINX Amplify: Monitoring NGINX with Advanced Filters and Custom DashboardsNGINX Amplify: Monitoring NGINX with Advanced Filters and Custom Dashboards
NGINX Amplify: Monitoring NGINX with Advanced Filters and Custom DashboardsNGINX, Inc.
 
What's New in NGINX Plus R10?
What's New in NGINX Plus R10?What's New in NGINX Plus R10?
What's New in NGINX Plus R10?NGINX, Inc.
 
Deploying NGINX Plus & Kubernetes on Google Cloud Platform
Deploying NGINX Plus & Kubernetes on Google Cloud PlatformDeploying NGINX Plus & Kubernetes on Google Cloud Platform
Deploying NGINX Plus & Kubernetes on Google Cloud PlatformNGINX, Inc.
 
Monitoring Highly Dynamic and Distributed Systems with NGINX Amplify
Monitoring Highly Dynamic and Distributed Systems with NGINX AmplifyMonitoring Highly Dynamic and Distributed Systems with NGINX Amplify
Monitoring Highly Dynamic and Distributed Systems with NGINX AmplifyNGINX, Inc.
 
How to Adopt Infrastructure as Code
How to Adopt Infrastructure as CodeHow to Adopt Infrastructure as Code
How to Adopt Infrastructure as CodeNGINX, Inc.
 
10 Key Steps for Moving from Legacy Infrastructure to the Cloud
10 Key Steps for Moving from Legacy Infrastructure to the Cloud10 Key Steps for Moving from Legacy Infrastructure to the Cloud
10 Key Steps for Moving from Legacy Infrastructure to the CloudNGINX, Inc.
 
Load Balancing and Scaling with NGINX
Load Balancing and Scaling with NGINXLoad Balancing and Scaling with NGINX
Load Balancing and Scaling with NGINXNGINX, Inc.
 
The 3 Models in the NGINX Microservices Reference Architecture
The 3 Models in the NGINX Microservices Reference ArchitectureThe 3 Models in the NGINX Microservices Reference Architecture
The 3 Models in the NGINX Microservices Reference ArchitectureNGINX, Inc.
 
NGINX Microservices Reference Architecture: Ask Me Anything
NGINX Microservices Reference Architecture: Ask Me AnythingNGINX Microservices Reference Architecture: Ask Me Anything
NGINX Microservices Reference Architecture: Ask Me AnythingNGINX, Inc.
 
NGINX High-performance Caching
NGINX High-performance CachingNGINX High-performance Caching
NGINX High-performance CachingNGINX, Inc.
 

Viewers also liked (20)

3 Ways to Automate App Deployments with NGINX
3 Ways to Automate App Deployments with NGINX3 Ways to Automate App Deployments with NGINX
3 Ways to Automate App Deployments with NGINX
 
What's new in NGINX Plus R9
What's new in NGINX Plus R9What's new in NGINX Plus R9
What's new in NGINX Plus R9
 
NGINX for Application Delivery & Acceleration
NGINX for Application Delivery & AccelerationNGINX for Application Delivery & Acceleration
NGINX for Application Delivery & Acceleration
 
Reduce IT Spend with Software Load Balancing
Reduce IT Spend with Software Load BalancingReduce IT Spend with Software Load Balancing
Reduce IT Spend with Software Load Balancing
 
Improve App Performance & Reliability with NGINX Amplify
Improve App Performance & Reliability with NGINX AmplifyImprove App Performance & Reliability with NGINX Amplify
Improve App Performance & Reliability with NGINX Amplify
 
Deploying NGINX Plus with Ansible
Deploying NGINX Plus with AnsibleDeploying NGINX Plus with Ansible
Deploying NGINX Plus with Ansible
 
Content Caching with NGINX and NGINX Plus
Content Caching with NGINX and NGINX PlusContent Caching with NGINX and NGINX Plus
Content Caching with NGINX and NGINX Plus
 
Microservices and Container Management with NGINX Plus and Mesosphere DC/OS
Microservices and Container Management with NGINX Plus and Mesosphere DC/OSMicroservices and Container Management with NGINX Plus and Mesosphere DC/OS
Microservices and Container Management with NGINX Plus and Mesosphere DC/OS
 
Benchmarking NGINX for Accuracy and Results
Benchmarking NGINX for Accuracy and ResultsBenchmarking NGINX for Accuracy and Results
Benchmarking NGINX for Accuracy and Results
 
Secure Your Apps with NGINX Plus and the ModSecurity WAF
Secure Your Apps with NGINX Plus and the ModSecurity WAFSecure Your Apps with NGINX Plus and the ModSecurity WAF
Secure Your Apps with NGINX Plus and the ModSecurity WAF
 
NGINX Amplify: Monitoring NGINX with Advanced Filters and Custom Dashboards
NGINX Amplify: Monitoring NGINX with Advanced Filters and Custom DashboardsNGINX Amplify: Monitoring NGINX with Advanced Filters and Custom Dashboards
NGINX Amplify: Monitoring NGINX with Advanced Filters and Custom Dashboards
 
What's New in NGINX Plus R10?
What's New in NGINX Plus R10?What's New in NGINX Plus R10?
What's New in NGINX Plus R10?
 
Deploying NGINX Plus & Kubernetes on Google Cloud Platform
Deploying NGINX Plus & Kubernetes on Google Cloud PlatformDeploying NGINX Plus & Kubernetes on Google Cloud Platform
Deploying NGINX Plus & Kubernetes on Google Cloud Platform
 
Monitoring Highly Dynamic and Distributed Systems with NGINX Amplify
Monitoring Highly Dynamic and Distributed Systems with NGINX AmplifyMonitoring Highly Dynamic and Distributed Systems with NGINX Amplify
Monitoring Highly Dynamic and Distributed Systems with NGINX Amplify
 
How to Adopt Infrastructure as Code
How to Adopt Infrastructure as CodeHow to Adopt Infrastructure as Code
How to Adopt Infrastructure as Code
 
10 Key Steps for Moving from Legacy Infrastructure to the Cloud
10 Key Steps for Moving from Legacy Infrastructure to the Cloud10 Key Steps for Moving from Legacy Infrastructure to the Cloud
10 Key Steps for Moving from Legacy Infrastructure to the Cloud
 
Load Balancing and Scaling with NGINX
Load Balancing and Scaling with NGINXLoad Balancing and Scaling with NGINX
Load Balancing and Scaling with NGINX
 
The 3 Models in the NGINX Microservices Reference Architecture
The 3 Models in the NGINX Microservices Reference ArchitectureThe 3 Models in the NGINX Microservices Reference Architecture
The 3 Models in the NGINX Microservices Reference Architecture
 
NGINX Microservices Reference Architecture: Ask Me Anything
NGINX Microservices Reference Architecture: Ask Me AnythingNGINX Microservices Reference Architecture: Ask Me Anything
NGINX Microservices Reference Architecture: Ask Me Anything
 
NGINX High-performance Caching
NGINX High-performance CachingNGINX High-performance Caching
NGINX High-performance Caching
 

Similar to When dynamic becomes static - the next step in web caching techniques

When dynamic becomes static
When dynamic becomes staticWhen dynamic becomes static
When dynamic becomes staticWim Godden
 
When dynamic becomes static: the next step in web caching techniques
When dynamic becomes static: the next step in web caching techniquesWhen dynamic becomes static: the next step in web caching techniques
When dynamic becomes static: the next step in web caching techniquesWim Godden
 
When dynamic becomes static
When dynamic becomes staticWhen dynamic becomes static
When dynamic becomes staticWim Godden
 
When dynamic becomes static: the next step in web caching techniques
When dynamic becomes static: the next step in web caching techniquesWhen dynamic becomes static: the next step in web caching techniques
When dynamic becomes static: the next step in web caching techniquesWim Godden
 
Remove php calls and scale your site like crazy !
Remove php calls and scale your site like crazy !Remove php calls and scale your site like crazy !
Remove php calls and scale your site like crazy !Wim Godden
 
When dynamic becomes static: the next step in web caching techniques
When dynamic becomes static: the next step in web caching techniquesWhen dynamic becomes static: the next step in web caching techniques
When dynamic becomes static: the next step in web caching techniquesWim Godden
 
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...tdc-globalcode
 
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
AD113  Speed Up Your Applications w/ Nginx and PageSpeedAD113  Speed Up Your Applications w/ Nginx and PageSpeed
AD113 Speed Up Your Applications w/ Nginx and PageSpeededm00se
 
Progressive downloads and rendering (Stoyan Stefanov)
Progressive downloads and rendering (Stoyan Stefanov)Progressive downloads and rendering (Stoyan Stefanov)
Progressive downloads and rendering (Stoyan Stefanov)Ontico
 
Progressive Downloads and Rendering
Progressive Downloads and RenderingProgressive Downloads and Rendering
Progressive Downloads and RenderingStoyan Stefanov
 
Fix me if you can - DrupalCon prague
Fix me if you can - DrupalCon pragueFix me if you can - DrupalCon prague
Fix me if you can - DrupalCon praguehernanibf
 
The Need for Speed - SMX Sydney 2013
The Need for Speed - SMX Sydney 2013The Need for Speed - SMX Sydney 2013
The Need for Speed - SMX Sydney 2013Bastian Grimm
 

Similar to When dynamic becomes static - the next step in web caching techniques (20)

When dynamic becomes static
When dynamic becomes staticWhen dynamic becomes static
When dynamic becomes static
 
When dynamic becomes static: the next step in web caching techniques
When dynamic becomes static: the next step in web caching techniquesWhen dynamic becomes static: the next step in web caching techniques
When dynamic becomes static: the next step in web caching techniques
 
When dynamic becomes static
When dynamic becomes staticWhen dynamic becomes static
When dynamic becomes static
 
When dynamic becomes static: the next step in web caching techniques
When dynamic becomes static: the next step in web caching techniquesWhen dynamic becomes static: the next step in web caching techniques
When dynamic becomes static: the next step in web caching techniques
 
Remove php calls and scale your site like crazy !
Remove php calls and scale your site like crazy !Remove php calls and scale your site like crazy !
Remove php calls and scale your site like crazy !
 
When dynamic becomes static: the next step in web caching techniques
When dynamic becomes static: the next step in web caching techniquesWhen dynamic becomes static: the next step in web caching techniques
When dynamic becomes static: the next step in web caching techniques
 
Please dont touch-3.6-jsday
Please dont touch-3.6-jsdayPlease dont touch-3.6-jsday
Please dont touch-3.6-jsday
 
Introduccion a HTML5
Introduccion a HTML5Introduccion a HTML5
Introduccion a HTML5
 
html5
html5html5
html5
 
Presentation Tier optimizations
Presentation Tier optimizationsPresentation Tier optimizations
Presentation Tier optimizations
 
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
 
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
AD113  Speed Up Your Applications w/ Nginx and PageSpeedAD113  Speed Up Your Applications w/ Nginx and PageSpeed
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
 
Html5 & less css
Html5 & less cssHtml5 & less css
Html5 & less css
 
Progressive downloads and rendering (Stoyan Stefanov)
Progressive downloads and rendering (Stoyan Stefanov)Progressive downloads and rendering (Stoyan Stefanov)
Progressive downloads and rendering (Stoyan Stefanov)
 
Progressive Downloads and Rendering
Progressive Downloads and RenderingProgressive Downloads and Rendering
Progressive Downloads and Rendering
 
Fix me if you can - DrupalCon prague
Fix me if you can - DrupalCon pragueFix me if you can - DrupalCon prague
Fix me if you can - DrupalCon prague
 
Web-Performance
Web-PerformanceWeb-Performance
Web-Performance
 
Optimizing wp
Optimizing wpOptimizing wp
Optimizing wp
 
The Need for Speed - SMX Sydney 2013
The Need for Speed - SMX Sydney 2013The Need for Speed - SMX Sydney 2013
The Need for Speed - SMX Sydney 2013
 
Webpack
Webpack Webpack
Webpack
 

More from Wim Godden

Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeWim Godden
 
Bringing bright ideas to life
Bringing bright ideas to lifeBringing bright ideas to life
Bringing bright ideas to lifeWim Godden
 
The why and how of moving to php 8
The why and how of moving to php 8The why and how of moving to php 8
The why and how of moving to php 8Wim Godden
 
The why and how of moving to php 7
The why and how of moving to php 7The why and how of moving to php 7
The why and how of moving to php 7Wim Godden
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I thinkWim Godden
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I thinkWim Godden
 
Building interactivity with websockets
Building interactivity with websocketsBuilding interactivity with websockets
Building interactivity with websocketsWim Godden
 
Bringing bright ideas to life
Bringing bright ideas to lifeBringing bright ideas to life
Bringing bright ideas to lifeWim Godden
 
Your app lives on the network - networking for web developers
Your app lives on the network - networking for web developersYour app lives on the network - networking for web developers
Your app lives on the network - networking for web developersWim Godden
 
The why and how of moving to php 7.x
The why and how of moving to php 7.xThe why and how of moving to php 7.x
The why and how of moving to php 7.xWim Godden
 
The why and how of moving to php 7.x
The why and how of moving to php 7.xThe why and how of moving to php 7.x
The why and how of moving to php 7.xWim Godden
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeWim Godden
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I thinkWim Godden
 
Building interactivity with websockets
Building interactivity with websocketsBuilding interactivity with websockets
Building interactivity with websocketsWim Godden
 
Your app lives on the network - networking for web developers
Your app lives on the network - networking for web developersYour app lives on the network - networking for web developers
Your app lives on the network - networking for web developersWim Godden
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I thinkWim Godden
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I thinkWim Godden
 
The promise of asynchronous php
The promise of asynchronous phpThe promise of asynchronous php
The promise of asynchronous phpWim Godden
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I thinkWim Godden
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I thinkWim Godden
 

More from Wim Godden (20)

Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
 
Bringing bright ideas to life
Bringing bright ideas to lifeBringing bright ideas to life
Bringing bright ideas to life
 
The why and how of moving to php 8
The why and how of moving to php 8The why and how of moving to php 8
The why and how of moving to php 8
 
The why and how of moving to php 7
The why and how of moving to php 7The why and how of moving to php 7
The why and how of moving to php 7
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I think
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I think
 
Building interactivity with websockets
Building interactivity with websocketsBuilding interactivity with websockets
Building interactivity with websockets
 
Bringing bright ideas to life
Bringing bright ideas to lifeBringing bright ideas to life
Bringing bright ideas to life
 
Your app lives on the network - networking for web developers
Your app lives on the network - networking for web developersYour app lives on the network - networking for web developers
Your app lives on the network - networking for web developers
 
The why and how of moving to php 7.x
The why and how of moving to php 7.xThe why and how of moving to php 7.x
The why and how of moving to php 7.x
 
The why and how of moving to php 7.x
The why and how of moving to php 7.xThe why and how of moving to php 7.x
The why and how of moving to php 7.x
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I think
 
Building interactivity with websockets
Building interactivity with websocketsBuilding interactivity with websockets
Building interactivity with websockets
 
Your app lives on the network - networking for web developers
Your app lives on the network - networking for web developersYour app lives on the network - networking for web developers
Your app lives on the network - networking for web developers
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I think
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I think
 
The promise of asynchronous php
The promise of asynchronous phpThe promise of asynchronous php
The promise of asynchronous php
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I think
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I think
 

Recently uploaded

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 

Recently uploaded (20)

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 

When dynamic becomes static - the next step in web caching techniques

  • 1. When dynamic becomes static (the next step in web caching techniques) Wim Godden Cu.be Solutions @wimgtr
  • 2. Who am I ? Wim Godden (@wimgtr) Founder of Cu.be Solutions (http://cu.be) Open Source developer since 1997 Developer of OpenX, PHPCompatibility, PHPConsistent, ... Speaker at Open Source conferences
  • 3. Who are you ? Developers ? System/network engineers ? Managers ?
  • 4. Quick note Whenever you see feel free to think
  • 5. To understand the present Understand the past
  • 6. The Stone Age New blog post by : caveman003
  • 7. Pre-dynamic : draw it and make html
  • 9. Old-school dynamic : 'rebuild-every-time'
  • 15. Dynamic content in static content
  • 16. Dynamic content in static content
  • 17. Dynamic content in static content
  • 19. More load, more webservers
  • 20. More load, more webservers
  • 21. More load, more webservers
  • 22. More load, more webservers
  • 23. More load, more webservers
  • 24. More load, more webservers
  • 25. More load, more webservers
  • 27. Today
  • 30. Typical website structure Header Latest news Article content page Page content Navigation
  • 31. Caching blocks with individual TTLs Top header (cache for 2h) Latest news Article content page Page content Navigation (cache for 1h)
  • 32. Caching blocks with individual cache duration Top header (cache for 2h) Latest news (cache for 2m) Article content page Page content (cache for 30m) Navigation (cache for 1h)
  • 33. ESI – how it works GET /page GET /page
  • 34. ESI – how it works GET /page GET /page <html> ... <esi:include src="/top"/> <esi:include src="/nav"/> <div id=”something”> <esi:include src="/latest-news"/> </div> <esi:include src="/article/id/732"/> ... </html>
  • 35. ESI – how it works GET /top <div id=”top-part”> <a href=”/login”>Login</a> </div>
  • 36. ESI – how it works GET /page GET /page <html> ... <esi:include src="/top"/> <esi:include src="/nav"/> <div id=”something”> <esi:include src="/latest-news"/> </div> <esi:include src="/article/id/732"/> ... </html>
  • 37. ESI – how it works GET /page GET /page <html> ... <div id=”top-part”> <a href=”/login”>Login</a> </div> <esi:include src="/nav"/> <div id=”something”> <esi:include src="/latest-news"/> </div> <esi:include src="/article/id/732"/> ... </html>
  • 38. Varnish - what can/can't be cached ? Can : Static pages Images, js, css Static parts of pages that don't change often (ESI) Can't : POST requests Very large files (it's not a file server !) Requests with Set-Cookie User-specific content
  • 39. ESI → no caching on user-specific content ? Logged in as : Wim Godden 5 messages cache for cache for 5min 1h cache for 0s ?
  • 40. Error... does not compute !
  • 42. Avoid hitting the backend GET /page DB
  • 43. No more backend GET /page + SLIC
  • 44. Requesting /page (1st time) Nginx Shared memory 1 2 3 4 /page /page
  • 45. Requesting /page SLIC subrequests (1st time) Nginx 1 2 3 /menu /news /top (with session cookie) /menu /news /top (in SLIC session)
  • 46. Requesting /page (next time) Nginx Shared memory 1 2 /page /page /menu /news /top (in SLIC session)
  • 47. SLIC on Nginx <slic:include key="top" src="/top" session="true" /> <slic:include key="news" src="/news" /> <slic:include key="menu" src="/menu" /> Logged in as : Wim Godden 5 messages ???
  • 48. New message is sent... POST /send DB insert into... set(...) top (in SLIC session)
  • 49. Advantages No repeated GET hits to webserver anymore ! At login : POST → warm up the cache ! No repeated hits for user-specific content Not even for non-specific content
  • 50. News added addnews() method DB insert into... set(...) Memcache key /news
  • 51. First release : ESI Part of the ESI 1.0 spec Only relevant features implemented Extension for dynamic session support But : unavailable for copyright reasons
  • 52. Rebuilt from scratch : SLIC Control structures : if/else, switch/case, foreach Variable handling Strings : concatenation, substring, … Exception handling, header manipulation, … JSON support !
  • 53. SLIC code samples You are logged in as : <slic:session_var("person_name") />
  • 54. SLIC code samples <slic:switch var="session_var('isAdmin')"> <slic:case value="1"> <slic:include key="admin-buttons" src="/admin-buttons.php" /> </slic:case> <slic:default> <div id="just-a-user"> <slic:include key="user-buttons" src="/user-buttons.php" /> </div> </slic:default> </slic:switch>
  • 55. SLIC code samples <slic:foreach item="messageId" src="global_var('thread' + query_var('threadId'))"> <slic:include key="'thread-message_' + messageId" src="'/thread/message.php?id=' + messageId" /> </slic:foreach>
  • 56. Approaches – full block <p id=”LoggedInAs”> You are logged in as : Wim Godden </p> <p id=”MessageCount”> You have 5 messages </p> Logged in as : Wim Godden 5 messages <slic:include key="top" src="/top" session="true" /> top_432
  • 57. Approaches – individual variables Logged in as : Wim Godden <p id=”LoggedInAs”> You are logged in as : <slic:session_var("person_name") /> </p> <p id=”MessageCount”> You have <slic:session_var(“messages”) /> messages </p> 5 messages <slic:include key="top" src="/top" session="true" />
  • 58. Approaches – JSON Logged in as : Wim Godden 5 messages <slic:include key="top" src="/top" session="true" /> <p id=”LoggedInAs”> You are logged in as : <slic:session_var("userData").person_name /> </p> <p id=”MessageCount”> You have <slic:session_var(“userData”).message_count /> messages </p>
  • 59. Identifying the user In Nginx configuration : slic_session_cookie <name> → Defined by language (or configurable) slic_session_identifier <string> → Defined by you Example for PHP : slic_session_cookie PHPSESSID slic_session_identifier UserID
  • 60. Identifying the user Cookie : PHPSESSID = jpsidc1po35sq9q3og4f3hi6e2 Nginx + SLIC 4g3e2t UserID_jpsidc1po35sq9q3og4f3hi6e2
  • 61. Retrieving user specific content Nginx + SLIC get userData_432 Cookie : PHPSESSID = jpsidc1po35sq9q3og4f3hi6e2
  • 63. Figures 2nd customer : No. of web servers : 72 → 8 No. of db servers : 15 → 4 Total : 87 → 12 (86% reduction !) Last customer : No. of total servers : +/- 1350 Expected reduction : 1350 → 380 Expected savings : €1.5 Million per year
  • 64. Why is it so much faster ?
  • 65. Code changes Required Template conversion Push-to-DB → Push-to-DB + Push-to-Cache Choice : If user is logged in → push updates to cache If user is not logged in → warm up cache on login
  • 66. Availability Good news : The concept is solid : ESI version stable at 4 customers Open Source Bad news : First customer holds copyrights Total rebuild Q2 2015 : v0.1 (include, variable handling, …) Final release : Q3 2015 Site : http://slic.cu.be Code : Github
  • 67. Some technical details Written in Lua (with LuaJIT) Each SLIC:include is a subrequest Groups cache key requests together for multiget Shares cache results across all subrequests Memcached implemented Redis and others in the pipeline Not RFC compliant yet Unit tested Future (1.0 or beyond) : Better cache abstraction Template compilation Translation functionality ...
  • 68. So...
  • 71. Thanks ! @wimgtr wim@cu.be