SlideShare a Scribd company logo
1 of 90
Download to read offline
CouchDB
     relax
CouchDB
     relax
 Sander van de Graaf
      svdgraaf
RELAX...
PERFORM LIKE A PR0N STAR
TOPICS
• NoSQL

• CouchDB      in a nutshell
• Querying

• map/reduce

• Fulltext   search
• CouchApps
NOSQL
IT’S A MOVEMENT
1998
Carlo Strozzi
NOSQL == Not Only SQL
“[The NoSQL movement] departs from the relational
model altogether, it should therefore have been called
more appropriately ‘NoREL’, or something to that
effect.”
                                         - Carlo Strozzi
LANDSCAPE
DISTRIBUTED VS NON-DISTRIBUTED

             Distributed       Non distributed
  Amazon Dynamo            Redis
  Amazon S3                Tokyo Tyrant
  Scalaris                 MemcacheDb
  CouchDB                  Amazon SimpleDb
  Voldemort
  Riak
  MongoDb
  BigTable
  Cassandra
  HyperTable
  HBase

                                             source: Vineet Gupta http://bit.ly/5kuQgB
DATAMODEL STORAGE
        Key/Value      Document            Column

Amazon Dynamo       Amazon SimpleDb   Cassandra

Amazon S3           CouchDB           Google BigTable

Redis               MongoDb           HBase

Scalaris            Riak              Hyperbase

Voldemort
STORAGE
    Memory    Configurable          Disk

Scalaris     BigTable       CouchDB


Redis        Cassandra      MongoDb


             Hbase          Riak


             HyperTable     Voldemort
CouchDB
     relax
JAVASCRIPT
NUTSHELL
SPEED
APPEND ONLY
NO REPAIR NEEDED
COMPACTING
HTTP SERVER
CAP
CouchDB




 CAP
CouchDB




EVENTUALLY CONSISTENT
ALLTHINGSDISTRIBUTED.COM
FULL REST API
REST
• GET        • SELECT

• PUT        • UPDATE

• POST       • INSERT

• DELETE     • DELETE

• COPY       • ...
JSON
{
    total_rows: 2,
    offset: 0,
    rows: [
        {
            id: '_design/foobar',
            key: '_design/foobar',
            value: { rev: '5-982b2fc36835715b2aae54609b5d5f1e' }
        },
        {
            id: 'f0e1fd96eb6e094f74dda8d949000a6a',
            key: 'f0e1fd96eb6e094f74dda8d949000a6a',
            value: { rev: '1-86bca407fce8234a63c90ff549b56b10' }
        },
    ]
}
REPLICATION
CouchDB
     relax
CouchDB
     relax
             CouchDB
                  relax
CouchDB
                  relax




CouchDB
     relax
             CouchDB
                  relax




             CouchDB
                  relax
CouchDB
     relax
             CouchDB
                  relax
CouchDB
                  relax




CouchDB
     relax




             CouchDB
                  relax
Laptop   Desktop


                 CouchDB
                      relax




CouchDB
     relax    Phone


                 CouchDB
                      relax
US   NL


              CouchDB
                   relax




CouchDB
     relax




              CouchDB
                   relax
IDG US                                   IDG AUSTRALIA




               CouchDB
                    relax
                            CouchDB
                                 relax      CouchDB
                                                 relax




  CouchDB
       relax
               CouchDB
                    relax                   CouchDB
                                                 relax




                                            CouchDB
                                                 relax




               CouchDB
                    relax
                                            CouchDB
                                                 relax

IDG NL                                         IDG DE
IDG US                      IDG Australia                     IDG Poland                   IDG Romania



               CouchDB
                    relax
                                   CouchDB
                                        relax
                                                CouchDB
                                                     relax
                                                                                                         CouchDB
                                                                                                              relax




                                                                             CouchDB                     CouchDB
  CouchDB
       relax
               CouchDB
                    relax
                                                CouchDB
                                                     relax
                                                                                  relax                       relax




IDG NL                       IDG UK                           IDG Spania                  IDG Portugal



                                                CouchDB
                                                     relax




               CouchDB
                    relax                       CouchDB         CouchDB      CouchDB                     CouchDB
                                                     relax           relax        relax                       relax




IDG Germany                 IDG Brasil                       IDG Ghana                    IDG Hungary


                                                                             CouchDB
                                                                                  relax




               CouchDB
                    relax
                                                CouchDB
                                                     relax      CouchDB      CouchDB
                                                                     relax        relax




IDG India                   IDG Thailand                     IDG Japan                    IDG Vietnam


               CouchDB
                    relax
                                                CouchDB
                                                     relax
                                                                             CouchDB
                                                                                  relax




                                                                CouchDB
                                                                     relax
                                                                             CouchDB
                                                                                  relax
                                                                                                         CouchDB
                                                                                                              relax
P2P WEB
QUERYING
SELECT * FROM documents WHERE id = 123



          GET /documents/123
SELECT * FROM documents WHERE id = 123



          GET /documents/123
          PUT /documents/123
          POST /documents/123
         DELETE /documents/123
                 etc.
MAP/REDUCE
INPUT
      IP                 Bytes
212.122.174.13           18271
212.122.174.13           191726
212.122.174.13            198
 74.119.8.111            91272
 74.119.8.111             8371
212.122.174.13             43
MAPPER => REDUCER
      IP         Bytes
                 18271
                 191726
212.122.174.13
                  198
                   43
                 91272
 74.119.8.111
                  8371
AFTER REDUCE
      IP          Bytes



212.122.174.13   210238




 74.119.8.111    99643
MAP/REDUCE

SELECT COUNT(foo)
FROM documents
WHERE 1
GROUP BY foo;
MAP/REDUCE
MAP/REDUCE

function(doc) {
  emit(doc.foo, doc);
}
MAP/REDUCE
MAP/REDUCE

function(keys, values, rereduce) {
    return sum(values);
}
MAP/REDUCE
COUCHDB-LUCENE
http://github.com/rnewson/couchdb-lucene
CONFIG
[external]
fti=/path/to/python /path/to/couchdb-lucene/tools/couchdb-external-hook.py

[httpd_db_handlers]
_fti = {couch_httpd_external, handle_external_req, <<"fti">>}
http://127.0.0.1:5984> GET /foobar/_design/foobar
_DESIGN

{
    _id: '_design/foobar',
    _rev: '8-03a6bc983c721b1cc0ae4b461326bc31',
    language: 'javascript',
    views: {
        foo: { map: 'function(doc) {n emit(doc.foo,1);n}',
        reduce: 'function(keys, values, rereduce) {return sum(values);}' }
    }
}
_DESIGN

{
    _id: '_design/foobar',
    _rev: '8-03a6bc983c721b1cc0ae4b461326bc31',
    language: 'javascript',
    views: {
        foo: { map: 'function(doc) {n emit(doc.foo,1);n}',
        reduce: 'function(keys, values, rereduce) {return sum(values);}' }
    },
    fulltext: {
        by_subject: {
            index:"function(doc) { var ret=new Document(); ret.add
(doc.subject); return ret }"
        },
    }
}
_DESIGN

function(doc) {
    var ret=new Document();
    ret.add(doc.subject);
    return ret
}
_DESIGN

function(doc) {
  var result = new Document();
  result.add(doc.subject, {"field":"subject", "store":"yes"});
  result.add(doc.content, {"field":"subject"});
  result.add(new Date(), {"field":"indexed_at"});
  return result;
}
http://127.0.0.1:5984> GET /foobar/_fti/_design/foo/by_subject?q=foobar
http://127.0.0.1:5984> GET /foobar/_fti/_design/foo/by_subject?q=foobar
COUCHAPPS
http://github.com/couchapp/couchapp
“Distributed, scalable, web
   applications you say?
omgwtfbbq!?!1!!!11!1!eleven”
_attachments
CouchDB
                  relax




CouchDB
     relax




             CouchDB
                  relax
COUCHAPP PUSH HTTP://LOCALHOST:5984/MYDB
LISTS
http://127.0.0.1:5984> GET /relax/_design/relax/_list/posts/all/foobar
HTTP/1.1 200 OK
Vary: Accept
Transfer-Encoding: chunked
Server: CouchDB/0.11.0 (Erlang OTP/R13B)
Etag: "DZZ19EPLWLHI89K1FOW9DGFT5"
Date: Sun, 11 Jul 2010 09:55:42 GMT
Content-Type: text/html

<h1>ponies</h1><p>rock!</p>
CouchDB
     relax
CouchDB
     relax
COUCHDBX
http://janl.github.com/couchdbx/
Q?

More Related Content

Recently uploaded

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
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
Enterprise Knowledge
 

Recently uploaded (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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
 
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
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
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
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
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
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 

Featured

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Featured (20)

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 

Rotterdam.php CouchDB