Data Decay and the Illusion of the PresentDan Lynn
@danklynn
Keeps all your contacts in one place and keeps them automatically up to date.
Based in Denver, Colorado
CTO & [email protected]
@danklynn
Let’s talk about time.
The Past
http://wearcam.org/dundas-square/2004sep23/cement.jpg
The FutureThe Past
The Present
Unless you’re a yogi, you probably can’t even perceive the present.
http://applemagazine.com/wp-content/uploads/2012/12/exc.jpeg
- Washington Post (September 24, 2013)
“Traders may have gotten last week’s Fed news 7 milliseconds early“
It’s just a question of how old.Data is always old
How do APIs keep data fresh?
Polling
• Simple
• But can lead to complex scheduling
• Trades efficient use of resources for fresh data.
GET /notifications?since=1382630675166
- Zapier“98.5% of polls are wasted”
Ping/Pull• XML-RPC
• Facebook Realtime updates
• Avoids scheduled polling
• Consumer must host an endpoint
• Moderate latency (3 hops)
• Complex
Push• Github service hooks
• Content of change is pushed
• Payload can be diff or full resource
• Consumer must host an endpoint
• Lowest latency (1 hop)
We are moving towards a push-based
API ecosystem
“Security is abnormally slow.”Flight Delays
“Dan Lynn changed his phone number”Contact Information
Dynamic SubscriptionsPOST /contacts/123/subscriptions
{
"url" : "https://.../updates?contactId=123"
}
201 Created
{ "url" : "/contacts/123/subscriptions/a3b"}
Dynamic SubscriptionsDELETE /contacts/123/subscriptions/a3b
200 OK
So which model is right for your API?
What’s the cost of acting on wrong
data?
$100 per contact
Source: SiriusDecisions
If left untreated
Low time sensitivity?Polling is fine.
High time sensitivity?Go with push.
APIs are combating information asymmetry.
Thanks!@danklynn
See Also:http://xmpp.org/extensions/xep-0060.html
https://code.google.com/p/pubsubhubbub/http://www.resthooks.org/