SlideShare una empresa de Scribd logo
1 de 26
Descargar para leer sin conexión
Relax!
                             Sebastian Cohnen
                              @tisba / tisba.de


Mittwoch, 16. November 11
About Me

                • Freier Entwickler
                ❤ Ruby/Rails & node.js
                ❤ Performance & Scalability Engineering
                ❤ Distributed Load Testing
                ❤ CouchDB, Redis & Riak
                und ebenfalls interessiert an Erlang, AMQP, ...



Mittwoch, 16. November 11
Users of Couchdb

                            BBC

                            meebo

                            UbuntuOne

                            ...

                            adcloud




Mittwoch, 16. November 11
CouchDB: Basics


                            Schema-frei

                            Dokumenten-orientiert

                            Key/Value-Speicher

                            fehlertolerant & robust




Mittwoch, 16. November 11
Key Features

                            HTTP + JSON

                            Multi-Master Replikation

                            AP aus CAP

                            Append-only

                            inkrementelle, materialisierte Views (map/reduce)




Mittwoch, 16. November 11
HTTP & JSON




Mittwoch, 16. November 11
Admin Interface




Mittwoch, 16. November 11
Create A Database

                 $ curl -w%{http_code} -X PUT http://127.0.0.1:5984/test_db ↵
                 {"ok":true}
                 201


                 $ $ curl -w%{http_code} -X GET http://127.0.0.1:5984/test_db
                 ↵
                 {"db_name":"test_db","doc_count":0,"doc_del_count":0,
                 "update_seq":1,"purge_seq":0, "compact_running":false,
                 "disk_size":16473, "instance_start_time":
                 "1253091887127542","disk_format_version":4}
                 200




                                           *   $ alias curl='curl -w%{http_code} -X'

Mittwoch, 16. November 11
create A Document
                 $ curl POST -d '{"hello":"world"}' http://127.0.0.1:5984/
                 test_db ↵
                 {"ok":true,"id":"67729d5013cf3f8858eb29cb17e5a723","rev":"1-1
                 5f65339921e497348be384867bb940f"}
                 201




                                       read
                 $ curl GET http://127.0.0.1:5984/test_db/
                 67729d5013cf3f8858eb29cb17e5a723 ↵
                 {"_id":"67729d5013cf3f8858eb29cb17e5a723","_rev":"1-15f653399
                 21e497348be384867bb940f","hello":"world"}
                 200




Mittwoch, 16. November 11
update
                 $ curl PUT -d 
                 '{"_rev":"1-15f65339921e497348be384867bb940f",
                 "hello":"world","message":"about to show CRUD in couch"}'
                 http://127.0.0.1:5984/test_db/ 
                 2f41f56816191b94ecbd127151faa242 ↵
                 {"ok":true,"id":"2f41f56816191b94ecbd127151faa242","rev":"2-2
                 873c60120aa6dbe2204cd2c1a0e8722"}
                 201


                 $ curl GET http://127.0.0.1:5984/test_db/ 
                 2f41f56816191b94ecbd127151faa242 ↵
                 {"_id":"2f41f56816191b94ecbd127151faa242","_rev":"2-2873c6012
                 0aa6dbe2204cd2c1a0e8722","hello":"world","message":"about to
                 show CRUD in couch"}
                 200




Mittwoch, 16. November 11
delete
                 $ curl DELETE http://127.0.0.1:5984/test_db/ 
                 67729d5013cf3f8858eb29cb17e5a723? 
                 rev=1-15f65339921e497348be384867bb940f ↵
                 {"ok":true,"id":"67729d5013cf3f8858eb29cb17e5a723","rev":"2-2
                 d715caed35974bb33de24d1d6c95779"}
                 200


                 $ curl GET http://127.0.0.1:5984/test_db/ 
                 67729d5013cf3f8858eb29cb17e5a723 ↵
                 {"error":"not_found","reason":"deleted"}
                 404




Mittwoch, 16. November 11
CouchApps

                            Dokumente können Attachments haben

                            CouchDB als HTTP Server

                            HTML+CSS+JS ausgeliefert von CouchDB greift via
                            HTTP auf CouchDB als Datenbank zu

                            Beispiel: Kabul War Diary
                            http://upondata.com:5984/afgwar/_design/afgwardiary/
                            index.html



Mittwoch, 16. November 11
Replikation




Mittwoch, 16. November 11
Replikation
                            Replikation läuft via HTTP

                            asynchron

                            inkrementell (online-offline)

                            automatische Konfliktlösung

                            Multi-Version Concurrency Control (MVCC)

                            Multi-Master als default

                            filterbar


Mittwoch, 16. November 11
Map/Reduce Views




Mittwoch, 16. November 11
Accessing Data

                            direkter Zugriff via http://server/DATABASE/DOC-ID

                            materialisierte Views

                               bestehen aus einer map-Phase

                               und einer optionalen reduce-Phase

                            show & list: (Dokument) Transformationen

                            filters, externals, ...



Mittwoch, 16. November 11
Views

                            sortiert, inkrementell, effizienter Zugriff via B-Trees

                            build-in Viewserver:

                               JavaScript (Spidermonkey)

                               Erlang

                            3rd Party Viewserver in Ruby, Python, Java, Perl, ...




Mittwoch, 16. November 11
map/reduce

                            map: Eine Funktion, welche key/value Paare in einen
                            Index schreibt

                            Beispiel Tag-Cloud:

                 1     function(doc) {
                 2       if (doc.tags) {
                 3         for(var idx in doc.tags) {
                 4             emit(doc.tags[idx], 1);
                 5         }
                 6       }
                 7     }




Mittwoch, 16. November 11
map example

                 {“body”:”[...]”, “tags”:[“erlang”, “couchdb”]}
                 {“body”:”[...]”, “tags”:[“couchdb”, “talk”, “rails”]}


                                                     map-function(doc)


                 {“key”:“couchdb”, “value”:1}
                 {“key”:“couchdb”, “value”:1}
                 {“key”:“erlang”, “value”:1}
                 {“key”:“rails”, “value”:1}
                 {“key”:“talk”, “value”:1}

                * indices are automatically sorted




Mittwoch, 16. November 11
map/reduce


                            reduce wird verwendet, um das Ergebnis der map-
                            Phase zu verarbeiten


                 1     function(keys, values, rereduce) {
                 2       return sum(values);
                 3     }




Mittwoch, 16. November 11
reduce example
                 {“key”:“erlang”: “value”:1}
                 {“key”:“couchdb”: “value”:1}
                 {“key”:“couchdb”: “value”:1}
                 {“key”:“talk”: “value”:1}
                 {“key”:“rails”: “value”:1}



                                   reduce function(...)


                 {"key":"erlang","value":1}
                 {"key":"couchdb","value":2}
                 {"key":"talk","value":1}
                 {"key":"rails","value":1}




Mittwoch, 16. November 11
CouchDB: Pros


                            HTTP (Proxy, Caches, Loadbalancer, ...)

                            HTTP (CouchDB als Webserver, 2-tier Apps!)

                            Replikation

                            Views sind sortiert; effizienter Zugriff auf Ranges




Mittwoch, 16. November 11
Cons


                            Append-only erfordert Compaction

                            Append-only & MVCC/Konfliktlösung führen zu
                            Probleme bei Update-heavy Anwendungen

                            keine verteilte Datenbank (sharding, clustering)




Mittwoch, 16. November 11
Get it!
                            http://couchdb.apache.org/downloads.html

                               brew install couchdb / apt-get install couchdb / ...

                            freies Hosting: www.iriscouch.com

                            BigCouch (cloudant.com / https://github.com/cloudant/bigcouch)

                               dynamo-style CouchDB Cluster

                            Couchbase (www.couchbase.com)

                               Membase+CouchDB


Mittwoch, 16. November 11
Thanks! Q & A?


                                     ?
                                 Sebastian Cohnen
                                      @tisba


Mittwoch, 16. November 11
Understanding
                               reduce
                 1     function(keys, values, rereduce) {}


                            a b c d | e f g h | i j k l | m n
                            1 2 1 3 | 1 2 3 1 | 2 3 3 1 | 1 8
                               7         7    |     9       9
                                  14                    18
                                             32

                  function(     [[“a”,id1],[“b”,id2],[“c”,id3],[“d”,id4]],
                                 [1,         2,       1,        3],
                                false) {...}


                  function(null, [ 7, 7], true) {...}
                  function(null, [ 9, 9], true) {...}
                  function(null, [14,18], true) {...}

Mittwoch, 16. November 11

Más contenido relacionado

La actualidad más candente

Lua tech talk
Lua tech talkLua tech talk
Lua tech talkLocaweb
 
Node.js - A practical introduction (v2)
Node.js  - A practical introduction (v2)Node.js  - A practical introduction (v2)
Node.js - A practical introduction (v2)Felix Geisendörfer
 
Database schema management in Ruby apps
Database schema management in Ruby appsDatabase schema management in Ruby apps
Database schema management in Ruby appsVsevolod Romashov
 
Py conkr 20150829_docker-python
Py conkr 20150829_docker-pythonPy conkr 20150829_docker-python
Py conkr 20150829_docker-pythonEric Ahn
 
BlockChain implementation by python
BlockChain implementation by pythonBlockChain implementation by python
BlockChain implementation by pythonwonyong hwang
 
Miscelaneous Debris
Miscelaneous DebrisMiscelaneous Debris
Miscelaneous Debrisfrewmbot
 
Ansible leveraging 2.0
Ansible leveraging 2.0Ansible leveraging 2.0
Ansible leveraging 2.0bcoca
 
No REST for the Wicked: REST and Catalyst
No REST for the Wicked: REST and CatalystNo REST for the Wicked: REST and Catalyst
No REST for the Wicked: REST and CatalystJay Shirley
 
Challenges when building high profile editorial sites
Challenges when building high profile editorial sitesChallenges when building high profile editorial sites
Challenges when building high profile editorial sitesYann Malet
 
Devon 2011-f-4-improve your-javascript
Devon 2011-f-4-improve your-javascriptDevon 2011-f-4-improve your-javascript
Devon 2011-f-4-improve your-javascriptDaum DNA
 
Developing JavaScript Widgets
Developing JavaScript WidgetsDeveloping JavaScript Widgets
Developing JavaScript WidgetsKonstantin Käfer
 
Redis - Usability and Use Cases
Redis - Usability and Use CasesRedis - Usability and Use Cases
Redis - Usability and Use CasesFabrizio Farinacci
 
Who is afraid of privileged containers ?
Who is afraid of privileged containers ?Who is afraid of privileged containers ?
Who is afraid of privileged containers ?Marko Bevc
 
第一回MongoDBソースコードリーディング
第一回MongoDBソースコードリーディング第一回MongoDBソースコードリーディング
第一回MongoDBソースコードリーディングnobu_k
 
Kicking ass with redis
Kicking ass with redisKicking ass with redis
Kicking ass with redisDvir Volk
 

La actualidad más candente (20)

What is nodejs
What is nodejsWhat is nodejs
What is nodejs
 
Couchdb w Ruby'm
Couchdb w Ruby'mCouchdb w Ruby'm
Couchdb w Ruby'm
 
Lua tech talk
Lua tech talkLua tech talk
Lua tech talk
 
Node.js - A practical introduction (v2)
Node.js  - A practical introduction (v2)Node.js  - A practical introduction (v2)
Node.js - A practical introduction (v2)
 
Database schema management in Ruby apps
Database schema management in Ruby appsDatabase schema management in Ruby apps
Database schema management in Ruby apps
 
Py conkr 20150829_docker-python
Py conkr 20150829_docker-pythonPy conkr 20150829_docker-python
Py conkr 20150829_docker-python
 
BlockChain implementation by python
BlockChain implementation by pythonBlockChain implementation by python
BlockChain implementation by python
 
Miscelaneous Debris
Miscelaneous DebrisMiscelaneous Debris
Miscelaneous Debris
 
Node.js - A Quick Tour II
Node.js - A Quick Tour IINode.js - A Quick Tour II
Node.js - A Quick Tour II
 
Ansible leveraging 2.0
Ansible leveraging 2.0Ansible leveraging 2.0
Ansible leveraging 2.0
 
No REST for the Wicked: REST and Catalyst
No REST for the Wicked: REST and CatalystNo REST for the Wicked: REST and Catalyst
No REST for the Wicked: REST and Catalyst
 
Challenges when building high profile editorial sites
Challenges when building high profile editorial sitesChallenges when building high profile editorial sites
Challenges when building high profile editorial sites
 
Ubic
UbicUbic
Ubic
 
Devon 2011-f-4-improve your-javascript
Devon 2011-f-4-improve your-javascriptDevon 2011-f-4-improve your-javascript
Devon 2011-f-4-improve your-javascript
 
Developing JavaScript Widgets
Developing JavaScript WidgetsDeveloping JavaScript Widgets
Developing JavaScript Widgets
 
Redis - Usability and Use Cases
Redis - Usability and Use CasesRedis - Usability and Use Cases
Redis - Usability and Use Cases
 
Puppet fundamentals
Puppet fundamentalsPuppet fundamentals
Puppet fundamentals
 
Who is afraid of privileged containers ?
Who is afraid of privileged containers ?Who is afraid of privileged containers ?
Who is afraid of privileged containers ?
 
第一回MongoDBソースコードリーディング
第一回MongoDBソースコードリーディング第一回MongoDBソースコードリーディング
第一回MongoDBソースコードリーディング
 
Kicking ass with redis
Kicking ass with redisKicking ass with redis
Kicking ass with redis
 

Destacado

Erlang web framework: Chicago boss
Erlang web framework: Chicago bossErlang web framework: Chicago boss
Erlang web framework: Chicago bossBarcamp Saigon
 
Movement, Empathie und die Sehnsucht nach Rhythmus
Movement, Empathie und die Sehnsucht nach RhythmusMovement, Empathie und die Sehnsucht nach Rhythmus
Movement, Empathie und die Sehnsucht nach RhythmusDirk Platzek
 
Einführung in nosql // ArangoDB mit Symfony 2
Einführung in nosql // ArangoDB mit Symfony 2Einführung in nosql // ArangoDB mit Symfony 2
Einführung in nosql // ArangoDB mit Symfony 2ArangoDB Database
 
OpenData - Was hat das mit mir zu tun? @RSE13
OpenData - Was hat das mit mir zu tun? @RSE13OpenData - Was hat das mit mir zu tun? @RSE13
OpenData - Was hat das mit mir zu tun? @RSE13Matthias Mueller-Prove
 

Destacado (6)

Erlang web framework: Chicago boss
Erlang web framework: Chicago bossErlang web framework: Chicago boss
Erlang web framework: Chicago boss
 
NoSQL CGN: Riak (01/2012)
NoSQL CGN: Riak (01/2012)NoSQL CGN: Riak (01/2012)
NoSQL CGN: Riak (01/2012)
 
Artist in Transit @RSE11
Artist in Transit @RSE11Artist in Transit @RSE11
Artist in Transit @RSE11
 
Movement, Empathie und die Sehnsucht nach Rhythmus
Movement, Empathie und die Sehnsucht nach RhythmusMovement, Empathie und die Sehnsucht nach Rhythmus
Movement, Empathie und die Sehnsucht nach Rhythmus
 
Einführung in nosql // ArangoDB mit Symfony 2
Einführung in nosql // ArangoDB mit Symfony 2Einführung in nosql // ArangoDB mit Symfony 2
Einführung in nosql // ArangoDB mit Symfony 2
 
OpenData - Was hat das mit mir zu tun? @RSE13
OpenData - Was hat das mit mir zu tun? @RSE13OpenData - Was hat das mit mir zu tun? @RSE13
OpenData - Was hat das mit mir zu tun? @RSE13
 

Similar a NoSQL CGN: CouchDB (11/2011)

CouchDB Mobile - From Couch to 5K in 1 Hour
CouchDB Mobile - From Couch to 5K in 1 HourCouchDB Mobile - From Couch to 5K in 1 Hour
CouchDB Mobile - From Couch to 5K in 1 HourPeter Friese
 
Craig Brown speaks on ElasticSearch
Craig Brown speaks on ElasticSearchCraig Brown speaks on ElasticSearch
Craig Brown speaks on ElasticSearchimarcticblue
 
elasticsearch basics workshop
elasticsearch basics workshopelasticsearch basics workshop
elasticsearch basics workshopMathieu Elie
 
De vuelta al pasado con SQL y stored procedures
De vuelta al pasado con SQL y stored proceduresDe vuelta al pasado con SQL y stored procedures
De vuelta al pasado con SQL y stored proceduresNorman Clarke
 
CouchDB Open Source Bridge
CouchDB Open Source BridgeCouchDB Open Source Bridge
CouchDB Open Source BridgeChris Anderson
 
Rupy2012 ArangoDB Workshop Part1
Rupy2012 ArangoDB Workshop Part1Rupy2012 ArangoDB Workshop Part1
Rupy2012 ArangoDB Workshop Part1ArangoDB Database
 
Advanced CouchDB Rotterdam.rb July 2010
Advanced CouchDB Rotterdam.rb July 2010Advanced CouchDB Rotterdam.rb July 2010
Advanced CouchDB Rotterdam.rb July 2010Sander van de Graaf
 
MongoDB .local Toronto 2019: Using Change Streams to Keep Up with Your Data
MongoDB .local Toronto 2019: Using Change Streams to Keep Up with Your DataMongoDB .local Toronto 2019: Using Change Streams to Keep Up with Your Data
MongoDB .local Toronto 2019: Using Change Streams to Keep Up with Your DataMongoDB
 
Putting rails and couch db on the cloud - Indicthreads cloud computing confe...
Putting rails and couch db on the cloud -  Indicthreads cloud computing confe...Putting rails and couch db on the cloud -  Indicthreads cloud computing confe...
Putting rails and couch db on the cloud - Indicthreads cloud computing confe...IndicThreads
 
CouchDB at JAOO Århus 2009
CouchDB at JAOO Århus 2009CouchDB at JAOO Århus 2009
CouchDB at JAOO Århus 2009Jason Davies
 
NoSQL - An introduction to CouchDB
NoSQL - An introduction to CouchDBNoSQL - An introduction to CouchDB
NoSQL - An introduction to CouchDBJonathan Weiss
 
DataMapper on Infinispan
DataMapper on InfinispanDataMapper on Infinispan
DataMapper on InfinispanLance Ball
 
Puppet and AWS: Getting the best of both worlds
Puppet and AWS: Getting the best of both worldsPuppet and AWS: Getting the best of both worlds
Puppet and AWS: Getting the best of both worldsPuppet
 
Meetup#1: 10 reasons to fall in love with MongoDB
Meetup#1: 10 reasons to fall in love with MongoDBMeetup#1: 10 reasons to fall in love with MongoDB
Meetup#1: 10 reasons to fall in love with MongoDBMinsk MongoDB User Group
 
Data manipulation for configuration management using Ansible
Data manipulation for configuration management using AnsibleData manipulation for configuration management using Ansible
Data manipulation for configuration management using AnsibleJoel W. King
 
Elasticsearch – mye mer enn søk! [JavaZone 2013]
Elasticsearch – mye mer enn søk! [JavaZone 2013]Elasticsearch – mye mer enn søk! [JavaZone 2013]
Elasticsearch – mye mer enn søk! [JavaZone 2013]foundsearch
 
CouchDB : More Couch
CouchDB : More CouchCouchDB : More Couch
CouchDB : More Couchdelagoya
 
CouchDB on Rails - FrozenRails 2010
CouchDB on Rails - FrozenRails 2010CouchDB on Rails - FrozenRails 2010
CouchDB on Rails - FrozenRails 2010Jonathan Weiss
 

Similar a NoSQL CGN: CouchDB (11/2011) (20)

CouchDB Mobile - From Couch to 5K in 1 Hour
CouchDB Mobile - From Couch to 5K in 1 HourCouchDB Mobile - From Couch to 5K in 1 Hour
CouchDB Mobile - From Couch to 5K in 1 Hour
 
Craig Brown speaks on ElasticSearch
Craig Brown speaks on ElasticSearchCraig Brown speaks on ElasticSearch
Craig Brown speaks on ElasticSearch
 
elasticsearch basics workshop
elasticsearch basics workshopelasticsearch basics workshop
elasticsearch basics workshop
 
De vuelta al pasado con SQL y stored procedures
De vuelta al pasado con SQL y stored proceduresDe vuelta al pasado con SQL y stored procedures
De vuelta al pasado con SQL y stored procedures
 
CouchDB Open Source Bridge
CouchDB Open Source BridgeCouchDB Open Source Bridge
CouchDB Open Source Bridge
 
Couchdb Nosql
Couchdb NosqlCouchdb Nosql
Couchdb Nosql
 
Play framework
Play frameworkPlay framework
Play framework
 
Rupy2012 ArangoDB Workshop Part1
Rupy2012 ArangoDB Workshop Part1Rupy2012 ArangoDB Workshop Part1
Rupy2012 ArangoDB Workshop Part1
 
Advanced CouchDB Rotterdam.rb July 2010
Advanced CouchDB Rotterdam.rb July 2010Advanced CouchDB Rotterdam.rb July 2010
Advanced CouchDB Rotterdam.rb July 2010
 
MongoDB .local Toronto 2019: Using Change Streams to Keep Up with Your Data
MongoDB .local Toronto 2019: Using Change Streams to Keep Up with Your DataMongoDB .local Toronto 2019: Using Change Streams to Keep Up with Your Data
MongoDB .local Toronto 2019: Using Change Streams to Keep Up with Your Data
 
Putting rails and couch db on the cloud - Indicthreads cloud computing confe...
Putting rails and couch db on the cloud -  Indicthreads cloud computing confe...Putting rails and couch db on the cloud -  Indicthreads cloud computing confe...
Putting rails and couch db on the cloud - Indicthreads cloud computing confe...
 
CouchDB at JAOO Århus 2009
CouchDB at JAOO Århus 2009CouchDB at JAOO Århus 2009
CouchDB at JAOO Århus 2009
 
NoSQL - An introduction to CouchDB
NoSQL - An introduction to CouchDBNoSQL - An introduction to CouchDB
NoSQL - An introduction to CouchDB
 
DataMapper on Infinispan
DataMapper on InfinispanDataMapper on Infinispan
DataMapper on Infinispan
 
Puppet and AWS: Getting the best of both worlds
Puppet and AWS: Getting the best of both worldsPuppet and AWS: Getting the best of both worlds
Puppet and AWS: Getting the best of both worlds
 
Meetup#1: 10 reasons to fall in love with MongoDB
Meetup#1: 10 reasons to fall in love with MongoDBMeetup#1: 10 reasons to fall in love with MongoDB
Meetup#1: 10 reasons to fall in love with MongoDB
 
Data manipulation for configuration management using Ansible
Data manipulation for configuration management using AnsibleData manipulation for configuration management using Ansible
Data manipulation for configuration management using Ansible
 
Elasticsearch – mye mer enn søk! [JavaZone 2013]
Elasticsearch – mye mer enn søk! [JavaZone 2013]Elasticsearch – mye mer enn søk! [JavaZone 2013]
Elasticsearch – mye mer enn søk! [JavaZone 2013]
 
CouchDB : More Couch
CouchDB : More CouchCouchDB : More Couch
CouchDB : More Couch
 
CouchDB on Rails - FrozenRails 2010
CouchDB on Rails - FrozenRails 2010CouchDB on Rails - FrozenRails 2010
CouchDB on Rails - FrozenRails 2010
 

Último

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 

Último (20)

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 

NoSQL CGN: CouchDB (11/2011)

  • 1. Relax! Sebastian Cohnen @tisba / tisba.de Mittwoch, 16. November 11
  • 2. About Me • Freier Entwickler ❤ Ruby/Rails & node.js ❤ Performance & Scalability Engineering ❤ Distributed Load Testing ❤ CouchDB, Redis & Riak und ebenfalls interessiert an Erlang, AMQP, ... Mittwoch, 16. November 11
  • 3. Users of Couchdb BBC meebo UbuntuOne ... adcloud Mittwoch, 16. November 11
  • 4. CouchDB: Basics Schema-frei Dokumenten-orientiert Key/Value-Speicher fehlertolerant & robust Mittwoch, 16. November 11
  • 5. Key Features HTTP + JSON Multi-Master Replikation AP aus CAP Append-only inkrementelle, materialisierte Views (map/reduce) Mittwoch, 16. November 11
  • 6. HTTP & JSON Mittwoch, 16. November 11
  • 8. Create A Database $ curl -w%{http_code} -X PUT http://127.0.0.1:5984/test_db ↵ {"ok":true} 201 $ $ curl -w%{http_code} -X GET http://127.0.0.1:5984/test_db ↵ {"db_name":"test_db","doc_count":0,"doc_del_count":0, "update_seq":1,"purge_seq":0, "compact_running":false, "disk_size":16473, "instance_start_time": "1253091887127542","disk_format_version":4} 200 * $ alias curl='curl -w%{http_code} -X' Mittwoch, 16. November 11
  • 9. create A Document $ curl POST -d '{"hello":"world"}' http://127.0.0.1:5984/ test_db ↵ {"ok":true,"id":"67729d5013cf3f8858eb29cb17e5a723","rev":"1-1 5f65339921e497348be384867bb940f"} 201 read $ curl GET http://127.0.0.1:5984/test_db/ 67729d5013cf3f8858eb29cb17e5a723 ↵ {"_id":"67729d5013cf3f8858eb29cb17e5a723","_rev":"1-15f653399 21e497348be384867bb940f","hello":"world"} 200 Mittwoch, 16. November 11
  • 10. update $ curl PUT -d '{"_rev":"1-15f65339921e497348be384867bb940f", "hello":"world","message":"about to show CRUD in couch"}' http://127.0.0.1:5984/test_db/ 2f41f56816191b94ecbd127151faa242 ↵ {"ok":true,"id":"2f41f56816191b94ecbd127151faa242","rev":"2-2 873c60120aa6dbe2204cd2c1a0e8722"} 201 $ curl GET http://127.0.0.1:5984/test_db/ 2f41f56816191b94ecbd127151faa242 ↵ {"_id":"2f41f56816191b94ecbd127151faa242","_rev":"2-2873c6012 0aa6dbe2204cd2c1a0e8722","hello":"world","message":"about to show CRUD in couch"} 200 Mittwoch, 16. November 11
  • 11. delete $ curl DELETE http://127.0.0.1:5984/test_db/ 67729d5013cf3f8858eb29cb17e5a723? rev=1-15f65339921e497348be384867bb940f ↵ {"ok":true,"id":"67729d5013cf3f8858eb29cb17e5a723","rev":"2-2 d715caed35974bb33de24d1d6c95779"} 200 $ curl GET http://127.0.0.1:5984/test_db/ 67729d5013cf3f8858eb29cb17e5a723 ↵ {"error":"not_found","reason":"deleted"} 404 Mittwoch, 16. November 11
  • 12. CouchApps Dokumente können Attachments haben CouchDB als HTTP Server HTML+CSS+JS ausgeliefert von CouchDB greift via HTTP auf CouchDB als Datenbank zu Beispiel: Kabul War Diary http://upondata.com:5984/afgwar/_design/afgwardiary/ index.html Mittwoch, 16. November 11
  • 14. Replikation Replikation läuft via HTTP asynchron inkrementell (online-offline) automatische Konfliktlösung Multi-Version Concurrency Control (MVCC) Multi-Master als default filterbar Mittwoch, 16. November 11
  • 16. Accessing Data direkter Zugriff via http://server/DATABASE/DOC-ID materialisierte Views bestehen aus einer map-Phase und einer optionalen reduce-Phase show & list: (Dokument) Transformationen filters, externals, ... Mittwoch, 16. November 11
  • 17. Views sortiert, inkrementell, effizienter Zugriff via B-Trees build-in Viewserver: JavaScript (Spidermonkey) Erlang 3rd Party Viewserver in Ruby, Python, Java, Perl, ... Mittwoch, 16. November 11
  • 18. map/reduce map: Eine Funktion, welche key/value Paare in einen Index schreibt Beispiel Tag-Cloud: 1 function(doc) { 2 if (doc.tags) { 3 for(var idx in doc.tags) { 4 emit(doc.tags[idx], 1); 5 } 6 } 7 } Mittwoch, 16. November 11
  • 19. map example {“body”:”[...]”, “tags”:[“erlang”, “couchdb”]} {“body”:”[...]”, “tags”:[“couchdb”, “talk”, “rails”]} map-function(doc) {“key”:“couchdb”, “value”:1} {“key”:“couchdb”, “value”:1} {“key”:“erlang”, “value”:1} {“key”:“rails”, “value”:1} {“key”:“talk”, “value”:1} * indices are automatically sorted Mittwoch, 16. November 11
  • 20. map/reduce reduce wird verwendet, um das Ergebnis der map- Phase zu verarbeiten 1 function(keys, values, rereduce) { 2 return sum(values); 3 } Mittwoch, 16. November 11
  • 21. reduce example {“key”:“erlang”: “value”:1} {“key”:“couchdb”: “value”:1} {“key”:“couchdb”: “value”:1} {“key”:“talk”: “value”:1} {“key”:“rails”: “value”:1} reduce function(...) {"key":"erlang","value":1} {"key":"couchdb","value":2} {"key":"talk","value":1} {"key":"rails","value":1} Mittwoch, 16. November 11
  • 22. CouchDB: Pros HTTP (Proxy, Caches, Loadbalancer, ...) HTTP (CouchDB als Webserver, 2-tier Apps!) Replikation Views sind sortiert; effizienter Zugriff auf Ranges Mittwoch, 16. November 11
  • 23. Cons Append-only erfordert Compaction Append-only & MVCC/Konfliktlösung führen zu Probleme bei Update-heavy Anwendungen keine verteilte Datenbank (sharding, clustering) Mittwoch, 16. November 11
  • 24. Get it! http://couchdb.apache.org/downloads.html brew install couchdb / apt-get install couchdb / ... freies Hosting: www.iriscouch.com BigCouch (cloudant.com / https://github.com/cloudant/bigcouch) dynamo-style CouchDB Cluster Couchbase (www.couchbase.com) Membase+CouchDB Mittwoch, 16. November 11
  • 25. Thanks! Q & A? ? Sebastian Cohnen @tisba Mittwoch, 16. November 11
  • 26. Understanding reduce 1 function(keys, values, rereduce) {} a b c d | e f g h | i j k l | m n 1 2 1 3 | 1 2 3 1 | 2 3 3 1 | 1 8 7 7 | 9 9 14 18 32 function( [[“a”,id1],[“b”,id2],[“c”,id3],[“d”,id4]], [1, 2, 1, 3], false) {...} function(null, [ 7, 7], true) {...} function(null, [ 9, 9], true) {...} function(null, [14,18], true) {...} Mittwoch, 16. November 11