REST     in peace                            Rome, March 5th 2011Licensed under CC license
Agenda               Rest in a nutshell             ESI in a nutshell               The uniform interface          Pros/Co...
Sorry for the ugly slide.                             There will be others.                                Really sorry.Li...
Lets go!Licensed under CC license                                    Rome, March 5th 2011
Lets go back!Licensed under CC license                                      Rome, March 5th 2011
2000         Fieldings dissertation:         REpresentational         State         Transfer         http://www.ics.uci.ed...
REST in a nutshell:Licensed under CC license                                   Rome, March 5th 2011
REST in a nutshell:                        1. Client <> ServerLicensed under CC license                                   ...
REST in a nutshell:                                2. StatelessLicensed under CC license                                  ...
Recover and        failover       paradiseLicensed under CC license                            Rome, March 5th 2011
What about           the user           session?Licensed under CC license                            Rome, March 5th 2011
Must                             dieLicensed under CC license                               Rome, March 5th 2011
What about           the user           cookies?Licensed under CC license                            Rome, March 5th 2011
Should             dieLicensed under CC license                            Rome, March 5th 2011
Wondering why?Licensed under CC license                                             Rome, March 5th 2011
Wondering why?                                             Send a cookie via FTP.                http://www.google.it/sear...
REST in a nutshell:                            3. CacheableLicensed under CC license                                      ...
REST in a nutshell:                                  When dealing with safe methods,                            the respon...
REST in a nutshell:          4. Layered systemLicensed under CC license                                   Rome, March 5th ...
REST in a nutshell:                                   5. Uniform                                   interfaceLicensed under...
Uniform interface                             hierarchic resource identification                             HTTP verbs to...
Richardson maturity model                             hierarchic resource identification                             HTTP ...
Richardson maturity model                                         mess                            hierarchic resource iden...
Richardson maturity model                                  0.     mess                            hierarchic resource iden...
0                            Using HTTPLicensed under CC license                                     Rome, March 5th 2011
Without giving a                   f***Licensed under CC license                            Rome, March 5th 2011
Richardson maturity model                            1.         0.     mess                                 hierarchic res...
1                             mytastyproduct.com/users                      mytastyproduct.com/users/1/licenses/4Licensed ...
Richardson maturity model                            1.         0.     mess                                 hierarchic res...
2Licensed under CC license                                Rome, March 5th 2011
Richardson maturity model                            1.         0.     mess                                 hierarchic res...
3.                                GOD                            http://www.slideshare.net/trilancer/why-hateoas-1547275Li...
HyperlinksLicensed under CC license                            Rome, March 5th 2011
Hypermedia formats       http://amundsen.com/hypermedia/Licensed under CC license                             Rome, March ...
Single entry pointLicensed under CC license                            Rome, March 5th 2011
Uniform interface is interesting. Everyone seem to have its own RESTful "service". But no one seem to entirely implement a...
Uniform interface is interesting. Everyone seem to have its own RESTful "service". But no one seem to entirely implement a...
No                            RESTful                             stuffLicensed under CC license                          ...
But dont be too religious.Licensed under CC license                              Rome, March 5th 2011
But dont be too religious.Cookies stuff included.REST gets raped everyday,get over it.Licensed under CC license           ...
CounterorderLicensed under CC license                            Rome, March 5th 2011
Lets be religious  bout that!Licensed under CC license                            Rome, March 5th 2011
Just for a couple minutes                   :)Licensed under CC license                            Rome, March 5th 2011
API #failLicensed under CC license                                  Rome, March 5th 2011
Licensed under CC license                            Rome, March 5th 2011
flickr.com/people/{user-id}Licensed under CC license                                                    Rome, March 5th 2011
flickr.com/photos/{user-id}Licensed under CC license                                                    Rome, March 5th 2011
flickr.com/photos/{user-id}          flickr.com/users/{user-id}/photos/Licensed under CC license                          ...
flickr.photos.deleteLicensed under CC license                                            Rome, March 5th 2011
wow, a delete!Licensed under CC license                                         Rome, March 5th 2011
POSTLicensed under CC license                            Rome, March 5th 2011
Is that    even    legal?Licensed under CC license                            Rome, March 5th 2011
Licensed under CC license                            Rome, March 5th 2011
GET /api.twitter.com/1/users/show.formatLicensed under CC license                                Rome, March 5th 2011
GET /api.twitter.com/1/users/show.format                            GET /api.twitter.com/1/users/                         ...
GET /api.twitter.com/1/users/search.format?query...Licensed under CC license                                     Rome, Mar...
GET /api.twitter.com/1/users/search.format?query...         GET /api.twitter.com/1/users?name=jackLicensed under CC licens...
Licensed under CC license                            Rome, March 5th 2011
Only JSON responsesLicensed under CC license                                          Rome, March 5th 2011
JSON is evilLicensed under CC license                                     Rome, March 5th 2011
{              "date": "2011-01-01",              "stock": "100",              "price": "12"    }Licensed under CC license...
The business evolvesLicensed under CC license                                Rome, March 5th 2011
{                "date": "2011-01-01",                "stock": "100",                "price": [                  {"currenc...
Yeah, client           is brokenLicensed under CC license                            Rome, March 5th 2011
No goodLicensed under CC license                                 Rome, March 5th 2011
BTW               <xml...>                <product...>                 <price currency="EUR">25</price>                 <p...
Well, getting         back to...Licensed under CC license                            Rome, March 5th 2011
Licensed under CC license                            Rome, March 5th 2011
Create a new classhttp://<server>:[<port>]/class/<database>/<class-name>Licensed under CC license                         ...
Response?Licensed under CC license                            Rome, March 5th 2011
HTTP/1.1 201 Created         Cache-Control: no-cache, no-store, max-age=0, must-revalidate                                ...
CAN I HAZ HATEOAZ?Licensed under CC license                            Rome, March 5th 2011
HTTP 201 Created                            Location /bla bla bla bla...                             http://en.wikipedia.o...
I am really ashamed of having          bothered you for 78 slides        to say how to perform a GETLicensed under CC lice...
ESI                              in peace                            Rome, March 5th 2011Licensed under CC license        ...
Edge Side Includes                            A de facto standard for bla bla bla...Licensed under CC license             ...
Edge Side Includes                            A de facto standard for bla bla bla...                Server side includes (...
Include      <esi:include src="http://codemotion.it/talks/1" />Licensed under CC license                                  ...
Try/Catch<esi:try> <esi:attempt>   <esi:comment text="The REST talk"/>   <esi:include src="http://codemotion.it/talks/1" /...
Fallback<esi:try>  <esi:attempt>    <esi:comment text="The REST talk"/>    <esi:include src="http://codemotion.it/talks/1"...
PitfallsLicensed under CC license                                       Rome, March 5th 2011
Pitfalls         Processor configurationLicensed under CC license                                       Rome, March 5th 2011
Pitfalls         Processor configuration         Implementation of fallbacks for handling         errorsLicensed under CC ...
Pitfalls         Processor configuration         Implementation of fallbacks for handling         errors         it relies...
ProsLicensed under CC license                                   Rome, March 5th 2011
ProsLicensed under CC license                            Performances                                      Rome, March 5th...
ProsEffective gateway cacheLicensed under CC license                                   Rome, March 5th 2011
Pros  ScalabilityLicensed under CC license                                   Rome, March 5th 2011
Which leads       us to...Licensed under CC license                            Rome, March 5th 2011
REST+ESI                             in peace                            Rome, March 5th 2011Licensed under CC license    ...
This is a responseLicensed under CC license                                           Rome, March 5th 2011
aggregating many resourcesLicensed under CC license                                     Rome, March 5th 2011
So heres a resource.Licensed under CC license                            Rome, March 5th 2011
So heres a resource. Or, better, its representation.Licensed under CC license                            Rome, March 5th 2...
Five minutes cache                            2 days cacheLicensed under CC license                                       ...
Lets write our own       caching systemLicensed under CC license                            Rome, March 5th 2011
because we need to cache differentresources with different expiring intervals                            odino@odino-pheno...
Hell no!Licensed under CC license                                  Rome, March 5th 2011
USE ESI                  and HTTP                    cacheLicensed under CC license                            Rome, March...
Understanding the web cache                            http://www.mnot.net/cache_docs/#WORK                               ...
Without a                 single LoCLicensed under CC license                            Rome, March 5th 2011
ehm...Licensed under CC license                                 Rome, March 5th 2011
With a few LoCs,                              gotta admitLicensed under CC license                                        ...
The      ArchitectureLicensed under CC license                            Rome, March 5th 2011
Client                            Reverse proxy / ESI processor                                     Application           ...
No    problems,    uh?Licensed under CC license                            Rome, March 5th 2011
HellLicensed under CC license                            no!                               Rome, March 5th 2011
1. ComplexityLicensed under CC license                                       Rome, March 5th 2011
1. ComplexityResolved by your needsLicensed under CC license                                       Rome, March 5th 2011
2. CachingLicensed under CC license                                     Rome, March 5th 2011
2. Caching                            Resolved by the gateway cache                               aka your reverse proxy  ...
You know Varnish, dont you?Licensed under CC license                            Rome, March 5th 2011
Without varnish Concurrency Level: 10 Time taken for tests: 1.467 seconds Complete requests: 1000 Failed requests:     0 W...
With varnish Concurrency Level: 10 Time taken for tests: 0.179 seconds Complete requests: 1000 Failed requests:     0 Writ...
AWESOME                            huh?Licensed under CC license                               Rome, March 5th 2011
NO.Licensed under CC license                              Rome, March 5th 2011
Wheres my HATEOAS, again?Licensed under CC license                            Rome, March 5th 2011
Defining a request                              header in ESI    <esi:environment>     <esi:request_header name="Accept" v...
Defining a request                              header in ESI    <esi:environment>     <esi:request_header name="Accept" v...
Awful supportLicensed under CC license                                       Rome, March 5th 2011
Client                            Reverse proxy                                ?                             ApplicationLi...
Client                            Reverse proxy                            ESI processor                             Appli...
Some freaking crazy people built a webserverLicensed under CC license                                      Rome, March 5th...
in PHPLicensed under CC license                                 Rome, March 5th 2011
with the RAD framework                                     Symfony2                            http://symfony-reloaded.org...
That means you should be able to write your      own reverse proxy acting as an ESI processor.    I mean, if they were abl...
in PHPLicensed under CC license                                 Rome, March 5th 2011
you have no excusesLicensed under CC license                                              Rome, March 5th 2011
But pleaseLicensed under CC license                                         Rome, March 5th 2011
Make it support all the ESI stuffLicensed under CC license                                                      Rome, Marc...
Not like Varnish             http://www.varnish-cache.org/trac/wiki/ESIfeaturesLicensed under CC license                  ...
Extended                              content                            negotiationLicensed under CC license             ...
text/vnd.xhtml+xml;profile=esi                Chapter 8: http://www.rfc-editor.org/rfc/rfc3236.txtLicensed under CC licens...
Response to the proc                            text/vnd.xhtml+xml;profile=esi                                    <head>  ...
Profile is used because the browser                wont render such this kind of formats:Licensed under CC license        ...
text/vnd.xhesiml+xmlLicensed under CC license                                                   Rome, March 5th 2011
Response for fragments                            text/vnd.xhesiml+xml                                <div>               ...
Client                            Reverse proxy                                                        Supporting         ...
Overhead?Licensed under CC license                            Rome, March 5th 2011
Is that a problem?Licensed under CC license                            Rome, March 5th 2011
Client                            Reverse proxy                                                        Supporting         ...
Varnish is there                   for a reasonLicensed under CC license                             Rome, March 5th 2011
Because at thatLicensed under CC license                               Rome, March 5th 2011
Varnish ROCKS!Licensed under CC license                            Rome, March 5th 2011
Ready to include a resource         with our custom hypermedia                    format       <esi:environment>        <e...
But dont screw everything forgetting the remaining parts of HATEOAS, like hypermedia relations. http://www.slideshare.net/...
So, with aLicensed under CC license                                    Rome, March 5th 2011
LayeredLicensed under CC license                                 Rome, March 5th 2011
CacheableLicensed under CC license                            Rome, March 5th 2011
StatelessLicensed under CC license                                   Rome, March 5th 2011
Driven byLicensed under CC license                            Rome, March 5th 2011
Uniform                            interfaceLicensed under CC license                                   Rome, March 5th 2011
and        hypermediaLicensed under CC license                            Rome, March 5th 2011
architectureLicensed under CC license                                     Rome, March 5th 2011
OhLicensed under CC license                            dear                               Rome, March 5th 2011
Richardson                             maturity                              model                              level 3Lic...
Again...Licensed under CC license                                       Rome, March 5th 2011
ProsLicensed under CC license                            Performances                                      Rome, March 5th...
Pros  ScalabilityLicensed under CC license                                   Rome, March 5th 2011
Pros                                   DurabilityLicensed under CC license                                    Rome, March ...
Where to REST                             in peace                            Rome, March 5th 2011Licensed under CC licens...
any                     webserviceLicensed under CC license                            Rome, March 5th 2011
machine                              to                            machineLicensed under CC license                       ...
Be the next                     AtomPub                   http://bitworking.org/projects/atom/rfc5023.htmlLicensed under C...
Actually...Licensed under CC license                               Rome, March 5th 2011
Licensed under CC license                            Rome, March 5th 2011
"REST is software design on the scale of decades: every detail is intended to promote          software longevity and inde...
Put a bit of                     REST                  everywhereLicensed under CC license                            Rome...
http://articles.sfgate.com/2011-02-20/opinion/28613184_1_news-network-cable-and-satellite-website                         ...
Rules of good          designLicensed under CC license                            Rome, March 5th 2011
No need to              be religiousLicensed under CC license                            Rome, March 5th 2011
This talk sucks                             in peace                            Rome, March 5th 2011Licensed under CC lice...
1Licensed under CC license                                Rome, March 5th 2011
Agile development                           vs                          RESTLicensed under CC license                     ...
Agile development                           vs                          REST                            mmmmmmmmmmmm.........
2Licensed under CC license                                Rome, March 5th 2011
Browsers                              suckLicensed under CC license                                  Rome, March 5th 2011
HTTP authentication      http://www.odino.org/238/mockups-of-web-authentication-the-rest-rescueLicensed under CC license  ...
3Licensed under CC license                                Rome, March 5th 2011
HTML5Licensed under CC license                            Rome, March 5th 2011
Everybody loves itLicensed under CC license                            Rome, March 5th 2011
I HATE    HTML5Licensed under CC license                            Rome, March 5th 2011
Original specification:     "support for PUT and        DELETE verbs"Licensed under CC license                            ...
People went insaneLicensed under CC license                                           Rome, March 5th 2011
Current status?Licensed under CC license                                       Rome, March 5th 2011
RemovedLicensed under CC license                            Rome, March 5th 2011
There are no     use casesLicensed under CC license                            Rome, March 5th 2011
They saidLicensed under CC license                             Rome, March 5th 2011
http://www.w3.org/TR/2010/WD-html5-diff-20101019/#changes-2010-06-24Licensed under CC license                             ...
Then people got madLicensed under CC license                                              Rome, March 5th 2011
A disclaimer                                in peace                               Rome, March 5th 2011Licensed under CC l...
JSON   does not suck. At all.                    http://www.slideshare.net/Wombert/xml-versus-the-new-kids-on-the-block-ph...
Varnish                             does not suck. At all.Licensed under CC license                                       ...
HTML5                             does not suck. At all.                                http://www.html5rocks.com/Licensed...
OrientDB                        rocks                 Ask Luca Garulli, he might be in this room                          ...
Everything is a tradeoffLicensed under CC license                                       Rome, March 5th 2011
Hints?Licensed under CC license                                 Rome, March 5th 2011
David Zuelke   knows bestLicensed under CC license                            Rome, March 5th 2011
Design HTTP interfaces                            and RESTful webserviceshttp://www.slideshare.net/Wombert/designing-http-...
Others                    know bestLicensed under CC license                            Rome, March 5th 2011
300 RESTful boring slides :)                                     http://www.slideshare.net/guilhermecaelum/rest-in-practic...
amazon.itLicensed under CC license                              Rome, March 5th 2011
Thanks! Alessandro Nadalin      odino.org
@_odino_                            #codemotionLicensed under CC license                                          Rome, Ma...
12 - 14 May, Verona
Credits      http://www.flickr.com/photos/larachris/16564077/sizes/o/in/photostream/  http://www.flickr.com/photos/ashaten...
REST in peace @ Codemotion 2011
Upcoming SlideShare
Loading in...5
×

REST in peace @ Codemotion 2011

3,856

Published on

Presentation at the 2011 Codemotion (formerly known as the italian JavaDay) about RESTful architectures and caching with Edge Side Includes specification.

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,856
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
59
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

REST in peace @ Codemotion 2011

  1. 1. REST in peace Rome, March 5th 2011Licensed under CC license
  2. 2. Agenda Rest in a nutshell ESI in a nutshell The uniform interface Pros/Cons Bad APIs ESI + REST ProblemsLicensed under CC license Rome, March 5th 2011
  3. 3. Sorry for the ugly slide. There will be others. Really sorry.Licensed under CC license Rome, March 5th 2011
  4. 4. Lets go!Licensed under CC license Rome, March 5th 2011
  5. 5. Lets go back!Licensed under CC license Rome, March 5th 2011
  6. 6. 2000 Fieldings dissertation: REpresentational State Transfer http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htmLicensed under CC license Rome, March 5th 2011
  7. 7. REST in a nutshell:Licensed under CC license Rome, March 5th 2011
  8. 8. REST in a nutshell: 1. Client <> ServerLicensed under CC license Rome, March 5th 2011
  9. 9. REST in a nutshell: 2. StatelessLicensed under CC license Rome, March 5th 2011
  10. 10. Recover and failover paradiseLicensed under CC license Rome, March 5th 2011
  11. 11. What about the user session?Licensed under CC license Rome, March 5th 2011
  12. 12. Must dieLicensed under CC license Rome, March 5th 2011
  13. 13. What about the user cookies?Licensed under CC license Rome, March 5th 2011
  14. 14. Should dieLicensed under CC license Rome, March 5th 2011
  15. 15. Wondering why?Licensed under CC license Rome, March 5th 2011
  16. 16. Wondering why? Send a cookie via FTP. http://www.google.it/search?sourceid=chrome&client=ubuntu&channel=cs&ie=UTF-8&q=ftp+cookies And http://www.ics.uci.edu/~fielding/pubs/dissertation/evaluation.htm#sec_6_3_4_2Licensed under CC license Rome, March 5th 2011
  17. 17. REST in a nutshell: 3. CacheableLicensed under CC license Rome, March 5th 2011
  18. 18. REST in a nutshell: When dealing with safe methods, the response should be able to tell the client, or whatever stands behind the request, how to cache it.Licensed under CC license Rome, March 5th 2011
  19. 19. REST in a nutshell: 4. Layered systemLicensed under CC license Rome, March 5th 2011
  20. 20. REST in a nutshell: 5. Uniform interfaceLicensed under CC license Rome, March 5th 2011
  21. 21. Uniform interface hierarchic resource identification HTTP verbs to perform operations manipulation through representation HATEOASLicensed under CC license Rome, March 5th 2011
  22. 22. Richardson maturity model hierarchic resource identification HTTP verbs to perform operations manipulation through representation HATEOAS Really well explained by Fowler: http://martinfowler. com/articles/richardsonMaturityModel.html#level0Licensed under CC license Rome, March 5th 2011
  23. 23. Richardson maturity model mess hierarchic resource identification HTTP verbs to perform operations HATEOASLicensed under CC license Rome, March 5th 2011
  24. 24. Richardson maturity model 0. mess hierarchic resource identification HTTP verbs to perform operations HATEOASLicensed under CC license Rome, March 5th 2011
  25. 25. 0 Using HTTPLicensed under CC license Rome, March 5th 2011
  26. 26. Without giving a f***Licensed under CC license Rome, March 5th 2011
  27. 27. Richardson maturity model 1. 0. mess hierarchic resource identification HTTP verbs to perform operations HATEOASLicensed under CC license Rome, March 5th 2011
  28. 28. 1 mytastyproduct.com/users mytastyproduct.com/users/1/licenses/4Licensed under CC license Rome, March 5th 2011
  29. 29. Richardson maturity model 1. 0. mess hierarchic resource identification 2. HTTP verbs to perform operations HATEOASLicensed under CC license Rome, March 5th 2011
  30. 30. 2Licensed under CC license Rome, March 5th 2011
  31. 31. Richardson maturity model 1. 0. mess hierarchic resource identification 2. HTTP verbs to perform operations 3. HATEOASLicensed under CC license Rome, March 5th 2011
  32. 32. 3. GOD http://www.slideshare.net/trilancer/why-hateoas-1547275Licensed under CC license Rome, March 5th 2011
  33. 33. HyperlinksLicensed under CC license Rome, March 5th 2011
  34. 34. Hypermedia formats http://amundsen.com/hypermedia/Licensed under CC license Rome, March 5th 2011
  35. 35. Single entry pointLicensed under CC license Rome, March 5th 2011
  36. 36. Uniform interface is interesting. Everyone seem to have its own RESTful "service". But no one seem to entirely implement a uniform interface.Licensed under CC license Rome, March 5th 2011
  37. 37. Uniform interface is interesting. Everyone seem to have its own RESTful "service". But no one seem to entirely implement a uniform interface. That means... ...?Licensed under CC license Rome, March 5th 2011
  38. 38. No RESTful stuffLicensed under CC license Rome, March 5th 2011
  39. 39. But dont be too religious.Licensed under CC license Rome, March 5th 2011
  40. 40. But dont be too religious.Cookies stuff included.REST gets raped everyday,get over it.Licensed under CC license Rome, March 5th 2011
  41. 41. CounterorderLicensed under CC license Rome, March 5th 2011
  42. 42. Lets be religious bout that!Licensed under CC license Rome, March 5th 2011
  43. 43. Just for a couple minutes :)Licensed under CC license Rome, March 5th 2011
  44. 44. API #failLicensed under CC license Rome, March 5th 2011
  45. 45. Licensed under CC license Rome, March 5th 2011
  46. 46. flickr.com/people/{user-id}Licensed under CC license Rome, March 5th 2011
  47. 47. flickr.com/photos/{user-id}Licensed under CC license Rome, March 5th 2011
  48. 48. flickr.com/photos/{user-id} flickr.com/users/{user-id}/photos/Licensed under CC license Rome, March 5th 2011
  49. 49. flickr.photos.deleteLicensed under CC license Rome, March 5th 2011
  50. 50. wow, a delete!Licensed under CC license Rome, March 5th 2011
  51. 51. POSTLicensed under CC license Rome, March 5th 2011
  52. 52. Is that even legal?Licensed under CC license Rome, March 5th 2011
  53. 53. Licensed under CC license Rome, March 5th 2011
  54. 54. GET /api.twitter.com/1/users/show.formatLicensed under CC license Rome, March 5th 2011
  55. 55. GET /api.twitter.com/1/users/show.format GET /api.twitter.com/1/users/ HTTP Accept header: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.htmlLicensed under CC license Rome, March 5th 2011
  56. 56. GET /api.twitter.com/1/users/search.format?query...Licensed under CC license Rome, March 5th 2011
  57. 57. GET /api.twitter.com/1/users/search.format?query... GET /api.twitter.com/1/users?name=jackLicensed under CC license Rome, March 5th 2011
  58. 58. Licensed under CC license Rome, March 5th 2011
  59. 59. Only JSON responsesLicensed under CC license Rome, March 5th 2011
  60. 60. JSON is evilLicensed under CC license Rome, March 5th 2011
  61. 61. { "date": "2011-01-01", "stock": "100", "price": "12" }Licensed under CC license Rome, March 5th 2011
  62. 62. The business evolvesLicensed under CC license Rome, March 5th 2011
  63. 63. { "date": "2011-01-01", "stock": "100", "price": [ {"currency": "EUR", "amount": "12"}, {"currency": "USD", "amount": "10"} ] } Credits: http://twitter.com/#!/odracciLicensed under CC license Rome, March 5th 2011
  64. 64. Yeah, client is brokenLicensed under CC license Rome, March 5th 2011
  65. 65. No goodLicensed under CC license Rome, March 5th 2011
  66. 66. BTW <xml...> <product...> <price currency="EUR">25</price> <price currency="USD">23</price> </product> </xml>Licensed under CC license Rome, March 5th 2011
  67. 67. Well, getting back to...Licensed under CC license Rome, March 5th 2011
  68. 68. Licensed under CC license Rome, March 5th 2011
  69. 69. Create a new classhttp://<server>:[<port>]/class/<database>/<class-name>Licensed under CC license Rome, March 5th 2011
  70. 70. Response?Licensed under CC license Rome, March 5th 2011
  71. 71. HTTP/1.1 201 Created Cache-Control: no-cache, no-store, max-age=0, must-revalidate Pragma: no-cache Date: Fri Feb 18 03:21:09 CET 2011 Content-Type: text/plain Server: OrientDB Server v.0.9.24 Connection: Keep-Alive Set-Cookie: OSESSIONID=OS12979956697985725150466358620636; Path=/; HttpOnly CONTENT-LENGTH: 221Licensed under CC license Rome, March 5th 2011
  72. 72. CAN I HAZ HATEOAZ?Licensed under CC license Rome, March 5th 2011
  73. 73. HTTP 201 Created Location /bla bla bla bla... http://en.wikipedia.org/wiki/HTTP_locationLicensed under CC license Rome, March 5th 2011
  74. 74. I am really ashamed of having bothered you for 78 slides to say how to perform a GETLicensed under CC license Rome, March 5th 2011
  75. 75. ESI in peace Rome, March 5th 2011Licensed under CC license Rome, March 5th 2011
  76. 76. Edge Side Includes A de facto standard for bla bla bla...Licensed under CC license Rome, March 5th 2011
  77. 77. Edge Side Includes A de facto standard for bla bla bla... Server side includes ( not SSI! ) usually handled by the architectures ESI processor. http://www.w3.org/TR/esi-lang http://www.w3.org/TR/edge-archLicensed under CC license Rome, March 5th 2011
  78. 78. Include <esi:include src="http://codemotion.it/talks/1" />Licensed under CC license Rome, March 5th 2011
  79. 79. Try/Catch<esi:try> <esi:attempt> <esi:comment text="The REST talk"/> <esi:include src="http://codemotion.it/talks/1" /> </esi:attempt>Licensed under CC license Rome, March 5th 2011
  80. 80. Fallback<esi:try> <esi:attempt> <esi:comment text="The REST talk"/> <esi:include src="http://codemotion.it/talks/1" /> </esi:attempt> <esi:except> <esi:comment text="fallback"/> <p>epic fail</p> </esi:except></esi:try> Licensed under CC license Rome, March 5th 2011
  81. 81. PitfallsLicensed under CC license Rome, March 5th 2011
  82. 82. Pitfalls Processor configurationLicensed under CC license Rome, March 5th 2011
  83. 83. Pitfalls Processor configuration Implementation of fallbacks for handling errorsLicensed under CC license Rome, March 5th 2011
  84. 84. Pitfalls Processor configuration Implementation of fallbacks for handling errors it relies on the processor, which gains importance, for creating any single response ( not really true :-) )Licensed under CC license Rome, March 5th 2011
  85. 85. ProsLicensed under CC license Rome, March 5th 2011
  86. 86. ProsLicensed under CC license Performances Rome, March 5th 2011
  87. 87. ProsEffective gateway cacheLicensed under CC license Rome, March 5th 2011
  88. 88. Pros ScalabilityLicensed under CC license Rome, March 5th 2011
  89. 89. Which leads us to...Licensed under CC license Rome, March 5th 2011
  90. 90. REST+ESI in peace Rome, March 5th 2011Licensed under CC license Rome, March 5th 2011
  91. 91. This is a responseLicensed under CC license Rome, March 5th 2011
  92. 92. aggregating many resourcesLicensed under CC license Rome, March 5th 2011
  93. 93. So heres a resource.Licensed under CC license Rome, March 5th 2011
  94. 94. So heres a resource. Or, better, its representation.Licensed under CC license Rome, March 5th 2011
  95. 95. Five minutes cache 2 days cacheLicensed under CC license Rome, March 5th 2011
  96. 96. Lets write our own caching systemLicensed under CC license Rome, March 5th 2011
  97. 97. because we need to cache differentresources with different expiring intervals odino@odino-phenom:~$ ab -n 1000 -c 10 http://127. 0.0.1/tmp/esi.php This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http: //www.apache.org/ Benchmarking 127.0.0.1 (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requestsLicensed under CC license Rome, March 5th 2011
  98. 98. Hell no!Licensed under CC license Rome, March 5th 2011
  99. 99. USE ESI and HTTP cacheLicensed under CC license Rome, March 5th 2011
  100. 100. Understanding the web cache http://www.mnot.net/cache_docs/#WORK HTTP cache http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.htmlLicensed under CC license Rome, March 5th 2011
  101. 101. Without a single LoCLicensed under CC license Rome, March 5th 2011
  102. 102. ehm...Licensed under CC license Rome, March 5th 2011
  103. 103. With a few LoCs, gotta admitLicensed under CC license Rome, March 5th 2011
  104. 104. The ArchitectureLicensed under CC license Rome, March 5th 2011
  105. 105. Client Reverse proxy / ESI processor Application DatabaseLicensed under CC license Rome, March 5th 2011
  106. 106. No problems, uh?Licensed under CC license Rome, March 5th 2011
  107. 107. HellLicensed under CC license no! Rome, March 5th 2011
  108. 108. 1. ComplexityLicensed under CC license Rome, March 5th 2011
  109. 109. 1. ComplexityResolved by your needsLicensed under CC license Rome, March 5th 2011
  110. 110. 2. CachingLicensed under CC license Rome, March 5th 2011
  111. 111. 2. Caching Resolved by the gateway cache aka your reverse proxy aka, most of the time, VarnishLicensed under CC license Rome, March 5th 2011
  112. 112. You know Varnish, dont you?Licensed under CC license Rome, March 5th 2011
  113. 113. Without varnish Concurrency Level: 10 Time taken for tests: 1.467 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 5476471 bytes HTML transferred: 5285280 bytes Requests per second: 681.69 [#/sec] (mean) Time per request: 14.670 [ms] (mean) Time per request: 1.467 [ms] (mean, across all concurrent requests) Transfer rate: 3645.73 [Kbytes/sec] receivedLicensed under CC license Rome, March 5th 2011
  114. 114. With varnish Concurrency Level: 10 Time taken for tests: 0.179 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 5479938 bytes HTML transferred: 5288556 bytes Requests per second: 5587.65 [#/sec] (mean) Time per request: 1.790 [ms] (mean) Time per request: 0.179 [ms] (mean, across all concurrent requests) Transfer rate: 29902.34 [Kbytes/sec] receivedLicensed under CC license Rome, March 5th 2011
  115. 115. AWESOME huh?Licensed under CC license Rome, March 5th 2011
  116. 116. NO.Licensed under CC license Rome, March 5th 2011
  117. 117. Wheres my HATEOAS, again?Licensed under CC license Rome, March 5th 2011
  118. 118. Defining a request header in ESI <esi:environment> <esi:request_header name="Accept" value="text/vnd.odino.xhtml"/> </esi:environment>Licensed under CC license Rome, March 5th 2011
  119. 119. Defining a request header in ESI <esi:environment> <esi:request_header name="Accept" value="text/vnd.odino.xhtml"/> </esi:environment> Content NegotiationLicensed under CC license Rome, March 5th 2011
  120. 120. Awful supportLicensed under CC license Rome, March 5th 2011
  121. 121. Client Reverse proxy ? ApplicationLicensed under CC license Rome, March 5th 2011
  122. 122. Client Reverse proxy ESI processor ApplicationLicensed under CC license Rome, March 5th 2011
  123. 123. Some freaking crazy people built a webserverLicensed under CC license Rome, March 5th 2011
  124. 124. in PHPLicensed under CC license Rome, March 5th 2011
  125. 125. with the RAD framework Symfony2 http://symfony-reloaded.org/ https://github.com/pminnieur/ServerBundleLicensed under CC license Rome, March 5th 2011
  126. 126. That means you should be able to write your own reverse proxy acting as an ESI processor. I mean, if they were able to write a webserver...Licensed under CC license Rome, March 5th 2011
  127. 127. in PHPLicensed under CC license Rome, March 5th 2011
  128. 128. you have no excusesLicensed under CC license Rome, March 5th 2011
  129. 129. But pleaseLicensed under CC license Rome, March 5th 2011
  130. 130. Make it support all the ESI stuffLicensed under CC license Rome, March 5th 2011
  131. 131. Not like Varnish http://www.varnish-cache.org/trac/wiki/ESIfeaturesLicensed under CC license Rome, March 5th 2011
  132. 132. Extended content negotiationLicensed under CC license Rome, March 5th 2011
  133. 133. text/vnd.xhtml+xml;profile=esi Chapter 8: http://www.rfc-editor.org/rfc/rfc3236.txtLicensed under CC license Rome, March 5th 2011
  134. 134. Response to the proc text/vnd.xhtml+xml;profile=esi <head> .... </head> <body> <esi ... /> </body>Licensed under CC license Rome, March 5th 2011
  135. 135. Profile is used because the browser wont render such this kind of formats:Licensed under CC license Rome, March 5th 2011
  136. 136. text/vnd.xhesiml+xmlLicensed under CC license Rome, March 5th 2011
  137. 137. Response for fragments text/vnd.xhesiml+xml <div> .... </div> <span> <esi ... /> </span>Licensed under CC license Rome, March 5th 2011
  138. 138. Client Reverse proxy Supporting all the ESI ESI processor specification http://www.w3.org/TR/esi-lang ApplicationLicensed under CC license Rome, March 5th 2011
  139. 139. Overhead?Licensed under CC license Rome, March 5th 2011
  140. 140. Is that a problem?Licensed under CC license Rome, March 5th 2011
  141. 141. Client Reverse proxy Supporting all the ESI ESI processor specification http://www.w3.org/TR/esi-lang ApplicationLicensed under CC license Rome, March 5th 2011
  142. 142. Varnish is there for a reasonLicensed under CC license Rome, March 5th 2011
  143. 143. Because at thatLicensed under CC license Rome, March 5th 2011
  144. 144. Varnish ROCKS!Licensed under CC license Rome, March 5th 2011
  145. 145. Ready to include a resource with our custom hypermedia format <esi:environment> <esi:request_header name="Accept" value="text/vnd.blablabla"/> </esi:environment>Licensed under CC license Rome, March 5th 2011
  146. 146. But dont screw everything forgetting the remaining parts of HATEOAS, like hypermedia relations. http://www.slideshare.net/adorepump/hateoas-the-confusing-bit-from-rest http://tech.groups.yahoo.com/group/rest-discuss/message/17011Licensed under CC license Rome, March 5th 2011
  147. 147. So, with aLicensed under CC license Rome, March 5th 2011
  148. 148. LayeredLicensed under CC license Rome, March 5th 2011
  149. 149. CacheableLicensed under CC license Rome, March 5th 2011
  150. 150. StatelessLicensed under CC license Rome, March 5th 2011
  151. 151. Driven byLicensed under CC license Rome, March 5th 2011
  152. 152. Uniform interfaceLicensed under CC license Rome, March 5th 2011
  153. 153. and hypermediaLicensed under CC license Rome, March 5th 2011
  154. 154. architectureLicensed under CC license Rome, March 5th 2011
  155. 155. OhLicensed under CC license dear Rome, March 5th 2011
  156. 156. Richardson maturity model level 3Licensed under CC license Rome, March 5th 2011
  157. 157. Again...Licensed under CC license Rome, March 5th 2011
  158. 158. ProsLicensed under CC license Performances Rome, March 5th 2011
  159. 159. Pros ScalabilityLicensed under CC license Rome, March 5th 2011
  160. 160. Pros DurabilityLicensed under CC license Rome, March 5th 2011
  161. 161. Where to REST in peace Rome, March 5th 2011Licensed under CC license Rome, March 5th 2011
  162. 162. any webserviceLicensed under CC license Rome, March 5th 2011
  163. 163. machine to machineLicensed under CC license Rome, March 5th 2011
  164. 164. Be the next AtomPub http://bitworking.org/projects/atom/rfc5023.htmlLicensed under CC license Rome, March 5th 2011
  165. 165. Actually...Licensed under CC license Rome, March 5th 2011
  166. 166. Licensed under CC license Rome, March 5th 2011
  167. 167. "REST is software design on the scale of decades: every detail is intended to promote software longevity and independent evolution. Many of the constraints are directly opposed to short-term efficiency. Unfortunately, people are fairly good at short-term design, and usually awful at long-term design. " Roy FieldingLicensed under CC license Rome, March 5th 2011
  168. 168. Put a bit of REST everywhereLicensed under CC license Rome, March 5th 2011
  169. 169. http://articles.sfgate.com/2011-02-20/opinion/28613184_1_news-network-cable-and-satellite-website http://tech.groups.yahoo.com/group/rest-discuss/message/17370 +2.500% trafficLicensed under CC license Rome, March 5th 2011
  170. 170. Rules of good designLicensed under CC license Rome, March 5th 2011
  171. 171. No need to be religiousLicensed under CC license Rome, March 5th 2011
  172. 172. This talk sucks in peace Rome, March 5th 2011Licensed under CC license Rome, March 5th 2011
  173. 173. 1Licensed under CC license Rome, March 5th 2011
  174. 174. Agile development vs RESTLicensed under CC license Rome, March 5th 2011
  175. 175. Agile development vs REST mmmmmmmmmmmm................ http://www.odino.org/288/restful-and-agile-love-hate-loveLicensed under CC license Rome, March 5th 2011
  176. 176. 2Licensed under CC license Rome, March 5th 2011
  177. 177. Browsers suckLicensed under CC license Rome, March 5th 2011
  178. 178. HTTP authentication http://www.odino.org/238/mockups-of-web-authentication-the-rest-rescueLicensed under CC license Rome, March 5th 2011
  179. 179. 3Licensed under CC license Rome, March 5th 2011
  180. 180. HTML5Licensed under CC license Rome, March 5th 2011
  181. 181. Everybody loves itLicensed under CC license Rome, March 5th 2011
  182. 182. I HATE HTML5Licensed under CC license Rome, March 5th 2011
  183. 183. Original specification: "support for PUT and DELETE verbs"Licensed under CC license Rome, March 5th 2011
  184. 184. People went insaneLicensed under CC license Rome, March 5th 2011
  185. 185. Current status?Licensed under CC license Rome, March 5th 2011
  186. 186. RemovedLicensed under CC license Rome, March 5th 2011
  187. 187. There are no use casesLicensed under CC license Rome, March 5th 2011
  188. 188. They saidLicensed under CC license Rome, March 5th 2011
  189. 189. http://www.w3.org/TR/2010/WD-html5-diff-20101019/#changes-2010-06-24Licensed under CC license Rome, March 5th 2011
  190. 190. Then people got madLicensed under CC license Rome, March 5th 2011
  191. 191. A disclaimer in peace Rome, March 5th 2011Licensed under CC license Rome, March 5th 2011
  192. 192. JSON does not suck. At all. http://www.slideshare.net/Wombert/xml-versus-the-new-kids-on-the-block-phpbnl11-20110129Licensed under CC license Rome, March 5th 2011
  193. 193. Varnish does not suck. At all.Licensed under CC license Rome, March 5th 2011
  194. 194. HTML5 does not suck. At all. http://www.html5rocks.com/Licensed under CC license Rome, March 5th 2011
  195. 195. OrientDB rocks Ask Luca Garulli, he might be in this room http://www.orientechnologies.com/Licensed under CC license Rome, March 5th 2011
  196. 196. Everything is a tradeoffLicensed under CC license Rome, March 5th 2011
  197. 197. Hints?Licensed under CC license Rome, March 5th 2011
  198. 198. David Zuelke knows bestLicensed under CC license Rome, March 5th 2011
  199. 199. Design HTTP interfaces and RESTful webserviceshttp://www.slideshare.net/Wombert/designing-http-interfaces-and-restful-web-services-phpbnl11-20110128Licensed under CC license Rome, March 5th 2011
  200. 200. Others know bestLicensed under CC license Rome, March 5th 2011
  201. 201. 300 RESTful boring slides :) http://www.slideshare.net/guilhermecaelum/rest-in-practice REST as the DBMS of the web http://www.slideshare.net/dnene/rest-representational-state-transfer-explainedLicensed under CC license Rome, March 5th 2011
  202. 202. amazon.itLicensed under CC license Rome, March 5th 2011
  203. 203. Thanks! Alessandro Nadalin odino.org
  204. 204. @_odino_ #codemotionLicensed under CC license Rome, March 5th 2011
  205. 205. 12 - 14 May, Verona
  206. 206. Credits http://www.flickr.com/photos/larachris/16564077/sizes/o/in/photostream/ http://www.flickr.com/photos/ashatenbroeke/4367373081/sizes/z/in/photostream/ http://www.flickr.com/photos/yourdon/3140270189/sizes/l/in/photostream/ http://www.flickr.com/photos/jox1989/4964706072/sizes/l/in/photostream/ http://www.flickr.com/photos/brainfg/168506259/sizes/o/in/photostream/ http://www.flickr.com/photos/norte_it/3897091546/sizes/o/in/photostream/ http://www.zdnet.com/blog/service-oriented/soap-versus-rest-a-matter-of-style/3568http://www.flickr.com/photos/turtlemom_nancy/2046347762/sizes/l/in/photostream/ http://www.flickr.com/photos/juanpg/3333385784/sizes/z/in/photostream/ http://www.flickr.com/photos/congvo/301678287/sizes/l/in/photostream/ http://www.flickr.com/photos/ihasb33r/2573196546/sizes/z/in/photostream/ http://www.flickr.com/photos/martin_heigan/4544138976/sizes/o/in/photostream/ http://www.flickr.com/photos/cknara/4195099999/sizes/o/in/photostream/ http://www.flickr.com/photos/1080p/3076529265/sizes/l/in/photostream/ http://www.flickr.com/photos/adamrice/280300202/sizes/l/in/photostream/ http://www.flickr.com/photos/tomer_a/541411897/sizes/o/in/photostream/ http://www.flickr.com/photos/subpra/4514008262/sizes/l/in/photostream/ http://www.flickr.com/photos/lippincott/2539720043/sizes/l/in/photostream/ http://www.flickr.com/photos/rawryder/5086090931/sizes/l/in/photostream/ http://www.flickr.com/photos/robboudon/5312731161/sizes/l/in/photostream/ http://www.flickr.com/photos/bc-burnslibrary/4158243488/sizes/o/in/photostream/http://www.flickr.com/photos/13606325@N08/2416993706/sizes/o/in/photostream/ http://www.flickr.com/photos/neothezion/5135841069/sizes/l/in/photostream/ http://www.flickr.com/photos/planetschwa/2494067809/ http://www.flickr.com/photos/thomasthomas/258931782/
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×