Top Banner
APIs & Underlying Protocols Lessons · Semantics · Trends @andreisavu #APICraftSF
32
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: APIs & Underlying Protocols #APICraftSF

APIs & Underlying ProtocolsLessons · Semantics · Trends

@andreisavu #APICraftSF

Page 2: APIs & Underlying Protocols #APICraftSF
Page 3: APIs & Underlying Protocols #APICraftSF

Me

Working on Cloudera DirectorPreviously founder of Axemblr.com and Java User Group organizer

More on LinkedIn & @andreisavu

Page 4: APIs & Underlying Protocols #APICraftSF

Goal

Share the idea: There is no silver bullet and any implementation must ack network laws

From my experience with:● using multiple cloud provider APIs● using distributed systems (Zookeeper)● writing clients & APIs (jclouds, Director)

Page 5: APIs & Underlying Protocols #APICraftSF

A bit of contextOn the role of APIs & Web Evolution

Page 6: APIs & Underlying Protocols #APICraftSF
Page 7: APIs & Underlying Protocols #APICraftSF
Page 8: APIs & Underlying Protocols #APICraftSF
Page 10: APIs & Underlying Protocols #APICraftSF

How we build modern applications?

As hybrids

Start: as monolithic systems that use external APIs (identity, analytics, payments, email etc.)

Evolve: collections of services with cohesive APIs (map to organizational boundaries)

Page 11: APIs & Underlying Protocols #APICraftSF

What is the role of an API?

Message passing protocol for State Machines

Often seen as replacing libraries in monolithic systems. Dangerous: doesn’t account for network semantics (reason why RPC failed)

Page 12: APIs & Underlying Protocols #APICraftSF

What is the role of an API?

Message passing protocol for State Machines

Better: Writing and reading messages on a synchronous queue (producer / consumer). Matches transport layer semantics.

Page 13: APIs & Underlying Protocols #APICraftSF

Fashion-Driven-DevelopmentAre you done rewriting your app in / on X!?

Page 14: APIs & Underlying Protocols #APICraftSF

Reinventing the wheel? Often too young to know better?

(simple vs. simplistic approaches)

Page 15: APIs & Underlying Protocols #APICraftSF

Doing CORBA again?! (1991)

Page 16: APIs & Underlying Protocols #APICraftSF

Good API / Bad APIacknowledge the distributed nature of the app

actual choice of technology is orthogonal

Page 17: APIs & Underlying Protocols #APICraftSF

Network is not reliablePartial failures, Timeouts, Partitions,

At-least once message delivery

Page 18: APIs & Underlying Protocols #APICraftSF

Latency is not zeroOr predictable. Jitter. Stranglers.

Page 19: APIs & Underlying Protocols #APICraftSF

Bandwidth is limitedFanout. Object size. Compression. Capacity

Page 20: APIs & Underlying Protocols #APICraftSF

The network is not secureIdentity, Authorization, Encryption, Throttling

Page 21: APIs & Underlying Protocols #APICraftSF

Topology does changeEndpoint discovery. Versioning, DNS

Page 22: APIs & Underlying Protocols #APICraftSF

Transport cost is not zeroCPU, Contention, Syscalls, GC

Page 23: APIs & Underlying Protocols #APICraftSF

There are multiple operatorsA system controlled by multiple entities

Page 24: APIs & Underlying Protocols #APICraftSF

Network is heterogeneousNo one size fits all

Page 25: APIs & Underlying Protocols #APICraftSF

Your API is as good as your client library

Users writing their own doesn’t really work (especially for static languages)

Page 26: APIs & Underlying Protocols #APICraftSF

Not all protocols are equalWide adoption has important network effects

Gravity. Fashion vs. Technical Merits

Page 27: APIs & Underlying Protocols #APICraftSF

How did REST-like succeed?Mix: HTTP, Thin Spec, Partial Adherence

Piggyback on: CDNs, Proxies, Tooling etc.

Page 28: APIs & Underlying Protocols #APICraftSF

HTTP/1 → HTTP/2

Page 29: APIs & Underlying Protocols #APICraftSF

HTTP/2: new framing layer

maintains HTTP paradigmsame URL structure (including TLS)designed for 1:1 conversion at proxyallows for server push

http://daniel.haxx.se/http2/

Page 30: APIs & Underlying Protocols #APICraftSF

APIs better suited for:● low cost batch operations● lower latency● compatibility with next gen CDNs● downside: more complex clients

… but the devil is in the details.

What we can hope w/ HTTP/2?

Page 31: APIs & Underlying Protocols #APICraftSF

Take aways

There are no silver bulletsThere has to be substance behind fashionRewriting everything is the normAcknowledge transport layer restrictionsTechnology as a mean-to-an-end