SlideShare a Scribd company logo
Introduction to
Bharat Singh
Trainee Software Consultant
Knoldus Software LLP.
Agenda
●
What is Couchbase
●
Why NoSQL ?
●
Features of Couchbase
●
Views in Couchbase
●
Basic CURD operations with fixed key
What is Couchbase
Couchbase Server is a high-performance NoSQL
distributed database with a flexible data model. It
scales on commodity hardware to support large
data sets with a high number of concurrent reads
and writes while maintaining low latency and
strong consistency.
Why NoSQL ?
– With relational technologies, many application developers find it difficult, or
even impossible, to get the dynamic scalability and level of scale they need
while also maintaining the performance users demand.
– Data is becoming easier to capture and access through third parties such as
Facebook. It’s not surprising that developers find increasing value in leveraging
this data to enrich existing applications and create new apps.
– Developers want a highly flexible solution that easily accommodates any new
type of data they choose to work with, and isn’t disrupted by content structure
changes from third-party data providers. Much of the new data is unstructured
and semi-structured, so developers also need a database that can efficiently
store it.
– NoSQL databases are built from the ground up to be distributed, scale-out
technologies and are therefore a better fit with the highly distributed nature of
the three-tier internet architecture.
Features of Couchbase
Multi-Dimensional Scaling
●
Couchbase has redefined the way enterprises scale distributed databases with the
option of Multi-Dimensional Scaling. It separates, isolates, and scales individual
services – query, index, and data – to improve application performance and increase
resource utilization. Couchbase Server 4.0 is the first and only distributed database
capable of scaling with the speed and precision required by enterprise applications
with variable workloads.
●
Multi-Dimensional Scaling enables enterprises to optimize hardware by allocating
resources based on the workload of a specific service, and to avoid resource
contention by performing queries, maintaining indexes, and writing data with different
nodes. It is inefficient to require participation from every node to perform a query or
maintain an index. Couchbase Server 4.0 solves this problem by scaling data
independent of queries and indexes.
Multidimensional scaling
Features of Couchbase
N1QL (read as 'Nickel')
●
N1QL is the first query language to leverage the complete flexibility of JSON and
the full power of SQL. While JSON benefits from SQL because it enables developers
to model and query data with relationships, SQL benefits from JSON because it
removes the “impedance mismatch” between the data model and the application model.
In fact, the data model is no longer limited to "single table" or "table per query"
impementations - related data can be embedded or referenced and the same data can be
queried in different ways.
●
N1QL enables developers to transition to a NoSQL database by leveraging existing
SQL and data modeling knowledge. It is now possible to create a data model that
combines both nested and related data while avoiding the need to create and maintain
complex query logic – for example, multiple queries are no longer required to get
related data. N1QL enables developers to buid applications that require ad-hoc access
to data with greater precision and intelligence.
Features of Couchbase
Global Secondary Indexing (GSI)
●
In addition to the existing MapReduce-based indexes known as views, Couchbase
Server provides a global secondary index (GSI). With GSI, you can access your
documents faster by using secondary index fields without the overhead of
MapReduce.
●
GSI provides fast access for N1QL queries. With the support of GSI, you can submit
queries that target specific lookups on secondary fields. For example, you can look
up customers by email address rather than relying on a customer key.
●
GSI provides the following benefits:
●
Improves index efficiency by avoiding gather-scatter and index working set
management
●
Improves application scalability by allowing indexes to partition and scale
independently
Features of Couchbase
Cross Datacenter Replication (XDCR) -
Filtering
●
Couchbase supports cross-data-center replication (XDCR), which provides live
replication of database contents of one Couchbase cluster to a geographically
remote cluster. Note that XDCR operates simultaneously with intracluster replication
(the copying of live documents to their inactive replica counterparts on other cluster
members), and all systems in an XDCR arrangement invisibly synchronize with one
another.
Views in Couchbase
●
Queries on Couchbase Server are performed via "views," Couchbase terminology
for indexes. Put another way, when you create an index, you're provided with a view
that serves as your mechanism for querying Couchbase data
●
To define a view, you build a specific kind of document called a design document.
The design document holds the JavaScript code that implements the mapreduce
operations that create the view's index.
●
The map function in a design document's mapreduce specification filters and
extracts information from the documents against which it executes. The result is a
set of key/value pairs that comprise the query-accelerating index.
The reduce function is optional. It is typically used to aggregate or sum the data
manipulated by the map operation. Code in the reduce function can be used to
implement operations that correspond roughly to SQL's ORDER BY, SORT, and
aggregation features.
Views in Couchbase
●
A design document can hold multiple views and the configuration applies to all views
in the document. If you update one index, all indexes in the document will be
updated.
●
Finally, Couchbase distinguishes between development and production views, and
the two are kept in separate namespaces. Development views can be modified;
production views cannot. The reason for the distinction arises from the fact that, if
you modify a view, all views in that design document will be invalidated, and all
indexes defined by mapreduce functions in the design document will be rebuilt.
Therefore, development views enable you to test your view code in a kind of
sandbox before deploying it into a production view.
Initialization Couchbase trial app
//Required imports
import com.couchbase.client.java.{Bucket, CouchbaseCluster}
//Create cluster and open bucket
val cluster = CouchbaseCluster.create(“127.0.0.1”)
val bucket = cluster.openBucket(“user”)
//case class to store data in bucket
case class User(name:String, email: String)
CURD Operations in Couchbase
Create record :
def insert(user: User): Option[User] = {
try {
val doc = JsonObject.fromJson(compact(render(decompose(user))))
val result = bucket.insert(JsonDocument.create("usr::" + user.email, (doc)))
val jsonAsString = result.content().toString()
val insertedData = parse(jsonAsString).extract[User]
Some(insertedData)
} catch {
case exception: Exception =>
None
}
}
CURD Operations in Couchbase
Update record
def update(user: User): Option[User] = {
try {
val doc = JsonObject.fromJson(compact(render(decompose(user))))
val result = bucket.upsert(JsonDocument.create("usr::" + user.email, (doc)))
val jsonAsString = result.content().toString()
val insertedData = parse(jsonAsString).extract[User]
Some(insertedData)
} catch {
case exception: Exception =>
None
}
}
CURD Operations in Couchbase
Retrieve record
def retrieveUser(email: String): Option[User] = {
try {
val result = bucket.get("usr::" + email)
Some(parse(result.content().toString()).extract[User])
} catch {
case exception: Exception =>
None
}
}
CURD Operations in Couchbase
Delete record
def deleteUser(email: String): Int = {
try {
val result = bucket.remove("usr::" + email)
1
} catch {
case exception: Exception =>
0
}
}
Thank You

More Related Content

What's hot

Immutable infrastructure with Terraform
Immutable infrastructure with TerraformImmutable infrastructure with Terraform
Immutable infrastructure with Terraform
Prashant Kalkar
 
Open Source für den geschäftskritischen Einsatz
Open Source für den geschäftskritischen EinsatzOpen Source für den geschäftskritischen Einsatz
Open Source für den geschäftskritischen Einsatz
MariaDB plc
 
SpringPeople Introduction to MongoDB Administration
SpringPeople Introduction to MongoDB AdministrationSpringPeople Introduction to MongoDB Administration
SpringPeople Introduction to MongoDB Administration
SpringPeople
 
MySQL Rebuild using Logical Backups
MySQL Rebuild using Logical Backups MySQL Rebuild using Logical Backups
MySQL Rebuild using Logical Backups
Mydbops
 
ETL in data warehouse as a service enviornment
ETL in data warehouse as a service enviornmentETL in data warehouse as a service enviornment
ETL in data warehouse as a service enviornment
Sanil Mhatre
 
SQL Server Deployments made easy with DACPAC
SQL Server Deployments made easy with DACPACSQL Server Deployments made easy with DACPAC
SQL Server Deployments made easy with DACPAC
Sanil Mhatre
 
Kafka Connect - debezium
Kafka Connect - debeziumKafka Connect - debezium
Kafka Connect - debezium
Kasun Don
 
Couch db
Couch dbCouch db
Couch db
amini gazar
 
MySQL Performance Schema in Action
MySQL Performance Schema in Action MySQL Performance Schema in Action
MySQL Performance Schema in Action
Mydbops
 
Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016
Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016
Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016
Dylan Butler
 
SQL Server 2008 Integration Services
SQL Server 2008 Integration ServicesSQL Server 2008 Integration Services
SQL Server 2008 Integration Services
Eduardo Castro
 
Azure PaaS databases
Azure PaaS databasesAzure PaaS databases
Azure PaaS databases
Gianluca Hotz
 
CouchDB
CouchDBCouchDB
CouchDB
Rashmi Agale
 
WSO2Con USA 2017: Scalable Real-time Complex Event Processing at Uber
WSO2Con USA 2017: Scalable Real-time Complex Event Processing at UberWSO2Con USA 2017: Scalable Real-time Complex Event Processing at Uber
WSO2Con USA 2017: Scalable Real-time Complex Event Processing at Uber
WSO2
 
Adi Sapir ISUG 123 11/10/2012
Adi Sapir ISUG 123 11/10/2012Adi Sapir ISUG 123 11/10/2012
Adi Sapir ISUG 123 11/10/2012
sqlserver.co.il
 
Couchdb + Membase = Couchbase
Couchdb + Membase = CouchbaseCouchdb + Membase = Couchbase
Couchdb + Membase = Couchbase
iammutex
 
Node.js and couchbase Full Stack JSON - Munich NoSQL
Node.js and couchbase   Full Stack JSON - Munich NoSQLNode.js and couchbase   Full Stack JSON - Munich NoSQL
Node.js and couchbase Full Stack JSON - Munich NoSQLPhilipp Fehre
 
CQRS and Event Sourcing for Java Developers
CQRS and Event Sourcing for Java DevelopersCQRS and Event Sourcing for Java Developers
CQRS and Event Sourcing for Java Developers
Markus Eisele
 
"Fast / Resilient / .NET – What to Choose?" Serhiy Kalinets
 "Fast / Resilient / .NET – What to Choose?" Serhiy Kalinets "Fast / Resilient / .NET – What to Choose?" Serhiy Kalinets
"Fast / Resilient / .NET – What to Choose?" Serhiy Kalinets
Fwdays
 
Migrating with Debezium
Migrating with DebeziumMigrating with Debezium
Migrating with Debezium
Mike Fowler
 

What's hot (20)

Immutable infrastructure with Terraform
Immutable infrastructure with TerraformImmutable infrastructure with Terraform
Immutable infrastructure with Terraform
 
Open Source für den geschäftskritischen Einsatz
Open Source für den geschäftskritischen EinsatzOpen Source für den geschäftskritischen Einsatz
Open Source für den geschäftskritischen Einsatz
 
SpringPeople Introduction to MongoDB Administration
SpringPeople Introduction to MongoDB AdministrationSpringPeople Introduction to MongoDB Administration
SpringPeople Introduction to MongoDB Administration
 
MySQL Rebuild using Logical Backups
MySQL Rebuild using Logical Backups MySQL Rebuild using Logical Backups
MySQL Rebuild using Logical Backups
 
ETL in data warehouse as a service enviornment
ETL in data warehouse as a service enviornmentETL in data warehouse as a service enviornment
ETL in data warehouse as a service enviornment
 
SQL Server Deployments made easy with DACPAC
SQL Server Deployments made easy with DACPACSQL Server Deployments made easy with DACPAC
SQL Server Deployments made easy with DACPAC
 
Kafka Connect - debezium
Kafka Connect - debeziumKafka Connect - debezium
Kafka Connect - debezium
 
Couch db
Couch dbCouch db
Couch db
 
MySQL Performance Schema in Action
MySQL Performance Schema in Action MySQL Performance Schema in Action
MySQL Performance Schema in Action
 
Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016
Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016
Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016
 
SQL Server 2008 Integration Services
SQL Server 2008 Integration ServicesSQL Server 2008 Integration Services
SQL Server 2008 Integration Services
 
Azure PaaS databases
Azure PaaS databasesAzure PaaS databases
Azure PaaS databases
 
CouchDB
CouchDBCouchDB
CouchDB
 
WSO2Con USA 2017: Scalable Real-time Complex Event Processing at Uber
WSO2Con USA 2017: Scalable Real-time Complex Event Processing at UberWSO2Con USA 2017: Scalable Real-time Complex Event Processing at Uber
WSO2Con USA 2017: Scalable Real-time Complex Event Processing at Uber
 
Adi Sapir ISUG 123 11/10/2012
Adi Sapir ISUG 123 11/10/2012Adi Sapir ISUG 123 11/10/2012
Adi Sapir ISUG 123 11/10/2012
 
Couchdb + Membase = Couchbase
Couchdb + Membase = CouchbaseCouchdb + Membase = Couchbase
Couchdb + Membase = Couchbase
 
Node.js and couchbase Full Stack JSON - Munich NoSQL
Node.js and couchbase   Full Stack JSON - Munich NoSQLNode.js and couchbase   Full Stack JSON - Munich NoSQL
Node.js and couchbase Full Stack JSON - Munich NoSQL
 
CQRS and Event Sourcing for Java Developers
CQRS and Event Sourcing for Java DevelopersCQRS and Event Sourcing for Java Developers
CQRS and Event Sourcing for Java Developers
 
"Fast / Resilient / .NET – What to Choose?" Serhiy Kalinets
 "Fast / Resilient / .NET – What to Choose?" Serhiy Kalinets "Fast / Resilient / .NET – What to Choose?" Serhiy Kalinets
"Fast / Resilient / .NET – What to Choose?" Serhiy Kalinets
 
Migrating with Debezium
Migrating with DebeziumMigrating with Debezium
Migrating with Debezium
 

Similar to Couchbase - Introduction

Introduction to NoSQL
Introduction to NoSQLIntroduction to NoSQL
Introduction to NoSQL
balwinders
 
No sql databases explained
No sql databases explainedNo sql databases explained
No sql databases explained
Salil Mehendale
 
SQL vs NoSQL deep dive
SQL vs NoSQL deep diveSQL vs NoSQL deep dive
SQL vs NoSQL deep dive
Ahmed Shaaban
 
Why no sql ? Why Couchbase ?
Why no sql ? Why Couchbase ?Why no sql ? Why Couchbase ?
Why no sql ? Why Couchbase ?
Ahmed Rashwan
 
Sql vs NO-SQL database differences explained
Sql vs NO-SQL database differences explainedSql vs NO-SQL database differences explained
Sql vs NO-SQL database differences explained
Satya Pal
 
Selecting best NoSQL
Selecting best NoSQL Selecting best NoSQL
Selecting best NoSQL
Mohammed Fazuluddin
 
NoSQL Databases Introduction - UTN 2013
NoSQL Databases Introduction - UTN 2013NoSQL Databases Introduction - UTN 2013
NoSQL Databases Introduction - UTN 2013
Facundo Farias
 
Unit 3 MongDB
Unit 3 MongDBUnit 3 MongDB
Unit 3 MongDB
Praveen M Jigajinni
 
the rising no sql technology
the rising no sql technologythe rising no sql technology
the rising no sql technology
INFOGAIN PUBLICATION
 
NoSQL
NoSQLNoSQL
Altoros using no sql databases for interactive_applications
Altoros using no sql databases for interactive_applicationsAltoros using no sql databases for interactive_applications
Altoros using no sql databases for interactive_applicationsJeff Harris
 
Challenges Management and Opportunities of Cloud DBA
Challenges Management and Opportunities of Cloud DBAChallenges Management and Opportunities of Cloud DBA
Challenges Management and Opportunities of Cloud DBA
inventy
 
Why does Microsoft care about NoSQL, SQL and Polyglot Persistence?
Why does Microsoft care about NoSQL, SQL and Polyglot Persistence?Why does Microsoft care about NoSQL, SQL and Polyglot Persistence?
Why does Microsoft care about NoSQL, SQL and Polyglot Persistence?
brianlangbecker
 
Azure cosmos db, Azure no-SQL database,
Azure cosmos db, Azure no-SQL database, Azure cosmos db, Azure no-SQL database,
Azure cosmos db, Azure no-SQL database,
BRIJESH KUMAR
 
Sql vs NoSQL-Presentation
 Sql vs NoSQL-Presentation Sql vs NoSQL-Presentation
Sql vs NoSQL-Presentation
Shubham Tomar
 
A Comparative Study of NoSQL and Relational Database.pdf
A Comparative Study of NoSQL and Relational Database.pdfA Comparative Study of NoSQL and Relational Database.pdf
A Comparative Study of NoSQL and Relational Database.pdf
Jennifer Roman
 
MongoDB Lab Manual (1).pdf used in data science
MongoDB Lab Manual (1).pdf used in data scienceMongoDB Lab Manual (1).pdf used in data science
MongoDB Lab Manual (1).pdf used in data science
bitragowthamkumar1
 

Similar to Couchbase - Introduction (20)

Introduction to NoSQL
Introduction to NoSQLIntroduction to NoSQL
Introduction to NoSQL
 
No sql databases explained
No sql databases explainedNo sql databases explained
No sql databases explained
 
Couch db
Couch dbCouch db
Couch db
 
SQL vs NoSQL deep dive
SQL vs NoSQL deep diveSQL vs NoSQL deep dive
SQL vs NoSQL deep dive
 
Why no sql ? Why Couchbase ?
Why no sql ? Why Couchbase ?Why no sql ? Why Couchbase ?
Why no sql ? Why Couchbase ?
 
Couch db
Couch dbCouch db
Couch db
 
No sql database
No sql databaseNo sql database
No sql database
 
Sql vs NO-SQL database differences explained
Sql vs NO-SQL database differences explainedSql vs NO-SQL database differences explained
Sql vs NO-SQL database differences explained
 
Selecting best NoSQL
Selecting best NoSQL Selecting best NoSQL
Selecting best NoSQL
 
NoSQL Databases Introduction - UTN 2013
NoSQL Databases Introduction - UTN 2013NoSQL Databases Introduction - UTN 2013
NoSQL Databases Introduction - UTN 2013
 
Unit 3 MongDB
Unit 3 MongDBUnit 3 MongDB
Unit 3 MongDB
 
the rising no sql technology
the rising no sql technologythe rising no sql technology
the rising no sql technology
 
NoSQL
NoSQLNoSQL
NoSQL
 
Altoros using no sql databases for interactive_applications
Altoros using no sql databases for interactive_applicationsAltoros using no sql databases for interactive_applications
Altoros using no sql databases for interactive_applications
 
Challenges Management and Opportunities of Cloud DBA
Challenges Management and Opportunities of Cloud DBAChallenges Management and Opportunities of Cloud DBA
Challenges Management and Opportunities of Cloud DBA
 
Why does Microsoft care about NoSQL, SQL and Polyglot Persistence?
Why does Microsoft care about NoSQL, SQL and Polyglot Persistence?Why does Microsoft care about NoSQL, SQL and Polyglot Persistence?
Why does Microsoft care about NoSQL, SQL and Polyglot Persistence?
 
Azure cosmos db, Azure no-SQL database,
Azure cosmos db, Azure no-SQL database, Azure cosmos db, Azure no-SQL database,
Azure cosmos db, Azure no-SQL database,
 
Sql vs NoSQL-Presentation
 Sql vs NoSQL-Presentation Sql vs NoSQL-Presentation
Sql vs NoSQL-Presentation
 
A Comparative Study of NoSQL and Relational Database.pdf
A Comparative Study of NoSQL and Relational Database.pdfA Comparative Study of NoSQL and Relational Database.pdf
A Comparative Study of NoSQL and Relational Database.pdf
 
MongoDB Lab Manual (1).pdf used in data science
MongoDB Lab Manual (1).pdf used in data scienceMongoDB Lab Manual (1).pdf used in data science
MongoDB Lab Manual (1).pdf used in data science
 

More from Knoldus Inc.

Getting Started with Apache Spark (Scala)
Getting Started with Apache Spark (Scala)Getting Started with Apache Spark (Scala)
Getting Started with Apache Spark (Scala)
Knoldus Inc.
 
Secure practices with dot net services.pptx
Secure practices with dot net services.pptxSecure practices with dot net services.pptx
Secure practices with dot net services.pptx
Knoldus Inc.
 
Distributed Cache with dot microservices
Distributed Cache with dot microservicesDistributed Cache with dot microservices
Distributed Cache with dot microservices
Knoldus Inc.
 
Introduction to gRPC Presentation (Java)
Introduction to gRPC Presentation (Java)Introduction to gRPC Presentation (Java)
Introduction to gRPC Presentation (Java)
Knoldus Inc.
 
Using InfluxDB for real-time monitoring in Jmeter
Using InfluxDB for real-time monitoring in JmeterUsing InfluxDB for real-time monitoring in Jmeter
Using InfluxDB for real-time monitoring in Jmeter
Knoldus Inc.
 
Intoduction to KubeVela Presentation (DevOps)
Intoduction to KubeVela Presentation (DevOps)Intoduction to KubeVela Presentation (DevOps)
Intoduction to KubeVela Presentation (DevOps)
Knoldus Inc.
 
Stakeholder Management (Project Management) Presentation
Stakeholder Management (Project Management) PresentationStakeholder Management (Project Management) Presentation
Stakeholder Management (Project Management) Presentation
Knoldus Inc.
 
Introduction To Kaniko (DevOps) Presentation
Introduction To Kaniko (DevOps) PresentationIntroduction To Kaniko (DevOps) Presentation
Introduction To Kaniko (DevOps) Presentation
Knoldus Inc.
 
Efficient Test Environments with Infrastructure as Code (IaC)
Efficient Test Environments with Infrastructure as Code (IaC)Efficient Test Environments with Infrastructure as Code (IaC)
Efficient Test Environments with Infrastructure as Code (IaC)
Knoldus Inc.
 
Exploring Terramate DevOps (Presentation)
Exploring Terramate DevOps (Presentation)Exploring Terramate DevOps (Presentation)
Exploring Terramate DevOps (Presentation)
Knoldus Inc.
 
Clean Code in Test Automation Differentiating Between the Good and the Bad
Clean Code in Test Automation  Differentiating Between the Good and the BadClean Code in Test Automation  Differentiating Between the Good and the Bad
Clean Code in Test Automation Differentiating Between the Good and the Bad
Knoldus Inc.
 
Integrating AI Capabilities in Test Automation
Integrating AI Capabilities in Test AutomationIntegrating AI Capabilities in Test Automation
Integrating AI Capabilities in Test Automation
Knoldus Inc.
 
State Management with NGXS in Angular.pptx
State Management with NGXS in Angular.pptxState Management with NGXS in Angular.pptx
State Management with NGXS in Angular.pptx
Knoldus Inc.
 
Authentication in Svelte using cookies.pptx
Authentication in Svelte using cookies.pptxAuthentication in Svelte using cookies.pptx
Authentication in Svelte using cookies.pptx
Knoldus Inc.
 
OAuth2 Implementation Presentation (Java)
OAuth2 Implementation Presentation (Java)OAuth2 Implementation Presentation (Java)
OAuth2 Implementation Presentation (Java)
Knoldus Inc.
 
Supply chain security with Kubeclarity.pptx
Supply chain security with Kubeclarity.pptxSupply chain security with Kubeclarity.pptx
Supply chain security with Kubeclarity.pptx
Knoldus Inc.
 
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML ParsingMastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
Knoldus Inc.
 
Akka gRPC Essentials A Hands-On Introduction
Akka gRPC Essentials A Hands-On IntroductionAkka gRPC Essentials A Hands-On Introduction
Akka gRPC Essentials A Hands-On Introduction
Knoldus Inc.
 
Entity Core with Core Microservices.pptx
Entity Core with Core Microservices.pptxEntity Core with Core Microservices.pptx
Entity Core with Core Microservices.pptx
Knoldus Inc.
 
Introduction to Redis and its features.pptx
Introduction to Redis and its features.pptxIntroduction to Redis and its features.pptx
Introduction to Redis and its features.pptx
Knoldus Inc.
 

More from Knoldus Inc. (20)

Getting Started with Apache Spark (Scala)
Getting Started with Apache Spark (Scala)Getting Started with Apache Spark (Scala)
Getting Started with Apache Spark (Scala)
 
Secure practices with dot net services.pptx
Secure practices with dot net services.pptxSecure practices with dot net services.pptx
Secure practices with dot net services.pptx
 
Distributed Cache with dot microservices
Distributed Cache with dot microservicesDistributed Cache with dot microservices
Distributed Cache with dot microservices
 
Introduction to gRPC Presentation (Java)
Introduction to gRPC Presentation (Java)Introduction to gRPC Presentation (Java)
Introduction to gRPC Presentation (Java)
 
Using InfluxDB for real-time monitoring in Jmeter
Using InfluxDB for real-time monitoring in JmeterUsing InfluxDB for real-time monitoring in Jmeter
Using InfluxDB for real-time monitoring in Jmeter
 
Intoduction to KubeVela Presentation (DevOps)
Intoduction to KubeVela Presentation (DevOps)Intoduction to KubeVela Presentation (DevOps)
Intoduction to KubeVela Presentation (DevOps)
 
Stakeholder Management (Project Management) Presentation
Stakeholder Management (Project Management) PresentationStakeholder Management (Project Management) Presentation
Stakeholder Management (Project Management) Presentation
 
Introduction To Kaniko (DevOps) Presentation
Introduction To Kaniko (DevOps) PresentationIntroduction To Kaniko (DevOps) Presentation
Introduction To Kaniko (DevOps) Presentation
 
Efficient Test Environments with Infrastructure as Code (IaC)
Efficient Test Environments with Infrastructure as Code (IaC)Efficient Test Environments with Infrastructure as Code (IaC)
Efficient Test Environments with Infrastructure as Code (IaC)
 
Exploring Terramate DevOps (Presentation)
Exploring Terramate DevOps (Presentation)Exploring Terramate DevOps (Presentation)
Exploring Terramate DevOps (Presentation)
 
Clean Code in Test Automation Differentiating Between the Good and the Bad
Clean Code in Test Automation  Differentiating Between the Good and the BadClean Code in Test Automation  Differentiating Between the Good and the Bad
Clean Code in Test Automation Differentiating Between the Good and the Bad
 
Integrating AI Capabilities in Test Automation
Integrating AI Capabilities in Test AutomationIntegrating AI Capabilities in Test Automation
Integrating AI Capabilities in Test Automation
 
State Management with NGXS in Angular.pptx
State Management with NGXS in Angular.pptxState Management with NGXS in Angular.pptx
State Management with NGXS in Angular.pptx
 
Authentication in Svelte using cookies.pptx
Authentication in Svelte using cookies.pptxAuthentication in Svelte using cookies.pptx
Authentication in Svelte using cookies.pptx
 
OAuth2 Implementation Presentation (Java)
OAuth2 Implementation Presentation (Java)OAuth2 Implementation Presentation (Java)
OAuth2 Implementation Presentation (Java)
 
Supply chain security with Kubeclarity.pptx
Supply chain security with Kubeclarity.pptxSupply chain security with Kubeclarity.pptx
Supply chain security with Kubeclarity.pptx
 
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML ParsingMastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
 
Akka gRPC Essentials A Hands-On Introduction
Akka gRPC Essentials A Hands-On IntroductionAkka gRPC Essentials A Hands-On Introduction
Akka gRPC Essentials A Hands-On Introduction
 
Entity Core with Core Microservices.pptx
Entity Core with Core Microservices.pptxEntity Core with Core Microservices.pptx
Entity Core with Core Microservices.pptx
 
Introduction to Redis and its features.pptx
Introduction to Redis and its features.pptxIntroduction to Redis and its features.pptx
Introduction to Redis and its features.pptx
 

Recently uploaded

Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
deeptiverma2406
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
chanes7
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 

Recently uploaded (20)

Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 

Couchbase - Introduction

  • 1. Introduction to Bharat Singh Trainee Software Consultant Knoldus Software LLP.
  • 2. Agenda ● What is Couchbase ● Why NoSQL ? ● Features of Couchbase ● Views in Couchbase ● Basic CURD operations with fixed key
  • 3. What is Couchbase Couchbase Server is a high-performance NoSQL distributed database with a flexible data model. It scales on commodity hardware to support large data sets with a high number of concurrent reads and writes while maintaining low latency and strong consistency.
  • 4. Why NoSQL ? – With relational technologies, many application developers find it difficult, or even impossible, to get the dynamic scalability and level of scale they need while also maintaining the performance users demand. – Data is becoming easier to capture and access through third parties such as Facebook. It’s not surprising that developers find increasing value in leveraging this data to enrich existing applications and create new apps. – Developers want a highly flexible solution that easily accommodates any new type of data they choose to work with, and isn’t disrupted by content structure changes from third-party data providers. Much of the new data is unstructured and semi-structured, so developers also need a database that can efficiently store it. – NoSQL databases are built from the ground up to be distributed, scale-out technologies and are therefore a better fit with the highly distributed nature of the three-tier internet architecture.
  • 5. Features of Couchbase Multi-Dimensional Scaling ● Couchbase has redefined the way enterprises scale distributed databases with the option of Multi-Dimensional Scaling. It separates, isolates, and scales individual services – query, index, and data – to improve application performance and increase resource utilization. Couchbase Server 4.0 is the first and only distributed database capable of scaling with the speed and precision required by enterprise applications with variable workloads. ● Multi-Dimensional Scaling enables enterprises to optimize hardware by allocating resources based on the workload of a specific service, and to avoid resource contention by performing queries, maintaining indexes, and writing data with different nodes. It is inefficient to require participation from every node to perform a query or maintain an index. Couchbase Server 4.0 solves this problem by scaling data independent of queries and indexes.
  • 7. Features of Couchbase N1QL (read as 'Nickel') ● N1QL is the first query language to leverage the complete flexibility of JSON and the full power of SQL. While JSON benefits from SQL because it enables developers to model and query data with relationships, SQL benefits from JSON because it removes the “impedance mismatch” between the data model and the application model. In fact, the data model is no longer limited to "single table" or "table per query" impementations - related data can be embedded or referenced and the same data can be queried in different ways. ● N1QL enables developers to transition to a NoSQL database by leveraging existing SQL and data modeling knowledge. It is now possible to create a data model that combines both nested and related data while avoiding the need to create and maintain complex query logic – for example, multiple queries are no longer required to get related data. N1QL enables developers to buid applications that require ad-hoc access to data with greater precision and intelligence.
  • 8. Features of Couchbase Global Secondary Indexing (GSI) ● In addition to the existing MapReduce-based indexes known as views, Couchbase Server provides a global secondary index (GSI). With GSI, you can access your documents faster by using secondary index fields without the overhead of MapReduce. ● GSI provides fast access for N1QL queries. With the support of GSI, you can submit queries that target specific lookups on secondary fields. For example, you can look up customers by email address rather than relying on a customer key. ● GSI provides the following benefits: ● Improves index efficiency by avoiding gather-scatter and index working set management ● Improves application scalability by allowing indexes to partition and scale independently
  • 9.
  • 10. Features of Couchbase Cross Datacenter Replication (XDCR) - Filtering ● Couchbase supports cross-data-center replication (XDCR), which provides live replication of database contents of one Couchbase cluster to a geographically remote cluster. Note that XDCR operates simultaneously with intracluster replication (the copying of live documents to their inactive replica counterparts on other cluster members), and all systems in an XDCR arrangement invisibly synchronize with one another.
  • 11. Views in Couchbase ● Queries on Couchbase Server are performed via "views," Couchbase terminology for indexes. Put another way, when you create an index, you're provided with a view that serves as your mechanism for querying Couchbase data ● To define a view, you build a specific kind of document called a design document. The design document holds the JavaScript code that implements the mapreduce operations that create the view's index. ● The map function in a design document's mapreduce specification filters and extracts information from the documents against which it executes. The result is a set of key/value pairs that comprise the query-accelerating index. The reduce function is optional. It is typically used to aggregate or sum the data manipulated by the map operation. Code in the reduce function can be used to implement operations that correspond roughly to SQL's ORDER BY, SORT, and aggregation features.
  • 12. Views in Couchbase ● A design document can hold multiple views and the configuration applies to all views in the document. If you update one index, all indexes in the document will be updated. ● Finally, Couchbase distinguishes between development and production views, and the two are kept in separate namespaces. Development views can be modified; production views cannot. The reason for the distinction arises from the fact that, if you modify a view, all views in that design document will be invalidated, and all indexes defined by mapreduce functions in the design document will be rebuilt. Therefore, development views enable you to test your view code in a kind of sandbox before deploying it into a production view.
  • 13. Initialization Couchbase trial app //Required imports import com.couchbase.client.java.{Bucket, CouchbaseCluster} //Create cluster and open bucket val cluster = CouchbaseCluster.create(“127.0.0.1”) val bucket = cluster.openBucket(“user”) //case class to store data in bucket case class User(name:String, email: String)
  • 14. CURD Operations in Couchbase Create record : def insert(user: User): Option[User] = { try { val doc = JsonObject.fromJson(compact(render(decompose(user)))) val result = bucket.insert(JsonDocument.create("usr::" + user.email, (doc))) val jsonAsString = result.content().toString() val insertedData = parse(jsonAsString).extract[User] Some(insertedData) } catch { case exception: Exception => None } }
  • 15. CURD Operations in Couchbase Update record def update(user: User): Option[User] = { try { val doc = JsonObject.fromJson(compact(render(decompose(user)))) val result = bucket.upsert(JsonDocument.create("usr::" + user.email, (doc))) val jsonAsString = result.content().toString() val insertedData = parse(jsonAsString).extract[User] Some(insertedData) } catch { case exception: Exception => None } }
  • 16. CURD Operations in Couchbase Retrieve record def retrieveUser(email: String): Option[User] = { try { val result = bucket.get("usr::" + email) Some(parse(result.content().toString()).extract[User]) } catch { case exception: Exception => None } }
  • 17. CURD Operations in Couchbase Delete record def deleteUser(email: String): Int = { try { val result = bucket.remove("usr::" + email) 1 } catch { case exception: Exception => 0 } }