Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... ·...

143
Prophet a path out of the cloud http://syncwith.us [email protected] 1

Transcript of Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... ·...

Page 1: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Propheta path out of the cloud

http://syncwith.us

[email protected]

Page 2: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

You may know me from...

RT (Request Tracker)

Jifty

SVK

Hiveminder

Perl 6

Shirts

2

Page 3: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

I’ve been hacking on an open source database

called “Prophet”

3

Page 4: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

It has an API like Amazon SimpleDB or Google App Engine’s...

4

Page 5: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

It’s designed for “team-scale” apps

5

Page 6: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

It’s built for P2P replication and

disconnected use

6

Page 7: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

App #1 is the canonical “offline bug tracker”

7

Page 8: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

App #2 will probably be a BBS you can sync

over sneakernet

8

Page 9: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

But first, a brief digression...

9

Page 10: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

...about cloud computing

10

Page 11: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Living in the cloud =

sharecropping

11

Page 12: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

(That’s bad)

12

Page 13: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

This is a rant

13

Page 14: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

The bad old days:

14

Page 15: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Pic of sharecroppers

15

Page 16: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

You farmed land you didn’t own...

16

Page 17: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

...with tools you couldn’t really afford

17

Page 18: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

You paid for it with part of your harvest...

18

Page 19: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

It sounded like apretty sweet deal...

19

Page 20: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

...until things got bad

20

Page 21: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

(Things always got bad)

21

Page 22: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

In a bad year, you got further in debt tothe land owner

22

Page 23: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

23

Page 24: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

The (more recent)bad old days:

24

Page 25: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

pic of mainframes

25

Page 26: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

You ran code you didn’t own on hardware you

didn’t own

26

Page 27: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Things got a little better:

27

Page 28: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Pic of PCs

28

Page 29: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Things weren’t all rosy:

29

Page 30: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Pic of BSOD

30

Page 31: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Sometimes new versions of software

killed features...

31

Page 32: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

...so you were locked in to old versions

32

Page 33: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

pic of win 31?

33

Page 34: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Things got ‘better’:

34

Page 35: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

rmsche

35

Page 36: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Now, things are getting worse again...

36

Page 37: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

37

Page 38: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

What happens when your favorite service

goes down?

38

Page 39: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

pic of twitter being down

39

Page 40: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

...or stops accepting new signups?

40

Page 41: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

41

Page 42: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

...or gives all your data to the secret police?

42

Page 43: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Pic of yahoo.cn

43

Page 44: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

...or starts making arbitrary choices about what’s ‘safe’ content?

44

Page 45: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

45

Page 46: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

You don’t own the services you use

46

Page 47: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

When the service provider cuts you off, that’s it. No recourse.

47

Page 48: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Not so secret shame:I’m a really bad zealot

48

Page 49: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

My calendar lives at google.com

49

Page 50: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

50

Page 51: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

I make a web 2.0 tasklist service called

Hiveminder.com

51

Page 52: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

pic of hiveminder

52

Page 53: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Using hosted apps is going to hurt you

53

Page 54: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Data access is important

54

Page 55: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

APIs are great

55

Page 56: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

...but easy access to a service just makes it

easier to get locked in

56

Page 57: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

What about Google Gears, Adobe Air, etc?

57

Page 58: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Great. now you can use your word processer while you’re offline!

58

Page 59: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Pic of wordperfect

59

Page 60: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Real offline apps shouldn’t need servers

60

Page 61: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Real offline appsshould sync like you do

61

Page 62: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

I might be a nut job

62

Page 63: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

...but smart people seem to agree with me

63

Page 64: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

If we want people to have the same degree of user autonomy as we've come to expect from the world, we may have to sit down and code alternatives to Google Docs, Twitter, and EC3 that can live with us on the edge, not be run by third parties.

- Danny O’Brienhttp://www.oblomovka.com/entries/2008/07/16

64

Page 65: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Back to that database thing...

65

Page 66: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Jesse Vincent

66

Page 67: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Chia-liang Kao

67

Page 68: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

We work together

68

Page 69: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

CL lives in TaipeiJesse lives in Boston

69

Page 70: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Sometimes we needto work face to face

70

Page 71: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

TPE - BOS:TPE - HNL:BOS - HNL:

9410 mi5,095 mi5,069 mi

71

Page 72: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Step 1: Go to Hawaii for “work”Step 2: ???Step 3: Prophet!

Our Plan

72

Page 73: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

The Plan Backfired

We were there for 8 days

We wrote 8000 lines of Perl

We figured out step 2

73

Page 74: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Step 2:

Build a Disconnected Syncable Database

74

Page 75: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Prophet

75

Page 77: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

A grounded, semirelational,

peer to peer replicated,

disconnected, versioned,

property database with

self-healing conflict resolution

Prophet

77

Page 78: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

What do all thosebuzzwords mean?

78

Page 79: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

grounded

Runs here

79

Page 80: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

grounded

Not here

80

Page 81: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

grounded

Runs at the edge

Doesn’t need to run in the cloud

Syncs with services you already use

(We call the adaptors “Foreign Replicas”)

81

Page 82: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Joins are expensive

(They’re still possible)

semirelational

82

Page 83: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Update any replica

Pull from any replica

Push to any replica

Publish a replica

Changes will propagate

peer-to-peer replicated

83

Page 84: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Real-time replication is hard to scale

It only “works” with constant connectivity

I don’t have constant connectivity

Neither do you

Prophet sync can happen whenever

disconnected

84

Page 85: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Every update is recorded as a change set

Change sets don’t lose any data

(so you can use them to go backwards)

All history is introspectable

Replication just replays changesets

versioned

85

Page 86: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Atomic operations

CREATE, READ, UPDATE, DELETE, SEARCH

Record types can have optional validation and canonicalization

Records of the same type do not need to have the same properties

Add and remove properties at will

property database

86

Page 87: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Remembers all conflict resolutions

Syncs all resolutions with your peers

Detects identical conflicts

Uses your peers’ resolutions to “vote” for the winner of a conflict

self-healing conflict resolution

87

Page 88: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Working with Prophet

88

Page 89: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

RESTy API

GET /records.json

GET /records/Cars.json

GET /records/Cars/716499-5F9-4AC4-827.json

GET /records/Cars/716499-5F9-4AC4-827/wheels.json

POST /records/Cars.json

POST /records/Cars/716499-5F9-4AC4-827.json

POST /records/Cars/716499-5F9-4AC4-827/wheels.json

89

Page 90: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

RESTy API

Yes, we should be using PUT and DELETE

Yes, you can have a commit bit and help us fix it :)

90

Page 91: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Native API(Yes, the core is Perl.)

my $cli = Prophet::CLI->new();

my $cxn = $cli->app_handle->handle;

my $record = Prophet::Record->new( handle => $cxn, type => 'Person' );

my $uuid = $record->create( props => { name => 'Jesse', age => 31 } );

$record->set_prop( name => 'age', value => 32 );

my $people = Prophet::Collection->new( handle => $cxn, type => 'Person' );

$people->matching( sub { shift->prop('species') ne 'cat' } );

91

Page 92: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

What could you build with Prophet?

92

Page 93: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

A bug tracker: “simple defects”

• id. Status, Summary

• (Arbitrary other properties too)

•History

•Comments

•Attachments

sd

93

Page 94: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

./bin/sd ticket create -- summary="Can't sync sd with Google Code" status=new

Created ticket 5 (93BF979E-08C1-11DD-94C3-D4B1FCEE7EC4)

Create

94

Page 95: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

./bin/sd ticket search --regex publish

29 } new the online help doesn't describe publish

34 } new publish a static html view of records

35 } new publish should create a static rss file

List and Search

95

Page 96: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

./bin/sd ticket update --uuid 93BF979E-08C1-11DD-94C3-D4B1FCEE7EC4 -- status=resolved

Updates

96

Page 97: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Bugs on my laptop aren’t interesting.

97

Page 98: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Jesse

sd publish --to fsck.com:public_html/sd/

CL

sd pull --from http://my.com/~jesse/sd

Sync!

98

Page 99: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

My project has a bug tracker

99

Page 100: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Actually, mine use two:

• RT

• hiveminder.com

My project has a bug tracker

99

Page 101: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Foreign Replicas

Prophet makes Foreign Replicas easy

SD gets them "for free"

100

Page 102: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

(Using only the public REST API)

It took an afternoon

Mirror an RT instance into SD

Share it with your peers using prophet

Sync changes back from your peers to RT

Supports Comments and Attachments

Wrote an RT Replica for SD

101

Page 103: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

(Using only the public REST API)

...and one for Hiveminder

102

Page 104: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

I can sync my bugs with RT or Hiveminder

103

Page 105: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Actually, it’s better

104

Page 106: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

I can sync between RT and Hiveminder

105

Page 107: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

I can sync between two different RTs, too

106

Page 108: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

• Trac

• Launchpad

• Google Code

• SourceForge

• Bugzilla

• Jira

• GForge

• debbugs

• GNATS

• todo.txt

• Lighthouse

• Redmine

• FogBugz

• What else?

We need more replica definitions:

107

Page 109: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

What else can you use Prophet for?

108

Page 110: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

All your “social” databases

109

Page 111: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

•CRM

•Bug tracking

•Sales orders

•Phone book

•Blog

•Trading Card Database

•Ideas?

All the databases you want while offline.

110

Page 112: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

How about a P2P BBS?

Prophet doesn’t need a server.

You can sync over sneakernet.

“Private” Social Networks

111

Page 113: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

A look inside Prophet

112

Page 114: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Anatomy of a Prophet Replica

113

Page 115: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

The bits and pieces

Database UUID

Replica UUID

Record Store

Changeset Store

Resolution Database

Configuration metadata

114

Page 116: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

The Record Store

Stores individual records by type

Not guaranteed to have all old versions

115

Page 117: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

The Changeset Store

Stores every change to a set of records

Guaranteed to have all old changesets

Replaying all changesets will create an exact clone of the replica

116

Page 118: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Replica Backends

117

Page 119: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Filesystem

Readable

Flat files

Compact

Fast

(Not yet fully atomic)

118

Page 120: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

HTTP

Designed to let you “publish” databases

Flat-files, Currently read-only.

Same format as the filesystem replica type.

119

Page 121: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Subversion (DEPRECATED)

Slow

Steady

Robust

Supports remote sync

Requires Subversion Perl Bindings

120

Page 122: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Backends are pluggable!

The filesystem is cheap and easy

The filesystem is portable

Help us write new backends:

CouchDB, SQLite, MySQL, Postgres, S3, AppEngine, $YOUR_FAVORITE_DB

121

Page 123: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Prophet is designed to sync with “other” databases and systems

They don’t need to support all of Prophet’s features - Prophet knows how to interpret mumbo-jumbo from the Cloud

Foreign Replicas will usually be app specific

All current examples are for SD

Foreign Replicas

122

Page 124: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Synchronization

123

Page 125: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Publish

Serialize and export all of a replica's resolutions and changesets

124

Page 126: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Pull

Integrate unseen resolutions and then unseen changesets from a replica

125

Page 127: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Push

Integrate new resolutions and changesets into a replica

126

Page 128: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Conflicts

127

Page 129: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Figures out the best resolution

“Nullifies” the conflict so the changeset can be cleanly integrated

Integrates the conflicting changeset

Records the resolution as a new changeset

Records the resolution decision in the resolution database

Resolving Conflicts

128

Page 130: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Prophet has clever ways to figure out the best resolution.

If there are previous resolutions for the same conflict and a majority agree, use that

If the merger has specified a “prefer this side” choice, use that

Prompt the user to make a decision, giving them info about previous decisions for this conflict

“The Best Resolution”

129

Page 131: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Scaling

130

Page 132: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Scaling to giant clusters is boring

(Can I play the “They’re not Green” card here?)

Scales to many weakly coonnected peers

You are not Google.

Does anyone here work for Google?

Current target is databases of O(50k) records

How does it scale?

131

Page 133: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

We have a political agenda.

Cloud computing is not Open Source.

APIs for “export” are not good enough.

You should always have full control.

You probably don’t need to store 10 billion records in one database.

Why not, then?

132

Page 134: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Do you have 10 billion bugs, customer contacts

or sales orders?

133

Page 135: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

That said, we'd love to see a scalable, high

performance prophet replica store

134

Page 136: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Getting Involved

135

Page 137: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Project Status

Simple, well-defined Perl API

RESTy web API (with microserver)

Fast, lightweight backend

Small, active dev community

Great test coverage

...less than great documentation coverage

136

Page 138: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Better ergonomics

Improved search and indexing

(Including full-text indexing)

Client libraries for other languages

Proper security model

More apps

Our Plans

137

Page 139: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Prophet

6937 lines of code and doc

1952 lines of tests

sd

2121 lines of code and doc

973 lines of tests

Codebase

138

Page 140: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Prophet is very young

Prophet designed in April

Prophet core implemented in April

SD designed in April

SD built in June and July

139

Page 141: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

We need your help!

Kick-ass functional and text indexing

Backend data store improvements

Slick GUIs for syncing

More Foreign Replicas for SD

Documentation improvements

A clever logo

New applications

140

Page 142: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

Prophet

http://syncwith.us/prophet/download

SD

http://syncwith.us/sd/download

Getting Prophet

141

Page 143: Prophet - assets.en.oreilly.comassets.en.oreilly.com/1/event/12/Prophet, your path out of the... · Gears, Adobe Air, etc? 57. ... CouchDB, SQLite, MySQL, Postgres, S3, AppEngine,

http://syncwith.us

[email protected]

#prophet on freenode IRC

Thanks!

142