SlideShare una empresa de Scribd logo
1 de 33
Descargar para leer sin conexión
John Wood
                          ChicagoDB User Group
                             August 16, 2010

Monday, August 16, 2010
Outline
                    •     What is CouchDB?

                    •     Documents and Document Storage

                    •     Views

                    •     Replication

                    •     CouchApps

                    •     Add-ons

                    •     Resources

                    •     Demo!

Monday, August 16, 2010
What is CouchDB?



Monday, August 16, 2010
Document Database
                      {
                          “_id” : “2d7f015226a05b6940984bbe39004fde”,
                          “_rev” : “2-477f6ab2dec6df185de1a078d270d8”,
                          “first_name” : “John”,
                          “last_name” : “Wood”,
                          “interests” : [“hacking”, “fishing”, “running”],
                          “offspring” : [
                                          { “name” : “Dylan”, “age” : 5 },
                                          { “name” : “Chloe”, “age” : 2 }
                                        ]
                      }


Monday, August 16, 2010
Strong Focus on
                                                Replication




Monday, August 16, 2010
- Built from day one to support bi-directional peer to peer replication
- This feature sets CouchDB apart from the other NoSQL databases, and makes it stand out in the database community
RESTful API
                      # Create
                      POST http://localhost:5984/employees
                      # Read
                      GET http://localhost:5984/employees/1
                      # Update
                      PUT http://localhost:5984/employees/1
                      # Delete
                      DELETE http://localhost:5984/employees/1

Monday, August 16, 2010
Queried and Indexed
                           with MapReduce
                            function(doc) {
                              if (doc.first_name == “John”)
                                  emit(doc._id, 1);
                            }

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


Monday, August 16, 2010
Multiversion
                           Concurrency Control




                                                                  http://en.wikipedia.org/wiki/Multiversion_concurrency_control
                                                     Image: http://blogs.wyomingnews.com/blogs/everyonegives/files/2009/02/book-stack.jpg

Monday, August 16, 2010
- Documents never updated in place; new revisions are always created
- Advantages
  * Don't have to manage locks for reads. Don't have to worry about a concurrent update corrupting a read that is in progress.
  * Data is “safer”. Old revisions are kept around (at least for a while). If a botched update accidentally destroys data, you can always restore it from a previous revision.
  * The database can perform some optimizations when writing to disk. If creating or updating 1000 documents, those documents will all live next to each other on disk, eliminating disk seeks.
- Disadvantages
  * Requires occasional database compaction
Ultra Durable




Monday, August 16, 2010
- When CouchDB documents are updated, all data and associated indexes are flushed to disk and the transactional commit always leaves the database in a completely consistent state.
- 2 step commit:
  * All document data and associated index updates are synchronously flushed to disk.
  * The database header is written in two consecutive, identical chunks, and flushed to disk.
- Crash recovery:
  * If crash on step 1 of commit, partially flushed data are forgotten upon restart.
  * If crash on step 2, a surviving copy of the previous headers will remain, and are used.
- Crash only shutdown
Erlang OTP




Monday, August 16, 2010
The Erlang programming language and the OTP platform are known for their concurrency support, and OTP is known for its extreme emphasis on reliability and
availability.
Monday, August 16, 2010
Documents and
                          Document Storage


Monday, August 16, 2010
Documents
                    • JSON data format
                    • Schema-less
                    • Support for binary data in the form of
                          document “attachments”
                    • Each document uniquely named in the
                          database


Monday, August 16, 2010
Document Storage
                    • CouchDB uses append-only updates, and
                          never overwrites comitted data
                    • Document updates are serialized
                    • Update model is lockless and optimistic
                    • Reads are never blocked or interrupted by
                          a concurrent updates
                    • Databases require occasional compaction
Monday, August 16, 2010
Views



Monday, August 16, 2010
Views
            • Add structure back to your unstructured data, so
                   it can be queried
            • Allow you to have many different view
                   representations of the same data
            • Created by executing map and reduce functions
                   on your documents
            • View definitions are stored in Design Documents
            • Built incrementally and on demand
Monday, August 16, 2010
MapReduce
                    • MapReduce functions are written primarily
                          in Javascript (some other languages are
                          supported)
                    • The map function selects which documents
                          to operate on, emitting zero to many key/
                          value pairs to the reduce function
                    • The (optional) reduce function combines
                          the key/value pairs and performs any
                          necessary calculations on that data

Monday, August 16, 2010
View Indexes
                    • View indexes are stored on disk separate
                          from the main database, in a data structure
                          specific to the given Design Document
                    • Views are updated incrementally; only new/
                          changed documents are processed when
                          the view is accessed
                    • Building views (especially from scratch) can
                          be time consuming and resource intensive
                          for large databases

Monday, August 16, 2010
Replication



Monday, August 16, 2010
Replication
          • Effecient and reliable bi-directional replication
          • Only documents created/updated since the last
                  replication are replicated
          • For each document, only updated fields are
                  replicated
          • Support for one-time, continuous, and filtered
                  replication
          • Fault tolerant - will simply pick up where it left off
                  if something bad happens
Monday, August 16, 2010
Conflict Management
        •       Documents with conflicts have a property named
                “_conflicts”, which contains all conflicting revision ids
        •       CouchDB chooses a winning document, but keeps
                losing documents around for manual conflict resolution
        •       CouchDB does not attempt to merge conflicting
                documents
        •       It is the application’s responsibility to make sure data is
                merged successfully
        •       Losing documents will be removed upon compaction
Monday, August 16, 2010
CouchApps



Monday, August 16, 2010
What are CouchApps?
          •       CouchApps are HTML and Javascript applications that
                  can be hosted directly from CouchDB
          •       CouchDB can serve HTML, images, CSS, Javascript, etc
          •       Applications live in a Design Document, with static
                  files (html, css, etc) as attachments
          •       Dynamic behavior and database access done via
                  Javascript
          •       CouchDB can be a complete, local web platform
          •       Support for virtual hosts and URL re-writing

Monday, August 16, 2010
Why?
          • Your application and its associated data can be
                  distributed, and replicated, together
          • If you like to share, somebody can grab your
                  application and data with a single replication
                  command
          • Not only Open Source, but Open Data as well
          • Applications can be taken off line, used, and
                  updated data can be synchronized at a later point
                  in time
Monday, August 16, 2010
Monday, August 16, 2010
http://pollen.nymphormation.org/afgwar/_design/afgwardiary/index.html


Monday, August 16, 2010
http://jchrisa.net/

Monday, August 16, 2010
http://jchrisa.net/cal/_design/cal/index.html

Monday, August 16, 2010
http://github.com/jchris/toast


Monday, August 16, 2010
Add-Ons

                    • couchdb-lucene - Enables full text searching
                          of documents using Lucene
                    • GeoCouch - Adds support for geospacial
                          queries to CouchDB
                    • Lounge - A proxy-based partitioning/
                          clustering framework for CouchDB



Monday, August 16, 2010
Resources

                          • http://apache.couchdb.org
                          • http://www.couch.io
                          • http://wiki.apache.org/couchdb
                          • http://books.couchdb.org/relax/
                          • http://wiki.couchapp.org

Monday, August 16, 2010
Less Talk, More Rock!
                                            Demo
                               http://github.com/jwood/couchdb_demo




Monday, August 16, 2010
Thanks!
                          john_p_wood@yahoo.com
                                @johnpwood




Monday, August 16, 2010

Más contenido relacionado

Destacado

INNOVATION: Being a journalist in the 2010s
INNOVATION: Being a journalist in the 2010sINNOVATION: Being a journalist in the 2010s
INNOVATION: Being a journalist in the 2010sKrisMcDonald21
 
CCMG Awards 2016 - Through the Looking Glass - February 2016
CCMG Awards 2016 - Through the Looking Glass - February 2016CCMG Awards 2016 - Through the Looking Glass - February 2016
CCMG Awards 2016 - Through the Looking Glass - February 2016Pommie Lutchman
 
Coana in international contemporary art 2012
Coana in international contemporary art 2012Coana in international contemporary art 2012
Coana in international contemporary art 2012Sebastiao Coana
 
Copyright why is it important for educators
Copyright  why is it important for educators Copyright  why is it important for educators
Copyright why is it important for educators Heather Borden
 
Beijing GNOME User Group
Beijing GNOME User GroupBeijing GNOME User Group
Beijing GNOME User GroupBin Li
 
Polyglot Persistence - Two Great Tastes That Taste Great Together
Polyglot Persistence - Two Great Tastes That Taste Great TogetherPolyglot Persistence - Two Great Tastes That Taste Great Together
Polyglot Persistence - Two Great Tastes That Taste Great TogetherJohn Wood
 
Mapas conceptuales.
Mapas conceptuales.Mapas conceptuales.
Mapas conceptuales.ijmentic
 
Sistema binario
Sistema binarioSistema binario
Sistema binarioijmentic
 

Destacado (16)

INNOVATION: Being a journalist in the 2010s
INNOVATION: Being a journalist in the 2010sINNOVATION: Being a journalist in the 2010s
INNOVATION: Being a journalist in the 2010s
 
Artist coana
Artist coanaArtist coana
Artist coana
 
CCMG Awards 2016 - Through the Looking Glass - February 2016
CCMG Awards 2016 - Through the Looking Glass - February 2016CCMG Awards 2016 - Through the Looking Glass - February 2016
CCMG Awards 2016 - Through the Looking Glass - February 2016
 
Coana artworks
Coana artworksCoana artworks
Coana artworks
 
Aries by bailey
Aries by baileyAries by bailey
Aries by bailey
 
Garden Bgiese
Garden BgieseGarden Bgiese
Garden Bgiese
 
Coana in international contemporary art 2012
Coana in international contemporary art 2012Coana in international contemporary art 2012
Coana in international contemporary art 2012
 
Copyright why is it important for educators
Copyright  why is it important for educators Copyright  why is it important for educators
Copyright why is it important for educators
 
Copyright
CopyrightCopyright
Copyright
 
Beijing GNOME User Group
Beijing GNOME User GroupBeijing GNOME User Group
Beijing GNOME User Group
 
Tenacity
TenacityTenacity
Tenacity
 
Aids
AidsAids
Aids
 
Polyglot Persistence - Two Great Tastes That Taste Great Together
Polyglot Persistence - Two Great Tastes That Taste Great TogetherPolyglot Persistence - Two Great Tastes That Taste Great Together
Polyglot Persistence - Two Great Tastes That Taste Great Together
 
Authoring CPAN modules
Authoring CPAN modulesAuthoring CPAN modules
Authoring CPAN modules
 
Mapas conceptuales.
Mapas conceptuales.Mapas conceptuales.
Mapas conceptuales.
 
Sistema binario
Sistema binarioSistema binario
Sistema binario
 

Similar a Introduction to CouchDB

MongoDB at Sailthru: Scaling and Schema Design
MongoDB at Sailthru: Scaling and Schema DesignMongoDB at Sailthru: Scaling and Schema Design
MongoDB at Sailthru: Scaling and Schema DesignDATAVERSITY
 
Sneak Peek of Nuxeo 5.4
Sneak Peek of Nuxeo 5.4Sneak Peek of Nuxeo 5.4
Sneak Peek of Nuxeo 5.4Nuxeo
 
BRAINREPUBLIC - Powered by no-SQL
BRAINREPUBLIC - Powered by no-SQLBRAINREPUBLIC - Powered by no-SQL
BRAINREPUBLIC - Powered by no-SQLAndreas Jung
 
Introducing apache pivot 2010 06-11
Introducing apache pivot 2010 06-11Introducing apache pivot 2010 06-11
Introducing apache pivot 2010 06-11ConchiLebron
 
An introduction to GWT and Ext GWT
An introduction to GWT and Ext GWTAn introduction to GWT and Ext GWT
An introduction to GWT and Ext GWTDarrell Meyer
 
The Reluctant SysAdmin : 360|iDev Austin 2010
The Reluctant SysAdmin : 360|iDev Austin 2010The Reluctant SysAdmin : 360|iDev Austin 2010
The Reluctant SysAdmin : 360|iDev Austin 2010Voxilate
 
Seattle hug 2010
Seattle hug 2010Seattle hug 2010
Seattle hug 2010Abe Taha
 
Mobile Development with uPortal and Infusion
Mobile Development with uPortal and InfusionMobile Development with uPortal and Infusion
Mobile Development with uPortal and Infusioncolinbdclark
 
Puppet buero20 presentation
Puppet buero20 presentationPuppet buero20 presentation
Puppet buero20 presentationMartin Alfke
 
Gaelyk - SpringOne2GX - 2010 - Guillaume Laforge
Gaelyk - SpringOne2GX - 2010 - Guillaume LaforgeGaelyk - SpringOne2GX - 2010 - Guillaume Laforge
Gaelyk - SpringOne2GX - 2010 - Guillaume LaforgeGuillaume Laforge
 
Automation using-phing
Automation using-phingAutomation using-phing
Automation using-phingRajat Pandit
 
Red Dirt Ruby Conference
Red Dirt Ruby ConferenceRed Dirt Ruby Conference
Red Dirt Ruby ConferenceJohn Woodell
 
Optimizing Latency-Sensitive Queries for Presto at Facebook: A Collaboration ...
Optimizing Latency-Sensitive Queries for Presto at Facebook: A Collaboration ...Optimizing Latency-Sensitive Queries for Presto at Facebook: A Collaboration ...
Optimizing Latency-Sensitive Queries for Presto at Facebook: A Collaboration ...Alluxio, Inc.
 
Best Practices for Development Deployment & Distributions: Capital Camp + Gov...
Best Practices for Development Deployment & Distributions: Capital Camp + Gov...Best Practices for Development Deployment & Distributions: Capital Camp + Gov...
Best Practices for Development Deployment & Distributions: Capital Camp + Gov...Phase2
 
Implementing MongoDB at Shutterfly (Kenny Gorman)
Implementing MongoDB at Shutterfly (Kenny Gorman)Implementing MongoDB at Shutterfly (Kenny Gorman)
Implementing MongoDB at Shutterfly (Kenny Gorman)MongoSF
 
Scaling with mongo db (with notes)
Scaling with mongo db (with notes)Scaling with mongo db (with notes)
Scaling with mongo db (with notes)emiltamas
 

Similar a Introduction to CouchDB (20)

MongoDB at Sailthru: Scaling and Schema Design
MongoDB at Sailthru: Scaling and Schema DesignMongoDB at Sailthru: Scaling and Schema Design
MongoDB at Sailthru: Scaling and Schema Design
 
Sneak Peek of Nuxeo 5.4
Sneak Peek of Nuxeo 5.4Sneak Peek of Nuxeo 5.4
Sneak Peek of Nuxeo 5.4
 
BRAINREPUBLIC - Powered by no-SQL
BRAINREPUBLIC - Powered by no-SQLBRAINREPUBLIC - Powered by no-SQL
BRAINREPUBLIC - Powered by no-SQL
 
Railsconf 2010
Railsconf 2010Railsconf 2010
Railsconf 2010
 
Introducing apache pivot 2010 06-11
Introducing apache pivot 2010 06-11Introducing apache pivot 2010 06-11
Introducing apache pivot 2010 06-11
 
Noit ocon-2010
Noit ocon-2010Noit ocon-2010
Noit ocon-2010
 
An introduction to GWT and Ext GWT
An introduction to GWT and Ext GWTAn introduction to GWT and Ext GWT
An introduction to GWT and Ext GWT
 
The Reluctant SysAdmin : 360|iDev Austin 2010
The Reluctant SysAdmin : 360|iDev Austin 2010The Reluctant SysAdmin : 360|iDev Austin 2010
The Reluctant SysAdmin : 360|iDev Austin 2010
 
Seattle hug 2010
Seattle hug 2010Seattle hug 2010
Seattle hug 2010
 
Mobile Development with uPortal and Infusion
Mobile Development with uPortal and InfusionMobile Development with uPortal and Infusion
Mobile Development with uPortal and Infusion
 
Puppet buero20 presentation
Puppet buero20 presentationPuppet buero20 presentation
Puppet buero20 presentation
 
Gaelyk - SpringOne2GX - 2010 - Guillaume Laforge
Gaelyk - SpringOne2GX - 2010 - Guillaume LaforgeGaelyk - SpringOne2GX - 2010 - Guillaume Laforge
Gaelyk - SpringOne2GX - 2010 - Guillaume Laforge
 
No sql findings
No sql findingsNo sql findings
No sql findings
 
Automation using-phing
Automation using-phingAutomation using-phing
Automation using-phing
 
Red Dirt Ruby Conference
Red Dirt Ruby ConferenceRed Dirt Ruby Conference
Red Dirt Ruby Conference
 
Optimizing Latency-Sensitive Queries for Presto at Facebook: A Collaboration ...
Optimizing Latency-Sensitive Queries for Presto at Facebook: A Collaboration ...Optimizing Latency-Sensitive Queries for Presto at Facebook: A Collaboration ...
Optimizing Latency-Sensitive Queries for Presto at Facebook: A Collaboration ...
 
Best Practices for Development Deployment & Distributions: Capital Camp + Gov...
Best Practices for Development Deployment & Distributions: Capital Camp + Gov...Best Practices for Development Deployment & Distributions: Capital Camp + Gov...
Best Practices for Development Deployment & Distributions: Capital Camp + Gov...
 
Couchdbkit & Dango
Couchdbkit & DangoCouchdbkit & Dango
Couchdbkit & Dango
 
Implementing MongoDB at Shutterfly (Kenny Gorman)
Implementing MongoDB at Shutterfly (Kenny Gorman)Implementing MongoDB at Shutterfly (Kenny Gorman)
Implementing MongoDB at Shutterfly (Kenny Gorman)
 
Scaling with mongo db (with notes)
Scaling with mongo db (with notes)Scaling with mongo db (with notes)
Scaling with mongo db (with notes)
 

Último

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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
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...Drew Madelung
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
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
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
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
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
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 2024Rafal Los
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 

Último (20)

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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
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...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
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
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
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
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
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
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 

Introduction to CouchDB

  • 1. John Wood ChicagoDB User Group August 16, 2010 Monday, August 16, 2010
  • 2. Outline • What is CouchDB? • Documents and Document Storage • Views • Replication • CouchApps • Add-ons • Resources • Demo! Monday, August 16, 2010
  • 3. What is CouchDB? Monday, August 16, 2010
  • 4. Document Database { “_id” : “2d7f015226a05b6940984bbe39004fde”, “_rev” : “2-477f6ab2dec6df185de1a078d270d8”, “first_name” : “John”, “last_name” : “Wood”, “interests” : [“hacking”, “fishing”, “running”], “offspring” : [ { “name” : “Dylan”, “age” : 5 }, { “name” : “Chloe”, “age” : 2 } ] } Monday, August 16, 2010
  • 5. Strong Focus on Replication Monday, August 16, 2010 - Built from day one to support bi-directional peer to peer replication - This feature sets CouchDB apart from the other NoSQL databases, and makes it stand out in the database community
  • 6. RESTful API # Create POST http://localhost:5984/employees # Read GET http://localhost:5984/employees/1 # Update PUT http://localhost:5984/employees/1 # Delete DELETE http://localhost:5984/employees/1 Monday, August 16, 2010
  • 7. Queried and Indexed with MapReduce function(doc) { if (doc.first_name == “John”) emit(doc._id, 1); } function(keys, values, rereduce) { return sum(values); } Monday, August 16, 2010
  • 8. Multiversion Concurrency Control http://en.wikipedia.org/wiki/Multiversion_concurrency_control Image: http://blogs.wyomingnews.com/blogs/everyonegives/files/2009/02/book-stack.jpg Monday, August 16, 2010 - Documents never updated in place; new revisions are always created - Advantages * Don't have to manage locks for reads. Don't have to worry about a concurrent update corrupting a read that is in progress. * Data is “safer”. Old revisions are kept around (at least for a while). If a botched update accidentally destroys data, you can always restore it from a previous revision. * The database can perform some optimizations when writing to disk. If creating or updating 1000 documents, those documents will all live next to each other on disk, eliminating disk seeks. - Disadvantages * Requires occasional database compaction
  • 9. Ultra Durable Monday, August 16, 2010 - When CouchDB documents are updated, all data and associated indexes are flushed to disk and the transactional commit always leaves the database in a completely consistent state. - 2 step commit: * All document data and associated index updates are synchronously flushed to disk. * The database header is written in two consecutive, identical chunks, and flushed to disk. - Crash recovery: * If crash on step 1 of commit, partially flushed data are forgotten upon restart. * If crash on step 2, a surviving copy of the previous headers will remain, and are used. - Crash only shutdown
  • 10. Erlang OTP Monday, August 16, 2010 The Erlang programming language and the OTP platform are known for their concurrency support, and OTP is known for its extreme emphasis on reliability and availability.
  • 12. Documents and Document Storage Monday, August 16, 2010
  • 13. Documents • JSON data format • Schema-less • Support for binary data in the form of document “attachments” • Each document uniquely named in the database Monday, August 16, 2010
  • 14. Document Storage • CouchDB uses append-only updates, and never overwrites comitted data • Document updates are serialized • Update model is lockless and optimistic • Reads are never blocked or interrupted by a concurrent updates • Databases require occasional compaction Monday, August 16, 2010
  • 16. Views • Add structure back to your unstructured data, so it can be queried • Allow you to have many different view representations of the same data • Created by executing map and reduce functions on your documents • View definitions are stored in Design Documents • Built incrementally and on demand Monday, August 16, 2010
  • 17. MapReduce • MapReduce functions are written primarily in Javascript (some other languages are supported) • The map function selects which documents to operate on, emitting zero to many key/ value pairs to the reduce function • The (optional) reduce function combines the key/value pairs and performs any necessary calculations on that data Monday, August 16, 2010
  • 18. View Indexes • View indexes are stored on disk separate from the main database, in a data structure specific to the given Design Document • Views are updated incrementally; only new/ changed documents are processed when the view is accessed • Building views (especially from scratch) can be time consuming and resource intensive for large databases Monday, August 16, 2010
  • 20. Replication • Effecient and reliable bi-directional replication • Only documents created/updated since the last replication are replicated • For each document, only updated fields are replicated • Support for one-time, continuous, and filtered replication • Fault tolerant - will simply pick up where it left off if something bad happens Monday, August 16, 2010
  • 21. Conflict Management • Documents with conflicts have a property named “_conflicts”, which contains all conflicting revision ids • CouchDB chooses a winning document, but keeps losing documents around for manual conflict resolution • CouchDB does not attempt to merge conflicting documents • It is the application’s responsibility to make sure data is merged successfully • Losing documents will be removed upon compaction Monday, August 16, 2010
  • 23. What are CouchApps? • CouchApps are HTML and Javascript applications that can be hosted directly from CouchDB • CouchDB can serve HTML, images, CSS, Javascript, etc • Applications live in a Design Document, with static files (html, css, etc) as attachments • Dynamic behavior and database access done via Javascript • CouchDB can be a complete, local web platform • Support for virtual hosts and URL re-writing Monday, August 16, 2010
  • 24. Why? • Your application and its associated data can be distributed, and replicated, together • If you like to share, somebody can grab your application and data with a single replication command • Not only Open Source, but Open Data as well • Applications can be taken off line, used, and updated data can be synchronized at a later point in time Monday, August 16, 2010
  • 30. Add-Ons • couchdb-lucene - Enables full text searching of documents using Lucene • GeoCouch - Adds support for geospacial queries to CouchDB • Lounge - A proxy-based partitioning/ clustering framework for CouchDB Monday, August 16, 2010
  • 31. Resources • http://apache.couchdb.org • http://www.couch.io • http://wiki.apache.org/couchdb • http://books.couchdb.org/relax/ • http://wiki.couchapp.org Monday, August 16, 2010
  • 32. Less Talk, More Rock! Demo http://github.com/jwood/couchdb_demo Monday, August 16, 2010
  • 33. Thanks! john_p_wood@yahoo.com @johnpwood Monday, August 16, 2010