HTTP API for Free?
Check out CouchDB
    Nils Breunese, VPRO
    N.Breunese@vpro.nl
          @breun
HTTP API

HTTP is simple
Every OS and programming language supports HTTP
Lots of tooling available: proxying, caching, mon...
DIY?
Relax!
Apache CouchDB

Document-oriented database
Built-in HTTP server
Map/Reduce
Replication
Written in Erlang, fast and reliable
CAP Theorem
Consistency: all nodes see the same data at the same time
Availability: node failures do not prevent survivors...
Eventual Consistency

              Consistency



                       Partition
     Availability
                    ...
CouchDB at VPRO
                         - Broadcasts
                         - Trailers
                         - Clips...
Document
What’s a Document?

JSON
Schemaless
Attachments
HTTP Document API
         Create         POST /db

          Read         GET /db/id

         Update        PUT /db/id

...
Views
{“_id”: “myid1”, keywords: [“foo”,”bar”], title: “title1”, ...}
{“_id”: “myid2”, keywords: [“foo”,”baz”], title: “ti...
Performance

Append-only B-trees (crash proof)
Views are pre-calculated indexes
Incremental map/reduce
Trade disk space fo...
HTTP View API
/{db}/_design/{ddoc}/_view/{view_name}
Query parameters:
   key=”foo”
   startkey, startkey_docid, endkey, e...
Using the API

Client-side: AJAX from browser (JSONP support in CouchDB)
   Invisible for search engines
Server-side
   Yo...
Formatting Data

Show function: transform a document into...
   SVG, HTML, MP3, etc.
List function: transform a view resul...
Next Episode
Media Archive
Mashups
Public API

Rewrite handlers for prettier URL’s
API keys, monitoring, etc.?
   You might need an extra layer
CouchApp

Replicatable HTML/JavaScript application
   Without any middleware!
CouchApp tool to manage design documents
More CouchDB
Website: http://couchdb.apache.org/
Book: http://guide.couchdb.org/
BigCouch: sharding
GeoCouch: support for ...
VPRO Digital


http://weblogs.vpro.nl/digitaal/ (Dutch)
Upcoming SlideShare
Loading in...5
×

HTTP API for Free? Check out CouchDB

2,304

Published on

Presentation on CouchDB and its usage at VPRO. Given at Magnolia Conference 2010 in Basel and NoSQL-NL Meetup #4 at VPRO in Hilversum.

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

No Downloads
Views
Total Views
2,304
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
30
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide























  • HTTP API for Free? Check out CouchDB

    1. 1. HTTP API for Free? Check out CouchDB Nils Breunese, VPRO N.Breunese@vpro.nl @breun
    2. 2. HTTP API HTTP is simple Every OS and programming language supports HTTP Lots of tooling available: proxying, caching, monitoring, etc. “Cool! So, how do I get one for my data?”
    3. 3. DIY?
    4. 4. Relax!
    5. 5. Apache CouchDB Document-oriented database Built-in HTTP server Map/Reduce Replication Written in Erlang, fast and reliable
    6. 6. CAP Theorem Consistency: all nodes see the same data at the same time Availability: node failures do not prevent survivors from continuing to operate Partition tolerance: the system continues to operate despite arbitrary message loss Choose any two; you can’t have all three
    7. 7. Eventual Consistency Consistency Partition Availability tolerance
    8. 8. CouchDB at VPRO - Broadcasts - Trailers - Clips Supplier 1 - Trailers - Etc. Media Supplier 2 Service Websites Etc. CouchDB ActiveMQ CouchDB Apps Twitter Publisher Mashup Etc. Flickr Harvester Etc. - Articles - Photos - Tweets - News - Etc.
    9. 9. Document
    10. 10. What’s a Document? JSON Schemaless Attachments
    11. 11. HTTP Document API Create POST /db Read GET /db/id Update PUT /db/id Delete DELETE /db/id (Also: HTTP Bulk Document API)
    12. 12. Views {“_id”: “myid1”, keywords: [“foo”,”bar”], title: “title1”, ...} {“_id”: “myid2”, keywords: [“foo”,”baz”], title: “title2”, ...} docs function(doc) { {key: “foo”, value: “title1”} doc.keywords.forEach(function(keyword) { {key: “foo”, value: “title2”} emit(keyword, doc.title); {key: “bar”, value: “title1”} }); {key: “baz”, value: “title2”} } map _count reduce {key: “foo”, value: 2} {key: “bar”, value: 1} {key: “baz”, value: 1}
    13. 13. Performance Append-only B-trees (crash proof) Views are pre-calculated indexes Incremental map/reduce Trade disk space for performance Very low RAM usage
    14. 14. HTTP View API /{db}/_design/{ddoc}/_view/{view_name} Query parameters: key=”foo” startkey, startkey_docid, endkey, endkey_docid limit, descending, skip, group, group_level, reduce /db/_design/unconf/_view/by_keyword?key=”foo”
    15. 15. Using the API Client-side: AJAX from browser (JSONP support in CouchDB) Invisible for search engines Server-side You can use a library like jcouchdb Indexable!
    16. 16. Formatting Data Show function: transform a document into... SVG, HTML, MP3, etc. List function: transform a view result RSS, etc.
    17. 17. Next Episode
    18. 18. Media Archive
    19. 19. Mashups
    20. 20. Public API Rewrite handlers for prettier URL’s API keys, monitoring, etc.? You might need an extra layer
    21. 21. CouchApp Replicatable HTML/JavaScript application Without any middleware! CouchApp tool to manage design documents
    22. 22. More CouchDB Website: http://couchdb.apache.org/ Book: http://guide.couchdb.org/ BigCouch: sharding GeoCouch: support for geospatial queries couchdb-lucene: full-text indexing and querying Myriad third-party libraries
    23. 23. VPRO Digital http://weblogs.vpro.nl/digitaal/ (Dutch)
    1. A particular slide catching your eye?

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

    ×