Top Banner
34

When RESTful may be considered harmful

Apr 13, 2017

Download

Software

Ross Garrett
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: When RESTful may be considered harmful
Page 2: When RESTful may be considered harmful

When RESTful may be considered harmful

Copyright Push Technology 2015

Ross Garrett

@gssor

Page 3: When RESTful may be considered harmful

We make the Internet work for the mobile-obsessed, app-loving, everything-connected world.

Page 4: When RESTful may be considered harmful

4

Page 5: When RESTful may be considered harmful

Copyright Push Technology 2015

•  We’re defining the market for must-have “Internet Messaging” technology

•  Our software gives business critical apps a performance edge

•  It’s delivered in the way that works for you

•  Founded 2006; recognized expertise in delivering data at scale and speed

•  European HQ in London | Americas HQ in San Jose, CA Selected Customers

Who we are

5

Selected Partners

Page 6: When RESTful may be considered harmful

RESTful may be harmful, eh?

Page 7: When RESTful may be considered harmful

Copyright Push Technology 2015

Yeah…

Here are the Top 10 reasons why RESTful may be considered

harmful

You won’t believe number 7!!

Page 8: When RESTful may be considered harmful

8

Page 9: When RESTful may be considered harmful

Copyright Push Technology 2015

What do we mean by RESTful?

9

Page 10: When RESTful may be considered harmful

Copyright Push Technology 2015 10

Page 11: When RESTful may be considered harmful

Copyright Push Technology 2015

Level 2 - HTTP Verbs

http://martinfowler.com/articles/richardsonMaturityModel.html

Page 12: When RESTful may be considered harmful

Copyright Push Technology 2015

An example Level 2 API

http://blog.sgo.to/2014/04/what-your-api-would-look-like-as-webpage.html

Page 13: When RESTful may be considered harmful

Copyright Push Technology 2015

Looking at this as a Web Page

http://blog.sgo.to/2014/04/what-your-api-would-look-like-as-webpage.html

Page 14: When RESTful may be considered harmful

Copyright Push Technology 2015

Looking at this as a Web Page

http://blog.sgo.to/2014/04/what-your-api-would-look-like-as-webpage.html

Page 15: When RESTful may be considered harmful

Copyright Push Technology 2015

Most Web APIs haven’t reached Level 3 – The Glory of REST

15

Page 16: When RESTful may be considered harmful

Copyright Push Technology 2015

What constitutes “harmful”?

•  Poor end-user experience •  Insufficient scaling capacity

•  Inappropriate implementation / usage

Page 17: When RESTful may be considered harmful

Copyright Push Technology 2015

Poor User Experience

• This usually means slow / unreliable apps

• Often caused by the network

17

Page 18: When RESTful may be considered harmful

Copyright Push Technology 2015

#1 Data redundancy

{uid:1234567890,title:“Something”,db_key:“some_thing_item”,modified_date:“13-06-1991”,…}

Page 19: When RESTful may be considered harmful

Copyright Push Technology 2015

#1 Data redundancy

{uid:1234567890,title:“Somethingelse”,db_key:“some_thing_item”,modified_date:“06-08-2015”,…}

It’s like the Internet is running with Debug turned on

Page 20: When RESTful may be considered harmful

Copyright Push Technology 2015

Insufficient scaling capability

• Growing from 1000 users to 1,000,000 users

• Should we simply add CPUs, NICs, etc?

20

Page 21: When RESTful may be considered harmful

Copyright Push Technology 2015

#2 Data delivery

Your clients

Page 22: When RESTful may be considered harmful

Copyright Push Technology 2015

#2 Data delivery

•  How many requests do you service for data that hasn’t changed?

•  Guess what? HTTP 304 is a thing

•  Everything has a cost; only pay for what you need

Page 23: When RESTful may be considered harmful

Copyright Push Technology 2015

Inappropriate Implementation

•  REST APIs often mimic backend systems & operations

•  If one system needs to notify another about an event - do they really need to exist at the same time?

23

Page 24: When RESTful may be considered harmful

Copyright Push Technology 2015

#3 Coupling

24

Page 25: When RESTful may be considered harmful

Copyright Push Technology 2015

#3 Coupling

•  Message-driven distributed architectures prove to be much more robust and fault-tolerant.

•  Producers and consumers are truly independent.

•  Scalability is easier to achieve, and we can distribute messages to multiple systems at a time.

Page 26: When RESTful may be considered harmful

Copyright Push Technology 2015

Page 27: When RESTful may be considered harmful

Copyright Push Technology 2015

The Internet…

•  Unknown, uncontrolled resource

•  It will let you down –  Insufficient bandwidth –  Inconsistent bandwidth –  High latency –  Loss of connectivity on a regular basis

•  Be sympathetic to realities of the network

Page 28: When RESTful may be considered harmful

Copyright Push Technology 2015

The (mobile) Internet…

•  HTTP & TCP slow-start are usually not a good match for constantly dropped connections

•  Network interface kills battery

•  Large responses + periodic polling = bad

Page 29: When RESTful may be considered harmful

Copyright Push Technology 2015

Solutions?

•  Avoid polling!

•  Avoid redundancies

•  Avoid multiple concurrent HTTP requests

Page 30: When RESTful may be considered harmful

Copyright Push Technology 2015

Think Reactive

30

http://www.reactivemanifesto.org

Page 31: When RESTful may be considered harmful

Copyright Push Technology 2015

The right fit

•  REST solves particular problems for a particular environment

•  Reactive apps almost demand streaming pub/sub messaging –  Websockets!

•  Conceptual simplicity != best performance

Page 32: When RESTful may be considered harmful

Copyright Push Technology 2015

There is no “one size fits all” approach, think strategically and critically about your architecture

choices

32

Page 33: When RESTful may be considered harmful

Copyright Push Technology 2015 33

Page 34: When RESTful may be considered harmful

Thanks!

Subscribe to our blog

Follow us on Twitter

Check out our whitepapers

@reappt

@push_technology

@gssor