couchbase presentation - by patrick heneise
DESCRIPTION
In the Friday training I am going to introduce CouchBase Server, a NoSQL (Not only SQL, document oriented) database and outline differences to Apache CouchDB. We're going through a quick setup of the CouchBase Server and the basics of CouchDB document design. I will show some real world examples, followed by a discussion. Who is Patrick Heneise? Patrick is the Founder & CEO of desentia. He achieved a MSc in Media Technology and BSc in Computer Science in Media. Ever since he has improved social interaction and media with creative and professional technology solutions. He started his first business in 2006 during his studies in the fields of eLearning and web technologies and worked for various companies and universities in eCommerce, telecommunications and research & development.TRANSCRIPT
![Page 1: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/1.jpg)
GETTING COMFORTABLE WITH
Patrick Heneise, @PatrickHeneise
![Page 2: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/2.jpg)
About.Me/PatrickHeneiseInformation Architect / Consultant
MSc. in Media Technology, Leiden University, NL
BSc. in Computer Science in Media, Furtwangen University, DE
Certified Software Engineer
♥node.js, , NoSQL
2 years CouchDB/Couchbase experience
![Page 3: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/3.jpg)
AGENDA
![Page 4: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/4.jpg)
Agenda
Introduction to Couchbase
Introduction to Document Design and Best Practices
Introduction to Views (Map, Reduce)
Introduction to memcached
Use Cases
Q&A
![Page 5: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/5.jpg)
Not on the Agenda
Cluster Design
Deployment
Security
Advanced Document Design
Buckets/vBuckets
![Page 6: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/6.jpg)
![Page 7: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/7.jpg)
Couchbase ServerCouchDB
JSON Documents
Indexing and Querying
Map/Reduce
memcached
In-memory key-value store
Sub-millisecond latency
Distributed
![Page 8: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/8.jpg)
Couchbase Server
Auto-Sharding (dynamically add new servers)
Management and monitoring
Data replication with auto-failover
Mobile synchronization
![Page 9: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/9.jpg)
WHY NOSQL?
![Page 10: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/10.jpg)
![Page 11: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/11.jpg)
Why NoSQL?
No schema required
Interactive database engineering
Organic growth
Document/Object related
![Page 12: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/12.jpg)
CouchDB
![Page 13: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/13.jpg)
Use Cases
Information storage
Catalogues
Document-based information
![Page 14: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/14.jpg)
How does it look like?{
“title”: “Barcelona”,“state”: “Catalonia”,“tagline”: “Best place to live in Europe”,“population”: 1621537,“tags”: [
“gaudi”, “sagrada familia”, “beach”, “sun”],“startups”: {
“itnig”: {“tagline”: “Make it happen”,“tags”: [“web development”, “marketing”]
},“desentia”: {
“tagline”: “design to go.”,“tags”: [“design”, “mobile”, “commerce”]
}}
}
Strings
Key Value
NumbersArrays
ObjectsNested Objects
![Page 15: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/15.jpg)
How to interact with data?city.title
city.tags
city.tags[4]
city.startups.desentia.tagline
“Barcelona”
[“gaudi”, “sagrada familia”, “beach”, “sun”]
“gaudi”
“design to go.”
=>
=>
=>
=>
![Page 16: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/16.jpg)
Where’s SELECT?
Map/Reduce Views
JavaScript or Erlang
Spatial Views
![Page 17: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/17.jpg)
Views
function (doc, meta) {
if(doc.jsonType == 'city') {
emit(doc.title, doc.tagline);
}
}
![Page 18: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/18.jpg)
-{- total_rows: 3,- rows:
[-
{- id: "barcelona",- key: "Barcelona",- value: "Best place to live in Europe"
- },-
{- id: "berlin",- key: "Berlin",- value: "Beer and Startups"
- },-
{- id: "london",- key: "London",- value: "Bloody Rainy"
- }- ]
-}
![Page 19: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/19.jpg)
View all tagsfunction (doc, meta) {
if(doc.jsonType == 'city') {
doc.tags.forEach(function(tag) {
emit(tag, doc.title);
});
}
}
![Page 20: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/20.jpg)
-{- total_rows: 12,- rows:
[-
{- id: "barcelona",- key: "beach",- value: "Barcelona"
- },-
{- id: "berlin",- key: "brandenburg gate",- value: "Berlin"
- },-
{- id: "berlin",- key: "cold",- value: "Berlin"
- },-
{- id: "berlin",- key: "DDR",- value: "Berlin"
- },...
![Page 21: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/21.jpg)
JOINSfunction (doc, meta) {
if(doc.jsonType == "startup") {
emit([doc.city, 1], doc.title);
} else if(doc.jsonType == "city") {
emit([meta.id, 0], doc.title);
}
}
![Page 22: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/22.jpg)
["barcelona",0] barcelona "Barcelona"["barcelona",1] desentia "desentia"["barcelona",1] itnig "itnig"["berlin",0] berlin "Berlin"["berlin",1] soundcloud "soundcloud"["london",0] london "London"
![Page 23: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/23.jpg)
MAP/REDUCEfunction (doc, meta) {
if(doc.jsonType == "startup") {
emit(doc.city, 1);
}
}
_count
![Page 24: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/24.jpg)
-{- rows:
[-
{- key: "barcelona",- value: 2
- },-
{- key: "berlin",- value: 1
- }- ]
-}
-{- rows:
[-
{- key: null,- value: 3
- }- ]
-}
group_level 0 group_level 1
![Page 25: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/25.jpg)
memcached
![Page 26: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/26.jpg)
Use Cases
Session Store
Always and fast changing data (user activity)
Stock exchange data
Game states
![Page 27: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/27.jpg)
Pure key-value store
c.set("foo", 1)c.incr("foo") #=> 2c.incr("foo", :delta => 2) #=> 4c.incr("foo", 4) #=> 8c.incr("foo", -1) #=> 7
c.set("foo", "bar")c.set("foo", "bar", :ttl => 30)c["foo"] = "bar"
![Page 28: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/28.jpg)
Examples
user:patrick:id => 1
user:patrick:lastPage => ‘/account’
farmhill:currentPlants => 5
farmhill:nextAvailablePlant => ‘Sunflower’
sess:abc:username => ‘patrick’
global:nextUserId => 15
![Page 29: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/29.jpg)
DEMO
![Page 30: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/30.jpg)
![Page 31: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/31.jpg)
WHERE CAN I USE COUCHBASE?
![Page 32: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/32.jpg)
Use CaseseCommerce Systems
Products, Session, Users, Sales, ...
Q/A Systems
Store a document per user with questions and answers
History Databases
Ancient Books, letters, transcriptions, ...
mCommerce Systems
Products, Location Information
Social Information Systems / Business Intranets
Timesheets, Project information
Wiki / CMS / Blog
Articles, Pages, ...
Gaming Systems
Game states, user data
...
![Page 33: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/33.jpg)
Additional Information
couchbase.com / @couchbase / @jchris / @janl
couchbasemodels.com / @scalabl3
couchbase.com/docs/couchbase-manual-2.0/
couchbase.com/couchconf-berlin - CouchConf Berlin, Oct 30
![Page 34: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/34.jpg)
Q&A
![Page 35: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/35.jpg)
JOIN US ON MEETUP:THE-BARCELONA-COUCHBASE-GROUP
![Page 36: Couchbase presentation - by Patrick Heneise](https://reader036.vdocuments.mx/reader036/viewer/2022062513/554c5475b4c905452e8b49f6/html5/thumbnails/36.jpg)
THANK YOU!