SlideShare ist ein Scribd-Unternehmen logo
1 von 28
REST Services: HTTP caching
“A distributed system is one in which the failure
of a computer you didn’t even know existed can
render your own computer unusable.”
- Leslie Lamport
• REST stands for REpresentational State Transfer
• Representation is just a very simple rendering
of the object
• Has benefits when leverages existing HTTP
protocol
What is REST?
• Up-to-date
• Fresh
• Stale
States of Resource Representation
Up-to-Date state means the Representation is
current according to the origin server
Representation is being sent back with no expiry
and no caching instructions means the client is
allowed to cache for however long or not cache
at all
Up-to-Date State
Fresh State considered as long as the
Representation hasn’t expired at client side,
proxy or browser
Fresh State
• Sending must-revalidate means the client must
revalidate once the representation is Stale
• Stale means it’s gone over it’s expiration date
Stale State
• Doesn’t actually mean do not cache
• Means the client must revalidate both Fresh
and Stale entries and then may use the cached
copy if it’s up to date
No-cache Directive
• In plain English text format
• Starting line: Method URI
HTTP/version
• Headers
• Body
HTTP Message
Request:
GET /wiki HTTP/1.1
Host: wikipedia.org
Accept: text/html
Connection: close
Response:
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Content-Language: en
Content-Length: 1234
Sample HTTP Request/Response
• Get
• Post
• Put
• Delete
• Options
• Head
• Patch
• Trace
• Link
• Unlink
• Connect
Cache-enabled methods are in Red
HTTP Methods
Response:
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 1234
Expires: Fri, 27 Jan 2012 02:33:12 GMT
•Allows only HTTP date
•Good for static resources
•Limited control
HTTP Expires header
• Enough for static content
• For things that rarely change
• Or don’t change at all like Calculator
/Calculator/Multiply?x=2&y=2/Calculator/Multiply?x=2&y=2 ClientClient
Expires is Enough?
• public
• private
• no-cache
• no-store
• max-age=[seconds]
• s-maxage=[seconds]
• must-revalidate
• proxy-revalidate
• no-transform
HTTP Cache-Control directives
Response:
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 1234
Cache-Control: max-age=3600, must-revalidate
HTTP Cache-Control Sample
What if we need to update data?
Cache-Control is Enough for REST
• Optimistic is when we version our data
• And do not have any transactions
• Make use of ETag, If-Match and If-None-
Match headers
Optimistic Locking: ETag
/Orders/Orders ClientClient
GET /Orders HTTP/1.1
HTTP/1.1 200 OK
Etag: 1
[content goes in body]
GET /Orders HTTP/1.1
If-None-Match: 1
HTTP/1.1 304 Not Modified
[no ETag]
[no content returned!]
ETag: GET Not Modified Resource
/Orders/Orders ClientClient
GET /Orders HTTP/1.1
HTTP/1.1 200 OK
Etag: 1
[content goes in body]
GET /Orders HTTP/1.1
If-None-Match: 1
HTTP/1.1 200 OK
Etag: 2
[new content goes in body!]
ETag: GET modified resource
/Orders/Orders ClientClient
HTTP/1.1 200 OK
Etag: 1
[content goes in body]
PUT /Orders HTTP/1.1
If-Match: 1
[new content goes in body]
HTTP/1.1 100 Continue
[no ETag]
[no content!]
GET /Orders HTTP/1.1
ETag: Modify Resource (PUT)
/Orders/Orders ClientClient
HTTP/1.1 200 OK
Etag: 1
[content goes in body]
PUT /Orders HTTP/1.1
If-Match: 1
[new content goes in body]
HTTP/1.1 412 Precondition Failed
[no ETag]
[no content!]
GET /Orders HTTP/1.1
ETag: Modify Changed Resource (PUT)
God damned HTTP!
What we gonna do?
• Override changes!
• Yeah! It’s possible!
• Download the latest version using GET method
• We will know the new Etag then
Etag: mismatch when PUT
/Orders/Orders ClientClient
HTTP/1.1 412 Precondition Failed
[no ETag]
[no content!]
PUT /Orders HTTP/1.1
If-None-Match: 1
[new content goes in body]
HTTP/1.1 100 Continue
[no ETag]
[no content!]
PUT /Orders HTTP/1.1
If-Match: 1
[new content goes in body]
Etag: Override Changes When PUT
• ETag and If-* headers came with HTTP 1.1
• In HTTP 1.0 there are another set of headers:
Last-Modified: Sat, 29 Oct 2011 19:43:31 GMT
If-Modified-Since: Sat, 29 Oct 2011 19:43:31
GMT
Additional HTTP Headers
int Multiply(int x, int y)int Multiply(int x, int y)
HTTPHTTP
IPC (Named Pipes)IPC (Named Pipes)
TCPTCP
ClientClient
TCPTCP
SOAPSOAP
UDPUDP
Web Services: Protocols
POST /search HTTP/1.1
Host: www.domain.com
Content-Type: application/x-www-form-
urlencoded
term=something
HTTP/1.1 303 See Other
Location: /search/something/1
POST-Redirect-GET pattern
Rest services caching
Rest services caching

Weitere ähnliche Inhalte

Was ist angesagt?

Website performance optimization QA
Website performance optimization QAWebsite performance optimization QA
Website performance optimization QADenis Dudaev
 
Rest api design by george reese
Rest api design by george reeseRest api design by george reese
Rest api design by george reesebuildacloud
 
Scale Apache with Nginx
Scale Apache with NginxScale Apache with Nginx
Scale Apache with NginxBud Siddhisena
 
Web Speed And Scalability
Web Speed And ScalabilityWeb Speed And Scalability
Web Speed And ScalabilityJason Ragsdale
 
WordCamp RVA 2011 - Performance & Tuning
WordCamp RVA 2011 - Performance & TuningWordCamp RVA 2011 - Performance & Tuning
WordCamp RVA 2011 - Performance & TuningTimothy Wood
 
How to improve your apache web server’s performance
How to improve your apache web server’s performanceHow to improve your apache web server’s performance
How to improve your apache web server’s performanceAndolasoft Inc
 
High Performance - Joomla!Days NL 2009 #jd09nl
High Performance - Joomla!Days NL 2009 #jd09nlHigh Performance - Joomla!Days NL 2009 #jd09nl
High Performance - Joomla!Days NL 2009 #jd09nlJoomla!Days Netherlands
 
Dynamic Content Acceleration: Amazon CloudFront and Amazon Route 53 (ARC309) ...
Dynamic Content Acceleration: Amazon CloudFront and Amazon Route 53 (ARC309) ...Dynamic Content Acceleration: Amazon CloudFront and Amazon Route 53 (ARC309) ...
Dynamic Content Acceleration: Amazon CloudFront and Amazon Route 53 (ARC309) ...Amazon Web Services
 
NGINX for Application Delivery & Acceleration
NGINX for Application Delivery & AccelerationNGINX for Application Delivery & Acceleration
NGINX for Application Delivery & AccelerationNGINX, Inc.
 
Choosing a Web Architecture for Perl
Choosing a Web Architecture for PerlChoosing a Web Architecture for Perl
Choosing a Web Architecture for PerlPerrin Harkins
 
Skalowalna architektura na przykładzie soccerway.com
Skalowalna architektura na przykładzie soccerway.comSkalowalna architektura na przykładzie soccerway.com
Skalowalna architektura na przykładzie soccerway.comSpodek 2.0
 
Modernizing WordPress Search with Elasticsearch
Modernizing WordPress Search with ElasticsearchModernizing WordPress Search with Elasticsearch
Modernizing WordPress Search with ElasticsearchTaylor Lovett
 
Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)WordCamp Cape Town
 
WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019Anam Ahmed
 
Less and faster – Cache tips for WordPress developers
Less and faster – Cache tips for WordPress developersLess and faster – Cache tips for WordPress developers
Less and faster – Cache tips for WordPress developersSeravo
 

Was ist angesagt? (20)

Website performance optimization QA
Website performance optimization QAWebsite performance optimization QA
Website performance optimization QA
 
Rest api design by george reese
Rest api design by george reeseRest api design by george reese
Rest api design by george reese
 
Caching on the web
Caching on the webCaching on the web
Caching on the web
 
Scale Apache with Nginx
Scale Apache with NginxScale Apache with Nginx
Scale Apache with Nginx
 
Fluent 2012 v2
Fluent 2012   v2Fluent 2012   v2
Fluent 2012 v2
 
RESTful Web Services
RESTful Web ServicesRESTful Web Services
RESTful Web Services
 
Web Speed And Scalability
Web Speed And ScalabilityWeb Speed And Scalability
Web Speed And Scalability
 
WordCamp RVA 2011 - Performance & Tuning
WordCamp RVA 2011 - Performance & TuningWordCamp RVA 2011 - Performance & Tuning
WordCamp RVA 2011 - Performance & Tuning
 
CFML Sessions For Dummies
CFML Sessions For DummiesCFML Sessions For Dummies
CFML Sessions For Dummies
 
Caching 101
Caching 101Caching 101
Caching 101
 
How to improve your apache web server’s performance
How to improve your apache web server’s performanceHow to improve your apache web server’s performance
How to improve your apache web server’s performance
 
High Performance - Joomla!Days NL 2009 #jd09nl
High Performance - Joomla!Days NL 2009 #jd09nlHigh Performance - Joomla!Days NL 2009 #jd09nl
High Performance - Joomla!Days NL 2009 #jd09nl
 
Dynamic Content Acceleration: Amazon CloudFront and Amazon Route 53 (ARC309) ...
Dynamic Content Acceleration: Amazon CloudFront and Amazon Route 53 (ARC309) ...Dynamic Content Acceleration: Amazon CloudFront and Amazon Route 53 (ARC309) ...
Dynamic Content Acceleration: Amazon CloudFront and Amazon Route 53 (ARC309) ...
 
NGINX for Application Delivery & Acceleration
NGINX for Application Delivery & AccelerationNGINX for Application Delivery & Acceleration
NGINX for Application Delivery & Acceleration
 
Choosing a Web Architecture for Perl
Choosing a Web Architecture for PerlChoosing a Web Architecture for Perl
Choosing a Web Architecture for Perl
 
Skalowalna architektura na przykładzie soccerway.com
Skalowalna architektura na przykładzie soccerway.comSkalowalna architektura na przykładzie soccerway.com
Skalowalna architektura na przykładzie soccerway.com
 
Modernizing WordPress Search with Elasticsearch
Modernizing WordPress Search with ElasticsearchModernizing WordPress Search with Elasticsearch
Modernizing WordPress Search with Elasticsearch
 
Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)
 
WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019
 
Less and faster – Cache tips for WordPress developers
Less and faster – Cache tips for WordPress developersLess and faster – Cache tips for WordPress developers
Less and faster – Cache tips for WordPress developers
 

Andere mochten auch

API Caching, why your server needs some rest
API Caching, why your server needs some restAPI Caching, why your server needs some rest
API Caching, why your server needs some restLuis Cipriani
 
Реактивный кэш в Android, Андрей Мельников, Rambler&Co, Москва
 Реактивный кэш в Android, Андрей Мельников, Rambler&Co, Москва  Реактивный кэш в Android, Андрей Мельников, Rambler&Co, Москва
Реактивный кэш в Android, Андрей Мельников, Rambler&Co, Москва it-people
 
HTTP cache @ PUG Rome 03-29-2011
HTTP cache @ PUG Rome 03-29-2011HTTP cache @ PUG Rome 03-29-2011
HTTP cache @ PUG Rome 03-29-2011Alessandro Nadalin
 
ePUB in brief
ePUB in briefePUB in brief
ePUB in briefSean Lee
 
Spring data
Spring dataSpring data
Spring dataSean Lee
 
Cloud foundry practice
Cloud foundry practiceCloud foundry practice
Cloud foundry practiceSean Lee
 
REST and Microservices
REST and MicroservicesREST and Microservices
REST and MicroservicesShaun Abram
 
Fearless HTTP requests abuse
Fearless HTTP requests abuseFearless HTTP requests abuse
Fearless HTTP requests abuseLuis Cipriani
 

Andere mochten auch (9)

API Caching, why your server needs some rest
API Caching, why your server needs some restAPI Caching, why your server needs some rest
API Caching, why your server needs some rest
 
Реактивный кэш в Android, Андрей Мельников, Rambler&Co, Москва
 Реактивный кэш в Android, Андрей Мельников, Rambler&Co, Москва  Реактивный кэш в Android, Андрей Мельников, Rambler&Co, Москва
Реактивный кэш в Android, Андрей Мельников, Rambler&Co, Москва
 
HTTP cache @ PUG Rome 03-29-2011
HTTP cache @ PUG Rome 03-29-2011HTTP cache @ PUG Rome 03-29-2011
HTTP cache @ PUG Rome 03-29-2011
 
ePUB in brief
ePUB in briefePUB in brief
ePUB in brief
 
Spring data
Spring dataSpring data
Spring data
 
Cloud foundry practice
Cloud foundry practiceCloud foundry practice
Cloud foundry practice
 
Caching Strategies
Caching StrategiesCaching Strategies
Caching Strategies
 
REST and Microservices
REST and MicroservicesREST and Microservices
REST and Microservices
 
Fearless HTTP requests abuse
Fearless HTTP requests abuseFearless HTTP requests abuse
Fearless HTTP requests abuse
 

Ähnlich wie Rest services caching

Interactive web. O rly?
Interactive web. O rly?Interactive web. O rly?
Interactive web. O rly?timbc
 
HTTP Request Smuggling
HTTP Request SmugglingHTTP Request Smuggling
HTTP Request SmugglingAkash Ashokan
 
HTTP request and response
HTTP request and responseHTTP request and response
HTTP request and responseSahil Agarwal
 
Http - All you need to know
Http - All you need to knowHttp - All you need to know
Http - All you need to knowGökhan Şengün
 
Rest WebAPI with OData
Rest WebAPI with ODataRest WebAPI with OData
Rest WebAPI with ODataMahek Merchant
 
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0Cory Forsyth
 
REST & RESTful Web Service
REST & RESTful Web ServiceREST & RESTful Web Service
REST & RESTful Web ServiceHoan Vu Tran
 
21 HTTP Protocol #burningkeyboards
21 HTTP Protocol #burningkeyboards21 HTTP Protocol #burningkeyboards
21 HTTP Protocol #burningkeyboardsDenis Ristic
 
Rest webservice ppt
Rest webservice pptRest webservice ppt
Rest webservice pptsinhatanay
 
SFDC Outbound Integrations
SFDC Outbound IntegrationsSFDC Outbound Integrations
SFDC Outbound IntegrationsSujit Kumar
 
REST API Recommendations
REST API RecommendationsREST API Recommendations
REST API RecommendationsJeelani Shaik
 
Understanding the Web through HTTP
Understanding the Web through HTTPUnderstanding the Web through HTTP
Understanding the Web through HTTPOlivia Brundage
 
Java EE 8: What Servlet 4 and HTTP2 Mean
Java EE 8: What Servlet 4 and HTTP2 MeanJava EE 8: What Servlet 4 and HTTP2 Mean
Java EE 8: What Servlet 4 and HTTP2 MeanAlex Theedom
 
restapitest-anil-200517181251.pdf
restapitest-anil-200517181251.pdfrestapitest-anil-200517181251.pdf
restapitest-anil-200517181251.pdfmrle7
 
Rest API Testing
Rest API TestingRest API Testing
Rest API Testingupadhyay_25
 

Ähnlich wie Rest services caching (20)

Interactive web. O rly?
Interactive web. O rly?Interactive web. O rly?
Interactive web. O rly?
 
Http smuggling 1 200523064027
Http smuggling 1 200523064027Http smuggling 1 200523064027
Http smuggling 1 200523064027
 
HTTP Request Smuggling
HTTP Request SmugglingHTTP Request Smuggling
HTTP Request Smuggling
 
HTTP request and response
HTTP request and responseHTTP request and response
HTTP request and response
 
RESTful APIs
RESTful APIsRESTful APIs
RESTful APIs
 
Http - All you need to know
Http - All you need to knowHttp - All you need to know
Http - All you need to know
 
Rest WebAPI with OData
Rest WebAPI with ODataRest WebAPI with OData
Rest WebAPI with OData
 
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0
 
REST & RESTful Web Service
REST & RESTful Web ServiceREST & RESTful Web Service
REST & RESTful Web Service
 
Rest APIs Training
Rest APIs TrainingRest APIs Training
Rest APIs Training
 
Browser
BrowserBrowser
Browser
 
21 HTTP Protocol #burningkeyboards
21 HTTP Protocol #burningkeyboards21 HTTP Protocol #burningkeyboards
21 HTTP Protocol #burningkeyboards
 
Rest webservice ppt
Rest webservice pptRest webservice ppt
Rest webservice ppt
 
SFDC Outbound Integrations
SFDC Outbound IntegrationsSFDC Outbound Integrations
SFDC Outbound Integrations
 
REST API Recommendations
REST API RecommendationsREST API Recommendations
REST API Recommendations
 
HTTP
HTTPHTTP
HTTP
 
Understanding the Web through HTTP
Understanding the Web through HTTPUnderstanding the Web through HTTP
Understanding the Web through HTTP
 
Java EE 8: What Servlet 4 and HTTP2 Mean
Java EE 8: What Servlet 4 and HTTP2 MeanJava EE 8: What Servlet 4 and HTTP2 Mean
Java EE 8: What Servlet 4 and HTTP2 Mean
 
restapitest-anil-200517181251.pdf
restapitest-anil-200517181251.pdfrestapitest-anil-200517181251.pdf
restapitest-anil-200517181251.pdf
 
Rest API Testing
Rest API TestingRest API Testing
Rest API Testing
 

Mehr von Sperasoft

особенности работы с Locomotion в Unreal Engine 4
особенности работы с Locomotion в Unreal Engine 4особенности работы с Locomotion в Unreal Engine 4
особенности работы с Locomotion в Unreal Engine 4Sperasoft
 
концепт и архитектура геймплея в Creach: The Depleted World
концепт и архитектура геймплея в Creach: The Depleted Worldконцепт и архитектура геймплея в Creach: The Depleted World
концепт и архитектура геймплея в Creach: The Depleted WorldSperasoft
 
Опыт разработки VR игры для UE4
Опыт разработки VR игры для UE4Опыт разработки VR игры для UE4
Опыт разработки VR игры для UE4Sperasoft
 
Организация работы с UE4 в команде до 20 человек
Организация работы с UE4 в команде до 20 человек Организация работы с UE4 в команде до 20 человек
Организация работы с UE4 в команде до 20 человек Sperasoft
 
Gameplay Tags
Gameplay TagsGameplay Tags
Gameplay TagsSperasoft
 
Data Driven Gameplay in UE4
Data Driven Gameplay in UE4Data Driven Gameplay in UE4
Data Driven Gameplay in UE4Sperasoft
 
Code and Memory Optimisation Tricks
Code and Memory Optimisation Tricks Code and Memory Optimisation Tricks
Code and Memory Optimisation Tricks Sperasoft
 
The theory of relational databases
The theory of relational databasesThe theory of relational databases
The theory of relational databasesSperasoft
 
Automated layout testing using Galen Framework
Automated layout testing using Galen FrameworkAutomated layout testing using Galen Framework
Automated layout testing using Galen FrameworkSperasoft
 
Sperasoft talks: Android Security Threats
Sperasoft talks: Android Security ThreatsSperasoft talks: Android Security Threats
Sperasoft talks: Android Security ThreatsSperasoft
 
Sperasoft Talks: RxJava Functional Reactive Programming on Android
Sperasoft Talks: RxJava Functional Reactive Programming on AndroidSperasoft Talks: RxJava Functional Reactive Programming on Android
Sperasoft Talks: RxJava Functional Reactive Programming on AndroidSperasoft
 
Sperasoft‬ talks j point 2015
Sperasoft‬ talks j point 2015Sperasoft‬ talks j point 2015
Sperasoft‬ talks j point 2015Sperasoft
 
Effective Мeetings
Effective МeetingsEffective Мeetings
Effective МeetingsSperasoft
 
Unreal Engine 4 Introduction
Unreal Engine 4 IntroductionUnreal Engine 4 Introduction
Unreal Engine 4 IntroductionSperasoft
 
JIRA Development
JIRA DevelopmentJIRA Development
JIRA DevelopmentSperasoft
 
Introduction to Elasticsearch
Introduction to ElasticsearchIntroduction to Elasticsearch
Introduction to ElasticsearchSperasoft
 
MOBILE DEVELOPMENT with HTML, CSS and JS
MOBILE DEVELOPMENT with HTML, CSS and JSMOBILE DEVELOPMENT with HTML, CSS and JS
MOBILE DEVELOPMENT with HTML, CSS and JSSperasoft
 
Quick Intro Into Kanban
Quick Intro Into KanbanQuick Intro Into Kanban
Quick Intro Into KanbanSperasoft
 
ECMAScript 6 Review
ECMAScript 6 ReviewECMAScript 6 Review
ECMAScript 6 ReviewSperasoft
 
Console Development in 15 minutes
Console Development in 15 minutesConsole Development in 15 minutes
Console Development in 15 minutesSperasoft
 

Mehr von Sperasoft (20)

особенности работы с Locomotion в Unreal Engine 4
особенности работы с Locomotion в Unreal Engine 4особенности работы с Locomotion в Unreal Engine 4
особенности работы с Locomotion в Unreal Engine 4
 
концепт и архитектура геймплея в Creach: The Depleted World
концепт и архитектура геймплея в Creach: The Depleted Worldконцепт и архитектура геймплея в Creach: The Depleted World
концепт и архитектура геймплея в Creach: The Depleted World
 
Опыт разработки VR игры для UE4
Опыт разработки VR игры для UE4Опыт разработки VR игры для UE4
Опыт разработки VR игры для UE4
 
Организация работы с UE4 в команде до 20 человек
Организация работы с UE4 в команде до 20 человек Организация работы с UE4 в команде до 20 человек
Организация работы с UE4 в команде до 20 человек
 
Gameplay Tags
Gameplay TagsGameplay Tags
Gameplay Tags
 
Data Driven Gameplay in UE4
Data Driven Gameplay in UE4Data Driven Gameplay in UE4
Data Driven Gameplay in UE4
 
Code and Memory Optimisation Tricks
Code and Memory Optimisation Tricks Code and Memory Optimisation Tricks
Code and Memory Optimisation Tricks
 
The theory of relational databases
The theory of relational databasesThe theory of relational databases
The theory of relational databases
 
Automated layout testing using Galen Framework
Automated layout testing using Galen FrameworkAutomated layout testing using Galen Framework
Automated layout testing using Galen Framework
 
Sperasoft talks: Android Security Threats
Sperasoft talks: Android Security ThreatsSperasoft talks: Android Security Threats
Sperasoft talks: Android Security Threats
 
Sperasoft Talks: RxJava Functional Reactive Programming on Android
Sperasoft Talks: RxJava Functional Reactive Programming on AndroidSperasoft Talks: RxJava Functional Reactive Programming on Android
Sperasoft Talks: RxJava Functional Reactive Programming on Android
 
Sperasoft‬ talks j point 2015
Sperasoft‬ talks j point 2015Sperasoft‬ talks j point 2015
Sperasoft‬ talks j point 2015
 
Effective Мeetings
Effective МeetingsEffective Мeetings
Effective Мeetings
 
Unreal Engine 4 Introduction
Unreal Engine 4 IntroductionUnreal Engine 4 Introduction
Unreal Engine 4 Introduction
 
JIRA Development
JIRA DevelopmentJIRA Development
JIRA Development
 
Introduction to Elasticsearch
Introduction to ElasticsearchIntroduction to Elasticsearch
Introduction to Elasticsearch
 
MOBILE DEVELOPMENT with HTML, CSS and JS
MOBILE DEVELOPMENT with HTML, CSS and JSMOBILE DEVELOPMENT with HTML, CSS and JS
MOBILE DEVELOPMENT with HTML, CSS and JS
 
Quick Intro Into Kanban
Quick Intro Into KanbanQuick Intro Into Kanban
Quick Intro Into Kanban
 
ECMAScript 6 Review
ECMAScript 6 ReviewECMAScript 6 Review
ECMAScript 6 Review
 
Console Development in 15 minutes
Console Development in 15 minutesConsole Development in 15 minutes
Console Development in 15 minutes
 

Kürzlich hochgeladen

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
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
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
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
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 

Kürzlich hochgeladen (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
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
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

Rest services caching

  • 2. “A distributed system is one in which the failure of a computer you didn’t even know existed can render your own computer unusable.” - Leslie Lamport
  • 3. • REST stands for REpresentational State Transfer • Representation is just a very simple rendering of the object • Has benefits when leverages existing HTTP protocol What is REST?
  • 4. • Up-to-date • Fresh • Stale States of Resource Representation
  • 5. Up-to-Date state means the Representation is current according to the origin server Representation is being sent back with no expiry and no caching instructions means the client is allowed to cache for however long or not cache at all Up-to-Date State
  • 6. Fresh State considered as long as the Representation hasn’t expired at client side, proxy or browser Fresh State
  • 7. • Sending must-revalidate means the client must revalidate once the representation is Stale • Stale means it’s gone over it’s expiration date Stale State
  • 8. • Doesn’t actually mean do not cache • Means the client must revalidate both Fresh and Stale entries and then may use the cached copy if it’s up to date No-cache Directive
  • 9. • In plain English text format • Starting line: Method URI HTTP/version • Headers • Body HTTP Message
  • 10. Request: GET /wiki HTTP/1.1 Host: wikipedia.org Accept: text/html Connection: close Response: HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Content-Language: en Content-Length: 1234 Sample HTTP Request/Response
  • 11. • Get • Post • Put • Delete • Options • Head • Patch • Trace • Link • Unlink • Connect Cache-enabled methods are in Red HTTP Methods
  • 12. Response: HTTP/1.1 200 OK Content-Type: text/html Content-Length: 1234 Expires: Fri, 27 Jan 2012 02:33:12 GMT •Allows only HTTP date •Good for static resources •Limited control HTTP Expires header
  • 13. • Enough for static content • For things that rarely change • Or don’t change at all like Calculator /Calculator/Multiply?x=2&y=2/Calculator/Multiply?x=2&y=2 ClientClient Expires is Enough?
  • 14. • public • private • no-cache • no-store • max-age=[seconds] • s-maxage=[seconds] • must-revalidate • proxy-revalidate • no-transform HTTP Cache-Control directives
  • 15. Response: HTTP/1.1 200 OK Content-Type: text/html Content-Length: 1234 Cache-Control: max-age=3600, must-revalidate HTTP Cache-Control Sample
  • 16. What if we need to update data? Cache-Control is Enough for REST
  • 17. • Optimistic is when we version our data • And do not have any transactions • Make use of ETag, If-Match and If-None- Match headers Optimistic Locking: ETag
  • 18. /Orders/Orders ClientClient GET /Orders HTTP/1.1 HTTP/1.1 200 OK Etag: 1 [content goes in body] GET /Orders HTTP/1.1 If-None-Match: 1 HTTP/1.1 304 Not Modified [no ETag] [no content returned!] ETag: GET Not Modified Resource
  • 19. /Orders/Orders ClientClient GET /Orders HTTP/1.1 HTTP/1.1 200 OK Etag: 1 [content goes in body] GET /Orders HTTP/1.1 If-None-Match: 1 HTTP/1.1 200 OK Etag: 2 [new content goes in body!] ETag: GET modified resource
  • 20. /Orders/Orders ClientClient HTTP/1.1 200 OK Etag: 1 [content goes in body] PUT /Orders HTTP/1.1 If-Match: 1 [new content goes in body] HTTP/1.1 100 Continue [no ETag] [no content!] GET /Orders HTTP/1.1 ETag: Modify Resource (PUT)
  • 21. /Orders/Orders ClientClient HTTP/1.1 200 OK Etag: 1 [content goes in body] PUT /Orders HTTP/1.1 If-Match: 1 [new content goes in body] HTTP/1.1 412 Precondition Failed [no ETag] [no content!] GET /Orders HTTP/1.1 ETag: Modify Changed Resource (PUT)
  • 22. God damned HTTP! What we gonna do? • Override changes! • Yeah! It’s possible! • Download the latest version using GET method • We will know the new Etag then Etag: mismatch when PUT
  • 23. /Orders/Orders ClientClient HTTP/1.1 412 Precondition Failed [no ETag] [no content!] PUT /Orders HTTP/1.1 If-None-Match: 1 [new content goes in body] HTTP/1.1 100 Continue [no ETag] [no content!] PUT /Orders HTTP/1.1 If-Match: 1 [new content goes in body] Etag: Override Changes When PUT
  • 24. • ETag and If-* headers came with HTTP 1.1 • In HTTP 1.0 there are another set of headers: Last-Modified: Sat, 29 Oct 2011 19:43:31 GMT If-Modified-Since: Sat, 29 Oct 2011 19:43:31 GMT Additional HTTP Headers
  • 25. int Multiply(int x, int y)int Multiply(int x, int y) HTTPHTTP IPC (Named Pipes)IPC (Named Pipes) TCPTCP ClientClient TCPTCP SOAPSOAP UDPUDP Web Services: Protocols
  • 26. POST /search HTTP/1.1 Host: www.domain.com Content-Type: application/x-www-form- urlencoded term=something HTTP/1.1 303 See Other Location: /search/something/1 POST-Redirect-GET pattern