1 of 21

Couchbase Workshop�Overview��Introduction to Couchbase Lite

and Couchbase Lite Vector Search

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2023. All rights reserved.

1

2 of 21

Data is created at the edge

Phones, sensors and IoT devices constantly generate data at the edge

The global edge computing market is projected to grow from $15.96 billion in 2023 to $216.76 billion by 2032

2

3 of 21

Why process data at the edge?

  • Computational power of modern smartphones
  • Offline processing
  • Reduced latency for users
  • Improved privacy

3

4 of 21

4

5 of 21

Couchbase Mobile: product stack

Cloud to edge to device

Couchbase Server

Scalable, performant

NoSQL data platform

Secure gateway for data �sync and access control

Sync Gateway

Full featured NoSQL

embedded database

Couchbase Lite

Deploy Fully Managed

Deploy Self-Managed

Public Cloud

Private Cloud

Cloud Edge

On Prem

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2024. All rights reserved.

5

6 of 21

Couchbase Mobile | Serve to the Edge

Couchbase Server

Sync Gateway

Mobile App

COUCHBASE LITE

Embedded App

COUCHBASE LITE

Full Featured NoSQL

Embedded Database with CRUD, Query & Search functionality

SYNC GATEWAY

Secure Gateway for Data Sync over the web & Access Control

COUCHBASE SERVER

Highly scalable, available & high-performance NoSQL �database server

  • Available for Android, iOS, .NET and non-mobile apps (Java, C++)�
  • CRUD, SQL, Full-text Search
  • Bidirectional Synchronization with Advanced Filtering�
  • Automatic & Custom conflict resolution
  • Automatic purge with Time-to-Live�
  • End-to-end Encryption At-Rest & In-Transit�
  • Compression & Delta synch�
  • Peer-to-peer synchronization

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2024. All rights reserved.

6

7 of 21

Couchbase Lite/Mobile features

SQL, Search, Eventing

Peer-to-Peer Synchronization

Efficient Replication Protocol

Predictive Queries

On-Device Encryption

Delta Synchronization

Full Featured Embedded Database

Online and Offline Modes

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2023. All rights reserved.

7

8 of 21

Couchbase Sync Gateway

Security & Privacy

Guaranteed High Availability

Bi-directional Replication Protocol

Improved Supportability

Statistics for Monitoring

Unified Web/Mobile

Experiences

Bi-directional Data Sync

Efficient and secure synchronization of data between edge and the cloud

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2023. All rights reserved.

8

9 of 21

Couchbase Mobile | Cloud-to-Edge-to-Device

CENTRALIZED

CLOUD

EDGE�DEVICES

ALERT

Tablet

Laptop

Smartphone

Capella/

Couchbase Server

App Services/

Sync Gateway

IoT Device

Couchbase �Server

Couchbase

Sync Gateway

ALERT

Tablet

Laptop

Smartphone

IoT Device

Couchbase �Server

Couchbase

Sync Gateway

Devices running Couchbase Lite (Peer-to-Peer Sync)

Outposts

Wavelength

Local Zones

Azure Public MEC

Azure Private MEC

Google Distributed Cloud Edge

Web App

On Prem,

Private DC

5G edge

EDGE

DATA CENTER

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2023. All rights reserved.

9

10 of 21

Edge Architecture Isolates Apps from Outages

CENTRALIZED

CLOUD

EDGE�DEVICES

ALERT

Tablet

Laptop

Smartphone

IoT Device

Couchbase �Server

Couchbase

Sync Gateway

ALERT

Tablet

Smartphone

Couchbase �Server

Couchbase

Sync Gateway

Outposts

Wavelength

Local Zones

Edge Zone

Edge Zone w/ Op

Private Edge Zone

Google Distributed Cloud

Internet or Data

Center Outage

Apps Using Edge DC

Continue To Operate

Laptop

IoT Device

Devices running Couchbase Lite (Peer-to-Peer Sync)

On Prem,

Private DC

5G edge

EDGE

DATA CENTER

Web App

Capella/

Couchbase Server

App Services/

Sync Gateway

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2023. All rights reserved.

10

11 of 21

Edge Architecture Isolates Apps from Outages

CENTRALIZED

CLOUD

EDGE�DEVICES

ALERT

Tablet

Laptop

Smartphone

IoT Device

Couchbase �Server

Couchbase

Sync Gateway

ALERT

Tablet

Smartphone

Couchbase �Server

Couchbase

Sync Gateway

Outposts

Wavelength

Local Zones

Edge Zone

Edge Zone w/ Op

Private Edge Zone

Google Distributed Cloud

Internet or Data

Center Outage

Edge Data Center

Outage

Apps With Embedded Database Continue To Operate

Devices running Couchbase Lite (Peer-to-Peer Sync)

On Prem,

Private DC

5G edge

EDGE

DATA CENTER

Web App

Capella/

Couchbase Server

App Services/

Sync Gateway

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2023. All rights reserved.

11

12 of 21

Couchbase supports AI from cloud to edge

Cloud

Edge

Edge Data Center

Data Center

Internet

Apps & Services

ISP | 5G | LAN

Personal Area Network

Apps & Services

Architecture

Couchbase

Couchbase

sync

sync

sync

Couchbase Lite

Device

Server

Cloud

    • Capella DBaaS
    • Self-managed

Edge

    • Self-managed Couchbase
    • On-prem or edge service

Vector Search

    • Semantic / Hybrid search
    • Retrieval-augmented generation

Columnar Analytics

    • Multiple sources, no ETL
    • ML models via UDF

Sync

Hosted

    • App Services

Self-managed

    • Sync Gateway

Device

Couchbase Lite

    • Real-time responsiveness
    • Offline-first
    • Peer-to-peer sync

Vector Search

    • Semantic / Hybrid search
    • Retrieval-augmented generation

Predictive Query

    • Local or remote ML models

First in the industry to announce vector search support for all 3 deployments: cloud, on-prem, mobile

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2024. All rights reserved.

12

13 of 21

Advantages to run Vector Search with Couchbase Mobile

  • Semantic search in Offline Mode
    • Semantic searches support in edge applications irrespective of Internet connectivity
  • Reduced Cost Per Query
    • By embedding the model within the application and handling searches locally, we can reduce data transfer costs (cloud egress charges) and save on bandwidth
  • Low Latency & Timely Responses
    • By embedding the model within the application, we can significantly reduce round trip time it takes to respond to a search queries.
  • Data Privacy
    • Personal data and search queries of sensitive nature do not have to leave the device
  • Unified Cloud to Edge Support
    • Documents (with embeddings) created on server can be synced down to the edge devices and indexed locally on the device. Similarity search across documents can be performed locally on the device alleviating the load on the server.

AI at the Edge is the only way to scale Gen AI Applications

14 of 21

Architecture to support vector search in edge

image

Media Search Application

Data engineers employ recommendation algorithms to create embedding models that incorporate both user and product data.

Uploads JSON documents (text with embedding vector) to the Data Service to load corpus. The image can be stored as a reference.

Search Service receives mutations (upsert or delete) JSON document. maintains indexes across partitions & nodes.

Application sends media (in this case an image) to Embedding Model to get vector.

Embedding Vector is returned to the application .

Embedding Vector is sent to the Search Service as a request to get similar vectors.

.

Search Service returns top k-NN results of query with returns references to similar images. This ranked as per hybrid search..

Application retrieves images by reference (or id) either from original store or from the Data Service depending on design.

Couchbase Lite

Search

Data Service

Search Service

Vector

Search

Index

Embedding Model

similar image id(s)

1

2

3

1

image

2

DCP

3

4

5

6

7

image &

vector

Ranked Similar Media Items

7

matching or similar images

images

5

vector

4

vector

6

8

8

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2023. All rights reserved.

14

15 of 21

Demo for the rest of the Workshop RAG with Couchbase Lite

Application creates vector index

Application sends documents to embedding model and adds vectors to JSON documents

Application creates./updates JSON documents ( text with vector) to Couchbase Lite

This triggers update to vector search index on Couchbase Lite that updates index with document.

Application sends “query text” to Embedding Model

Embedding Model returns embedding Vector

Application calls Couchbase Lite Service with a pure Vector search and fetches docs specific to user.

Couchbase Lite returns top k-NN results of query with requested fields or objects.

Application sends results of query as context to LLM for more accurate responses

RAG Search Application running on edge device with embedded Couchbase Lite

Couchbase Lite

JSON

Documents

Application Search Feature

Document Storage

Vector Search Index

search query

Embedding Model

1

2

4

3

text*

query

text

5

vector

6

7

text &

vector

0

2

3

4

5

6

7

1

CBL

API

Query

*Can be any media

relevant data

Large Language Models (LLMS)

LLM request

LLM response

8

8

16 of 21

MediaPipe is Google's open source cross-platform framework for building perception pipelines

Widely used at Google in research & products to process and analyze video, audio and sensor data:

Dataset preparation pipelines for ML training

ML inference pipelines

You can now run LLMs like Gemma2 on Android using MediaPipe LLM inference API

You will convert an LLM like Gemma into a Mediapipe format using the MediaPipe toolkit to be able to be supported on running it on Android

Introduction to MediaPipe

17 of 21

Take a base LLM like Gemma

Convert it into a format that can be run on Android using the MediaPipe LLM inference

If you use a model outside of the default models supported by Google Edge AI, you have to use the converter.ConversionConfig method to convert the model in a format supported by MediaPipe LLM inference API

Then call the LLM in Android

Introduction to MediaPipe

18 of 21

Couchbase Sync Gateway

Security & Privacy

Guaranteed High Availability

Bi-directional Replication Protocol

Improved Supportability

Statistics for Monitoring

Unified Web/Mobile

Experiences

Bi-directional Data Sync

Efficient and secure synchronization of data between edge and the cloud

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2023. All rights reserved.

18

19 of 21

Capella App Services

Confident

ial and Propri

etary. Do not distribute without Couchbase consent. © Couchbase 2022. All rights reserved.

33

Scalable, performant NoSQL Data Platform

Couchbase Server Sync Gateway

Secure gateway for data sync and access control

Full Featured NoSQL Embedded Database

Couchbase Lite

Fully managed backend that brings the power of Couchbase Mobile’s industry leading offline-first data sync capability to Capella

FULLY MANAGED

FLEXIBLE DEPLOYMENT

COUCHBASE MOBILE STACK

Public Cloud

Private Cloud

On Prem

Cloud Edge

20 of 21

Capella App Services

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2022. All rights reserved.

DBaaS

App Services

Websockets

REST

Couchbase Lite

Couchbase Lite

Mobile, Desktop, Embedded Apps

OFFLINE FIRST SYNC

Secure Data Sync

Browser, Desktop, Mobile Apps

Couchbase Lite

CLOUD DATA ACCESS

Secure Public Data Access

Mobile, Desktop Apps

Couchbase Lite

Couchbase Lite

PEER-TO-PEER WITH CLOUD SYNC

Secure Data Sync

Sync Gateway

Couchbase Server

20

21 of 21

Demo: How to setup App Services in Capella + Setting up Replication

For reference: https://developer.couchbase.com/android-kotlin-replication-app-services

21