SlideShare a Scribd company logo
1 of 35
Delivering a “Serverless” Service
// what is serverless thing and how do we use k8s to get there?
Before we get started
Jim Walker
• Principal Product Evangelist
• @jaymce
This session is INTERMEDIATE
• I am not database “experts”
• I am curious and love tech
• I think this stuff is cool and these concepts
define the future
• GOAL: a high level context of the concept
“wireless”
“electric”
“serverless”
Serverless as a computing paradigm…
1. Little to no manual server management
2. Automatic, elastic app/service scale
3. Built-in resilience and inherently fault tolerant service
4. Always available and instant access
5. Consumption-based rating or billing mechanism
6. Survive any failure domain, including regions
7. Geographic Scale and latencies
8. Infrastructure-less
Over the past 5 or so years, the serverless execution model has been most commonly used for:
● Serverless compute
● Serverless functions
● Serverless app development
But how tho?
So, how do you make a database app serverless?
Language
Execution
Storage
Language: SQL
Distributed Execution
Replication & Distribution
Most Databases
Storage
Find the
divide
single cluster - one logical database
CockroachDB Node 1
Pulling it together, into serverless and beyond
SQL Layer
Execution
Storage & Replication
Distribution
CockroachDB Node 2
SQL Layer
Execution
Storage & Replication
Distribution
CockroachDB Node 3
SQL Layer
Execution
Storage & Replication
Distribution
Virtual Cluster
Shared CockroachDB Storage ONLY Cluster
CockroachDB
SQL Pod 1
Serverless decouples execution and storage
SQL Layer
Execution
Distribution
Storage & Replication Storage & Replication Storage & Replication
CockroachDB
SQL Pod 2
SQL Layer
Execution
Distribution
CockroachDB
SQL Pod 3
SQL Layer
Execution
Distribution
SQL
Storage
Virtual Cluster - Tenant 3
Virtual Cluster 2
Virtual Cluster - Tenant 1
Shared CockroachDB Storage ONLY Cluster
Tenant 1
SQL Pod 1
This allows to scale storage and execution separately
SQL Layer
Execution
Distribution
Storage & Replication Storage & Replication Storage & Replication
Tenant 1
SQL Pod 2
SQL Layer
Execution
Distribution
Tenant 1
SQL Pod 3
SQL Layer
Execution
Distribution
Tenant 2
SQL Pod 1
SQL Layer
Execution
Distribution
Tenant 3
SQL Pod 1
SQL Layer
Execution
Distribution
Tenant 3
SQL Pod 2
SQL Layer
Execution
Distribution
Tenant 3
SQL Pod 3
SQL Layer
Execution
Distribution
Availability Zone 1 Availability Zone 2 Availability Zone 3
App pods are spreads across AZs and the storage
cluster is spread to optimize for resilience
Storage & Replication Storage & Replication Storage & Replication
Tenant 1
SQL Pod 3
SQL Layer
Execution
Distribution
Tenant 1
SQL Pod 2
SQL Layer
Execution
Distribution
Tenant 1
SQL Pod 1
SQL Layer
Execution
Distribution
Availability Zone 1 Availability Zone 2 Availability Zone 3
App pods are spreads across AZs and the storage
cluster is spread to optimize for resilience
Storage & Replication Storage & Replication Storage & Replication
Tenant 1
SQL Pod 3
SQL Layer
Execution
Distribution
Tenant 2
SQL Pod 1
SQL Layer
Execution
Distribution
Tenant 1
SQL Pod 2
SQL Layer
Execution
Distribution
Tenant 1
SQL Pod 1
SQL Layer
Execution
Distribution
Availability Zone 1 Availability Zone 2 Availability Zone 3
App pods are spreads across AZs and the storage
cluster is spread to optimize for resilience
Storage & Replication Storage & Replication Storage & Replication
Tenant 3
SQL Pod 1
SQL Layer
Execution
Distribution
Tenant 1
SQL Pod 3
SQL Layer
Execution
Distribution
Tenant 2
SQL Pod 1
SQL Layer
Execution
Distribution
Tenant 3
SQL Pod 2
SQL Layer
Execution
Distribution
Tenant 1
SQL Pod 2
SQL Layer
Execution
Distribution
Tenant 1
SQL Pod 1
SQL Layer
Execution
Distribution
Tenant 3
SQL Pod 3
SQL Layer
Execution
Distribution
Availability Zone 1 Availability Zone 2 Availability Zone 3
We introduce proxy pods that routes
tenant queries to their SQL pods
Storage & Replication Storage & Replication Storage & Replication
Proxy Proxy Proxy Proxy
LOAD BALANCER
Tenant 3
SQL Pod 1
SQL Layer
Execution
Distribution
Tenant 1
SQL Pod 3
SQL Layer
Execution
Distribution
Tenant 2
SQL Pod 1
SQL Layer
Execution
Distribution
Tenant 3
SQL Pod 2
SQL Layer
Execution
Distribution
Tenant 1
SQL Pod 2
SQL Layer
Execution
Distribution
Tenant 1
SQL Pod 1
SQL Layer
Execution
Distribution
Tenant 3
SQL Pod 3
SQL Layer
Execution
Distribution
Serverless Scale
Data volume scale is accomplished in the storage cluster and uses native distribution
and range splitting
Transactional scale is quite different. We need to
● Accommodate elastic usage
● Deal with spikes in traffic
● Spin down to dormant usage
Autoscaler monitors CPU load on each SQL pod in the cluster, and calculates the
number of SQL pods/tenant based on two metrics:
• Average CPU usage over the last 5 minutes.
• Peak CPU usage during the last 5 minutes.
This is all accomplished using ephemeral SQL pods
Availability Zone 1 Availability Zone 2 Availability Zone 3
Autoscaling your application
Storage & Replication Storage & Replication Storage & Replication
Tenant 1
SQL pod 3
SQL Layer
Execution
Distribution
Tenant 1
SQL POd 2
SQL Layer
Execution
Distribution
Tenant 1
SQL Pod 1
SQL Layer
Execution
Distribution
Proxy Proxy Proxy Proxy
LOAD BALANCER
unassigned unassigned
unassigned
unassigned
unassigned
unassigned
unassigned
unassigned
unassigned
“Hot”
pods
“Hot”
pods
“Hot”
pods
Tenant 1
Capacity
Availability Zone 1 Availability Zone 2 Availability Zone 3
Accommodates peaks in traffic by adding SQL pods
Storage & Replication Storage & Replication Storage & Replication
Tenant 1
SQL Pod 3
SQL Layer
Execution
Distribution
Tenant 1
SQL Pod 2
SQL Layer
Execution
Distribution
Tenant 1
SQL Pod 1
SQL Layer
Execution
Distribution
Proxy Proxy Proxy Proxy
LOAD BALANCER
unassigned
Tenant 1
SQL pod 4
SQL Layer
Execution
Distribution
unassigned
unassigned
unassigned
unassigned
unassigned
unassigned
unassigned
unassigned
“Hot”
pods
“Hot”
pods
“Hot”
pods
Tenant 1
Capacity
Availability Zone 1 Availability Zone 2 Availability Zone 3
...and returns to “steady state” after the event
Storage & Replication Storage & Replication Storage & Replication
Tenant 1
SQL Pod 3
SQL Layer
Execution
Distribution
Tenant 1
SQL Pod 2
SQL Layer
Execution
Distribution
Tenant 1
SQL Pod 1
SQL Layer
Execution
Distribution
Proxy Proxy Proxy Proxy
LOAD BALANCER
unassigned unassigned
unassigned
unassigned
unassigned
unassigned
unassigned
unassigned
unassigned
“Hot”
pods
“Hot”
pods
“Hot”
pods
Tenant 1
Capacity
Availability Zone 1 Availability Zone 2 Availability Zone 3
And when there is no traffic, the tenant goes dormant and
the pods spin down to zero
Storage & Replication Storage & Replication Storage & Replication
Proxy Proxy Proxy Proxy
LOAD BALANCER
unassigned unassigned
unassigned
unassigned
unassigned
unassigned
unassigned
unassigned
unassigned
“Hot”
pods
“Hot”
pods
“Hot”
pods
Tenant 1
Capacity
Availability Zone 1 Availability Zone 2 Availability Zone 3
When it needs to “wake up”, it spins up a “hot” pod
Storage & Replication Storage & Replication Storage & Replication
Proxy Proxy Proxy Proxy
LOAD BALANCER
unassigned unassigned
unassigned
unassigned
unassigned
unassigned
unassigned
unassigned
unassigned
“Hot”
pods
“Hot”
pods
“Hot”
pods
Tenant 1
Capacity
Tenant 1
SQL Pod 4
SQL Layer
Execution
Distribution
Serverless gives developers what they want
Spin up a CockroachDB
Serverless cluster in seconds,
for free w/out a credit card
Start Instantly
No need to manage, upgrade or
operate the database, just
connect and code
No Operations
Use a SQL database that scales
storage and transaction vols
up/down to meet demand
Auto Scale
CockroachDB serverless
replicates your data across AZs
to ensure it is always available
Eliminate Downtime
Serverless gives developers what they want
Spin up a CockroachDB
Serverless cluster in seconds,
for free w/out a credit card
Start Instantly
No need to manage, upgrade or
operate the database, just
connect and code
No Operations
Use a SQL database that scales
storage and transaction vols
up/down to meet demand
Auto Scale
CockroachDB serverless
replicates your data across AZs
to ensure it is always available
Eliminate Downtime
Just Build
Relational models and SQL
Guaranteed correct, low-latency transactions
OPERATIONS
NO
YES Code against an API
Wire compatible w/ PostgreSQL
DEVELOPER
FOCUS?
CODE
YES
GENEROUS free tier
For us, it’s a database!
THANK YOU
Create a CockroachDB instance now…
Serverless(beta)
A single region instance with a generous free tier and
with a capped pay for usage beyond free limits
No credit card required!
Free, every month up to:
• 5GB Storage
• 250M Request Units
Dedicated
A full featured, single tenant instance. Deploy instantly
on AWS or GCP in a single region or across multiple
regions with 99.99% guaranteed uptime.
Let our SRE team provision and manage your
database.
www.cockroachlabs.com
What if I run out of request units (RUs)?
CockroachDB Serverless doesn’t turn off once you use your spend limit capacity, it
ensures you will have at least 100RUs/second for remainder of billing period (month)
What is it good for?
In its current state, We
believe CockroachDB
Serverless will be good for:
● side projects
● smaller apps
● low code apps
● learning SQL
Gaining familiarity with
SQL or CockroachDB
SINGLE LOGICAL
DATABASE
CockroachDB: Architected For the Cloud
A fundamentally better database for your developers and applications
CockroachDB is a distributed, relational database that
can be used for mundane and high value workloads
It is a database cluster that is comprised of nodes that
appear as a single logical database
It gives your developers, familiar standard SQL
USER: Ashley
> INSERT (Kimball)
INTO CUSTOMER;
SINGLE LOGICAL
DATABASE
CockroachDB: Architected For the Cloud
A fundamentally better database for your developers and applications
Scale the database by simply adding more nodes.
CockroachDB auto-balances to incorporate the new
resource. No manual work is required.
● Easy scale for increase in database size
● Every node accepts reads and write so
you also scale transactional volume
USER: Ashley
> INSERT (Kimball)
INTO CUSTOMER;
USER: Lindsay
> SELECT * FROM
ORDERS;
SINGLE LOGICAL
DATABASE
CockroachDB: Architected For the Cloud
A fundamentally better database for your developers and applications
REGION 1
US-WEST
REGION 1
US-WEST
REGION 1
US-WEST
Scale even further across regions
and even clouds, yet still deliver a
single logical database
It excels when deployed across
multiple data centers.
USER: Ashley
> INSERT (Kimball)
INTO CUSTOMER;
USER: Lindsay
> SELECT * FROM
ORDERS;
USER: Peter
> UPDATE (Kimball)
FNAME=”Spencer”;
SINGLE LOGICAL
DATABASE
CockroachDB: Architected For the Cloud
A fundamentally better database for your developers and applications
Scale even further across regions
and even clouds, yet still deliver a
single logical database
It excels when deployed across
multiple data centers.
...and even multi-cloud!
USER: Ashley
> INSERT (Kimball)
INTO CUSTOMER;
USER: Lindsay
> SELECT * FROM
ORDERS;
USER: Peter
> UPDATE (Kimball)
FNAME=”Spencer”;
SINGLE LOGICAL
DATABASE
CockroachDB: Architected For the Cloud
A fundamentally better database for your developers and applications
USER: Ashley
> INSERT (Kimball)
INTO CUSTOMER;
USER: Lindsay
> SELECT * FROM
ORDERS;
REGION 1
US-WEST
REGION 1
US-WEST
REGION 1
US-WEST
USER: Peter
> UPDATE (Kimball)
FNAME=”Spencer”;
CockroachDB is naturally resilient so you can
survive the failure of a node or even an entire
region without service disruption
● Always-on, always available w/ zero RPO/RTO
● Allows for no downtime rolling upgrades
REGION 2
US-EAST
REGION 3
EMEA
REGION 1
US-WEST
CockroachDB: Architected For the Cloud
A fundamentally better database for your developers and applications
USER: Random
> INSERT (Kimball)
INTO CUSTOMER;
LOAD BALANCER
Kimball
Mattis
Stewart
LOAD BALANCER LOAD BALANCER
Kimball
Mattis
Stewart
Kimball
Mattis
Stewart
Ask any node for data and it will find it in
the cluster
REGION 2
US-EAST
REGION 3
EMEA
REGION 1
US-WEST
CockroachDB: Architected For the Cloud
A fundamentally better database for your developers and applications
USER: Random
> INSERT (Kimball)
INTO CUSTOMER;
LOAD BALANCER
Kimball
Mattis
Stewart
USER: Kimball
> SELECT (Kimball)
FROM CUSTOMER;
LOAD BALANCER LOAD BALANCER
Ask any node for data and it will find it in
the cluster
Geo-locate data near user to reduce
read/write latencies
(or comply with regulations)
Kimball
Mattis
Stewart
Kimball
Mattis
Stewart

More Related Content

Similar to Using Kubernetes to deliver a “serverless” service

Sql 2012 always on
Sql 2012 always onSql 2012 always on
Sql 2012 always on
dilip nayak
 
Business_Continuity_Planning_with_SQL_Server_HADR_options_TechEd_Bangalore_20...
Business_Continuity_Planning_with_SQL_Server_HADR_options_TechEd_Bangalore_20...Business_Continuity_Planning_with_SQL_Server_HADR_options_TechEd_Bangalore_20...
Business_Continuity_Planning_with_SQL_Server_HADR_options_TechEd_Bangalore_20...
LarryZaman
 
O'Reilly Webinar: Simplicity Scales - Big Data
O'Reilly Webinar: Simplicity Scales - Big Data O'Reilly Webinar: Simplicity Scales - Big Data
O'Reilly Webinar: Simplicity Scales - Big Data
Basho Technologies
 

Similar to Using Kubernetes to deliver a “serverless” service (20)

Azure Cosmos DB - NoSQL Strikes Back (An introduction to the dark side of you...
Azure Cosmos DB - NoSQL Strikes Back (An introduction to the dark side of you...Azure Cosmos DB - NoSQL Strikes Back (An introduction to the dark side of you...
Azure Cosmos DB - NoSQL Strikes Back (An introduction to the dark side of you...
 
Webinar slides: Introduction to Database Proxies (for MySQL)
Webinar slides: Introduction to Database Proxies (for MySQL)Webinar slides: Introduction to Database Proxies (for MySQL)
Webinar slides: Introduction to Database Proxies (for MySQL)
 
Dissolving the Problem (Making an ACID-Compliant Database Out of Apache Kafka®)
Dissolving the Problem (Making an ACID-Compliant Database Out of Apache Kafka®)Dissolving the Problem (Making an ACID-Compliant Database Out of Apache Kafka®)
Dissolving the Problem (Making an ACID-Compliant Database Out of Apache Kafka®)
 
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #1: AWS Aurora
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #1: AWS AuroraWebinar Slides: MySQL HA/DR/Geo-Scale - High Noon #1: AWS Aurora
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #1: AWS Aurora
 
Sql 2012 always on
Sql 2012 always onSql 2012 always on
Sql 2012 always on
 
Design, Deploy, and Optimize SQL Server on AWS - AWS Online Tech Talks
Design, Deploy, and Optimize SQL Server on AWS - AWS Online Tech TalksDesign, Deploy, and Optimize SQL Server on AWS - AWS Online Tech Talks
Design, Deploy, and Optimize SQL Server on AWS - AWS Online Tech Talks
 
Amazon Aurora: Amazon’s New Relational Database Engine
Amazon Aurora: Amazon’s New Relational Database EngineAmazon Aurora: Amazon’s New Relational Database Engine
Amazon Aurora: Amazon’s New Relational Database Engine
 
Business_Continuity_Planning_with_SQL_Server_HADR_options_TechEd_Bangalore_20...
Business_Continuity_Planning_with_SQL_Server_HADR_options_TechEd_Bangalore_20...Business_Continuity_Planning_with_SQL_Server_HADR_options_TechEd_Bangalore_20...
Business_Continuity_Planning_with_SQL_Server_HADR_options_TechEd_Bangalore_20...
 
Design, Deploy, and Optimize SQL Server on AWS - June 2017 AWS Online Tech Talks
Design, Deploy, and Optimize SQL Server on AWS - June 2017 AWS Online Tech TalksDesign, Deploy, and Optimize SQL Server on AWS - June 2017 AWS Online Tech Talks
Design, Deploy, and Optimize SQL Server on AWS - June 2017 AWS Online Tech Talks
 
Amazon Aurora
Amazon AuroraAmazon Aurora
Amazon Aurora
 
Webinar: Emerging Trends in Data Architecture – What’s the Next Big Thing?
Webinar: Emerging Trends in Data Architecture – What’s the Next Big Thing?Webinar: Emerging Trends in Data Architecture – What’s the Next Big Thing?
Webinar: Emerging Trends in Data Architecture – What’s the Next Big Thing?
 
AWS Elasticity and Auto Scaling
AWS Elasticity and Auto ScalingAWS Elasticity and Auto Scaling
AWS Elasticity and Auto Scaling
 
Oracle RAC and Your Way to the Cloud by Angelo Pruscino
Oracle RAC and Your Way to the Cloud by Angelo PruscinoOracle RAC and Your Way to the Cloud by Angelo Pruscino
Oracle RAC and Your Way to the Cloud by Angelo Pruscino
 
Azure Cosmos DB - Technical Deep Dive
Azure Cosmos DB - Technical Deep DiveAzure Cosmos DB - Technical Deep Dive
Azure Cosmos DB - Technical Deep Dive
 
AWS Summit London 2014 | Scaling on AWS for the First 10 Million Users (200)
AWS Summit London 2014 | Scaling on AWS for the First 10 Million Users (200)AWS Summit London 2014 | Scaling on AWS for the First 10 Million Users (200)
AWS Summit London 2014 | Scaling on AWS for the First 10 Million Users (200)
 
Amazon Aurora Let's Talk About Performance
Amazon Aurora Let's Talk About PerformanceAmazon Aurora Let's Talk About Performance
Amazon Aurora Let's Talk About Performance
 
Solr Compute Cloud – An Elastic Solr Infrastructure: Presented by Nitin Sharm...
Solr Compute Cloud – An Elastic Solr Infrastructure: Presented by Nitin Sharm...Solr Compute Cloud – An Elastic Solr Infrastructure: Presented by Nitin Sharm...
Solr Compute Cloud – An Elastic Solr Infrastructure: Presented by Nitin Sharm...
 
CosmosDB for DBAs & Developers
CosmosDB for DBAs & DevelopersCosmosDB for DBAs & Developers
CosmosDB for DBAs & Developers
 
O'Reilly Webinar: Simplicity Scales - Big Data
O'Reilly Webinar: Simplicity Scales - Big Data O'Reilly Webinar: Simplicity Scales - Big Data
O'Reilly Webinar: Simplicity Scales - Big Data
 
Cloud computing & lamp applications
Cloud computing & lamp applicationsCloud computing & lamp applications
Cloud computing & lamp applications
 

More from DoKC

The Kubernetes Native Database
The Kubernetes Native DatabaseThe Kubernetes Native Database
The Kubernetes Native Database
DoKC
 
Overcoming challenges with protecting and migrating data in multi-cloud K8s e...
Overcoming challenges with protecting and migrating data in multi-cloud K8s e...Overcoming challenges with protecting and migrating data in multi-cloud K8s e...
Overcoming challenges with protecting and migrating data in multi-cloud K8s e...
DoKC
 
We will Dok You! - The journey to adopt stateful workloads on k8s
We will Dok You! - The journey to adopt stateful workloads on k8sWe will Dok You! - The journey to adopt stateful workloads on k8s
We will Dok You! - The journey to adopt stateful workloads on k8s
DoKC
 

More from DoKC (20)

Distributed Vector Databases - What, Why, and How
Distributed Vector Databases - What, Why, and HowDistributed Vector Databases - What, Why, and How
Distributed Vector Databases - What, Why, and How
 
Is It Safe? Security Hardening for Databases Using Kubernetes Operators
Is It Safe? Security Hardening for Databases Using Kubernetes OperatorsIs It Safe? Security Hardening for Databases Using Kubernetes Operators
Is It Safe? Security Hardening for Databases Using Kubernetes Operators
 
Stop Worrying and Keep Querying, Using Automated Multi-Region Disaster Recovery
Stop Worrying and Keep Querying, Using Automated Multi-Region Disaster RecoveryStop Worrying and Keep Querying, Using Automated Multi-Region Disaster Recovery
Stop Worrying and Keep Querying, Using Automated Multi-Region Disaster Recovery
 
Transforming Data Processing with Kubernetes: Journey Towards a Self-Serve Da...
Transforming Data Processing with Kubernetes: Journey Towards a Self-Serve Da...Transforming Data Processing with Kubernetes: Journey Towards a Self-Serve Da...
Transforming Data Processing with Kubernetes: Journey Towards a Self-Serve Da...
 
The State of Stateful on Kubernetes
The State of Stateful on KubernetesThe State of Stateful on Kubernetes
The State of Stateful on Kubernetes
 
Colocating Data Workloads and Web Services on Kubernetes to Improve Resource ...
Colocating Data Workloads and Web Services on Kubernetes to Improve Resource ...Colocating Data Workloads and Web Services on Kubernetes to Improve Resource ...
Colocating Data Workloads and Web Services on Kubernetes to Improve Resource ...
 
Make Your Kafka Cluster Production-Ready
Make Your Kafka Cluster Production-ReadyMake Your Kafka Cluster Production-Ready
Make Your Kafka Cluster Production-Ready
 
Dynamic Large Scale Spark on Kubernetes: Empowering the Community with Argo W...
Dynamic Large Scale Spark on Kubernetes: Empowering the Community with Argo W...Dynamic Large Scale Spark on Kubernetes: Empowering the Community with Argo W...
Dynamic Large Scale Spark on Kubernetes: Empowering the Community with Argo W...
 
Run PostgreSQL in Warp Speed Using NVMe/TCP in the Cloud
Run PostgreSQL in Warp Speed Using NVMe/TCP in the CloudRun PostgreSQL in Warp Speed Using NVMe/TCP in the Cloud
Run PostgreSQL in Warp Speed Using NVMe/TCP in the Cloud
 
The Kubernetes Native Database
The Kubernetes Native DatabaseThe Kubernetes Native Database
The Kubernetes Native Database
 
ING Data Services hosted on ICHP DoK Amsterdam 2023
ING Data Services hosted on ICHP DoK Amsterdam 2023ING Data Services hosted on ICHP DoK Amsterdam 2023
ING Data Services hosted on ICHP DoK Amsterdam 2023
 
Implementing data and databases on K8s within the Dutch government
Implementing data and databases on K8s within the Dutch governmentImplementing data and databases on K8s within the Dutch government
Implementing data and databases on K8s within the Dutch government
 
StatefulSets in K8s - DoK Talks #154
StatefulSets in K8s - DoK Talks #154StatefulSets in K8s - DoK Talks #154
StatefulSets in K8s - DoK Talks #154
 
Running PostgreSQL in Kubernetes: from day 0 to day 2 with CloudNativePG - Do...
Running PostgreSQL in Kubernetes: from day 0 to day 2 with CloudNativePG - Do...Running PostgreSQL in Kubernetes: from day 0 to day 2 with CloudNativePG - Do...
Running PostgreSQL in Kubernetes: from day 0 to day 2 with CloudNativePG - Do...
 
Analytics with Apache Superset and ClickHouse - DoK Talks #151
Analytics with Apache Superset and ClickHouse - DoK Talks #151Analytics with Apache Superset and ClickHouse - DoK Talks #151
Analytics with Apache Superset and ClickHouse - DoK Talks #151
 
Overcoming challenges with protecting and migrating data in multi-cloud K8s e...
Overcoming challenges with protecting and migrating data in multi-cloud K8s e...Overcoming challenges with protecting and migrating data in multi-cloud K8s e...
Overcoming challenges with protecting and migrating data in multi-cloud K8s e...
 
Evaluating Cloud Native Storage Vendors - DoK Talks #147
Evaluating Cloud Native Storage Vendors - DoK Talks #147Evaluating Cloud Native Storage Vendors - DoK Talks #147
Evaluating Cloud Native Storage Vendors - DoK Talks #147
 
Kubernetes Cluster Upgrade Strategies and Data: Best Practices for your State...
Kubernetes Cluster Upgrade Strategies and Data: Best Practices for your State...Kubernetes Cluster Upgrade Strategies and Data: Best Practices for your State...
Kubernetes Cluster Upgrade Strategies and Data: Best Practices for your State...
 
We will Dok You! - The journey to adopt stateful workloads on k8s
We will Dok You! - The journey to adopt stateful workloads on k8sWe will Dok You! - The journey to adopt stateful workloads on k8s
We will Dok You! - The journey to adopt stateful workloads on k8s
 
Mastering MongoDB on Kubernetes, the power of operators
Mastering MongoDB on Kubernetes, the power of operators Mastering MongoDB on Kubernetes, the power of operators
Mastering MongoDB on Kubernetes, the power of operators
 

Recently uploaded

Recently uploaded (20)

WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
 
WSO2Con2024 - Unleashing the Financial Potential of 13 Million People
WSO2Con2024 - Unleashing the Financial Potential of 13 Million PeopleWSO2Con2024 - Unleashing the Financial Potential of 13 Million People
WSO2Con2024 - Unleashing the Financial Potential of 13 Million People
 
WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...
WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...
WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...
WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...
WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
 
WSO2CON 2024 - Architecting AI in the Enterprise: APIs and Applications
WSO2CON 2024 - Architecting AI in the Enterprise: APIs and ApplicationsWSO2CON 2024 - Architecting AI in the Enterprise: APIs and Applications
WSO2CON 2024 - Architecting AI in the Enterprise: APIs and Applications
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
Evolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI EraEvolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI Era
 
WSO2CON2024 - Why Should You Consider Ballerina for Your Next Integration
WSO2CON2024 - Why Should You Consider Ballerina for Your Next IntegrationWSO2CON2024 - Why Should You Consider Ballerina for Your Next Integration
WSO2CON2024 - Why Should You Consider Ballerina for Your Next Integration
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
WSO2CON 2024 - OSU & WSO2: A Decade Journey in Integration & Innovation
WSO2CON 2024 - OSU & WSO2: A Decade Journey in Integration & InnovationWSO2CON 2024 - OSU & WSO2: A Decade Journey in Integration & Innovation
WSO2CON 2024 - OSU & WSO2: A Decade Journey in Integration & Innovation
 
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
 
WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...
WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...
WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 
WSO2Con2024 - Low-Code Integration Tooling
WSO2Con2024 - Low-Code Integration ToolingWSO2Con2024 - Low-Code Integration Tooling
WSO2Con2024 - Low-Code Integration Tooling
 

Using Kubernetes to deliver a “serverless” service

  • 1. Delivering a “Serverless” Service // what is serverless thing and how do we use k8s to get there?
  • 2. Before we get started Jim Walker • Principal Product Evangelist • @jaymce This session is INTERMEDIATE • I am not database “experts” • I am curious and love tech • I think this stuff is cool and these concepts define the future • GOAL: a high level context of the concept
  • 6. Serverless as a computing paradigm… 1. Little to no manual server management 2. Automatic, elastic app/service scale 3. Built-in resilience and inherently fault tolerant service 4. Always available and instant access 5. Consumption-based rating or billing mechanism 6. Survive any failure domain, including regions 7. Geographic Scale and latencies 8. Infrastructure-less Over the past 5 or so years, the serverless execution model has been most commonly used for: ● Serverless compute ● Serverless functions ● Serverless app development
  • 8. So, how do you make a database app serverless? Language Execution Storage Language: SQL Distributed Execution Replication & Distribution Most Databases Storage Find the divide
  • 9. single cluster - one logical database CockroachDB Node 1 Pulling it together, into serverless and beyond SQL Layer Execution Storage & Replication Distribution CockroachDB Node 2 SQL Layer Execution Storage & Replication Distribution CockroachDB Node 3 SQL Layer Execution Storage & Replication Distribution
  • 10. Virtual Cluster Shared CockroachDB Storage ONLY Cluster CockroachDB SQL Pod 1 Serverless decouples execution and storage SQL Layer Execution Distribution Storage & Replication Storage & Replication Storage & Replication CockroachDB SQL Pod 2 SQL Layer Execution Distribution CockroachDB SQL Pod 3 SQL Layer Execution Distribution SQL Storage
  • 11. Virtual Cluster - Tenant 3 Virtual Cluster 2 Virtual Cluster - Tenant 1 Shared CockroachDB Storage ONLY Cluster Tenant 1 SQL Pod 1 This allows to scale storage and execution separately SQL Layer Execution Distribution Storage & Replication Storage & Replication Storage & Replication Tenant 1 SQL Pod 2 SQL Layer Execution Distribution Tenant 1 SQL Pod 3 SQL Layer Execution Distribution Tenant 2 SQL Pod 1 SQL Layer Execution Distribution Tenant 3 SQL Pod 1 SQL Layer Execution Distribution Tenant 3 SQL Pod 2 SQL Layer Execution Distribution Tenant 3 SQL Pod 3 SQL Layer Execution Distribution
  • 12. Availability Zone 1 Availability Zone 2 Availability Zone 3 App pods are spreads across AZs and the storage cluster is spread to optimize for resilience Storage & Replication Storage & Replication Storage & Replication Tenant 1 SQL Pod 3 SQL Layer Execution Distribution Tenant 1 SQL Pod 2 SQL Layer Execution Distribution Tenant 1 SQL Pod 1 SQL Layer Execution Distribution
  • 13. Availability Zone 1 Availability Zone 2 Availability Zone 3 App pods are spreads across AZs and the storage cluster is spread to optimize for resilience Storage & Replication Storage & Replication Storage & Replication Tenant 1 SQL Pod 3 SQL Layer Execution Distribution Tenant 2 SQL Pod 1 SQL Layer Execution Distribution Tenant 1 SQL Pod 2 SQL Layer Execution Distribution Tenant 1 SQL Pod 1 SQL Layer Execution Distribution
  • 14. Availability Zone 1 Availability Zone 2 Availability Zone 3 App pods are spreads across AZs and the storage cluster is spread to optimize for resilience Storage & Replication Storage & Replication Storage & Replication Tenant 3 SQL Pod 1 SQL Layer Execution Distribution Tenant 1 SQL Pod 3 SQL Layer Execution Distribution Tenant 2 SQL Pod 1 SQL Layer Execution Distribution Tenant 3 SQL Pod 2 SQL Layer Execution Distribution Tenant 1 SQL Pod 2 SQL Layer Execution Distribution Tenant 1 SQL Pod 1 SQL Layer Execution Distribution Tenant 3 SQL Pod 3 SQL Layer Execution Distribution
  • 15. Availability Zone 1 Availability Zone 2 Availability Zone 3 We introduce proxy pods that routes tenant queries to their SQL pods Storage & Replication Storage & Replication Storage & Replication Proxy Proxy Proxy Proxy LOAD BALANCER Tenant 3 SQL Pod 1 SQL Layer Execution Distribution Tenant 1 SQL Pod 3 SQL Layer Execution Distribution Tenant 2 SQL Pod 1 SQL Layer Execution Distribution Tenant 3 SQL Pod 2 SQL Layer Execution Distribution Tenant 1 SQL Pod 2 SQL Layer Execution Distribution Tenant 1 SQL Pod 1 SQL Layer Execution Distribution Tenant 3 SQL Pod 3 SQL Layer Execution Distribution
  • 16. Serverless Scale Data volume scale is accomplished in the storage cluster and uses native distribution and range splitting Transactional scale is quite different. We need to ● Accommodate elastic usage ● Deal with spikes in traffic ● Spin down to dormant usage Autoscaler monitors CPU load on each SQL pod in the cluster, and calculates the number of SQL pods/tenant based on two metrics: • Average CPU usage over the last 5 minutes. • Peak CPU usage during the last 5 minutes. This is all accomplished using ephemeral SQL pods
  • 17. Availability Zone 1 Availability Zone 2 Availability Zone 3 Autoscaling your application Storage & Replication Storage & Replication Storage & Replication Tenant 1 SQL pod 3 SQL Layer Execution Distribution Tenant 1 SQL POd 2 SQL Layer Execution Distribution Tenant 1 SQL Pod 1 SQL Layer Execution Distribution Proxy Proxy Proxy Proxy LOAD BALANCER unassigned unassigned unassigned unassigned unassigned unassigned unassigned unassigned unassigned “Hot” pods “Hot” pods “Hot” pods Tenant 1 Capacity
  • 18. Availability Zone 1 Availability Zone 2 Availability Zone 3 Accommodates peaks in traffic by adding SQL pods Storage & Replication Storage & Replication Storage & Replication Tenant 1 SQL Pod 3 SQL Layer Execution Distribution Tenant 1 SQL Pod 2 SQL Layer Execution Distribution Tenant 1 SQL Pod 1 SQL Layer Execution Distribution Proxy Proxy Proxy Proxy LOAD BALANCER unassigned Tenant 1 SQL pod 4 SQL Layer Execution Distribution unassigned unassigned unassigned unassigned unassigned unassigned unassigned unassigned “Hot” pods “Hot” pods “Hot” pods Tenant 1 Capacity
  • 19. Availability Zone 1 Availability Zone 2 Availability Zone 3 ...and returns to “steady state” after the event Storage & Replication Storage & Replication Storage & Replication Tenant 1 SQL Pod 3 SQL Layer Execution Distribution Tenant 1 SQL Pod 2 SQL Layer Execution Distribution Tenant 1 SQL Pod 1 SQL Layer Execution Distribution Proxy Proxy Proxy Proxy LOAD BALANCER unassigned unassigned unassigned unassigned unassigned unassigned unassigned unassigned unassigned “Hot” pods “Hot” pods “Hot” pods Tenant 1 Capacity
  • 20. Availability Zone 1 Availability Zone 2 Availability Zone 3 And when there is no traffic, the tenant goes dormant and the pods spin down to zero Storage & Replication Storage & Replication Storage & Replication Proxy Proxy Proxy Proxy LOAD BALANCER unassigned unassigned unassigned unassigned unassigned unassigned unassigned unassigned unassigned “Hot” pods “Hot” pods “Hot” pods Tenant 1 Capacity
  • 21. Availability Zone 1 Availability Zone 2 Availability Zone 3 When it needs to “wake up”, it spins up a “hot” pod Storage & Replication Storage & Replication Storage & Replication Proxy Proxy Proxy Proxy LOAD BALANCER unassigned unassigned unassigned unassigned unassigned unassigned unassigned unassigned unassigned “Hot” pods “Hot” pods “Hot” pods Tenant 1 Capacity Tenant 1 SQL Pod 4 SQL Layer Execution Distribution
  • 22. Serverless gives developers what they want Spin up a CockroachDB Serverless cluster in seconds, for free w/out a credit card Start Instantly No need to manage, upgrade or operate the database, just connect and code No Operations Use a SQL database that scales storage and transaction vols up/down to meet demand Auto Scale CockroachDB serverless replicates your data across AZs to ensure it is always available Eliminate Downtime
  • 23. Serverless gives developers what they want Spin up a CockroachDB Serverless cluster in seconds, for free w/out a credit card Start Instantly No need to manage, upgrade or operate the database, just connect and code No Operations Use a SQL database that scales storage and transaction vols up/down to meet demand Auto Scale CockroachDB serverless replicates your data across AZs to ensure it is always available Eliminate Downtime Just Build Relational models and SQL Guaranteed correct, low-latency transactions OPERATIONS NO YES Code against an API Wire compatible w/ PostgreSQL DEVELOPER FOCUS? CODE YES GENEROUS free tier For us, it’s a database!
  • 25.
  • 26.
  • 27. Create a CockroachDB instance now… Serverless(beta) A single region instance with a generous free tier and with a capped pay for usage beyond free limits No credit card required! Free, every month up to: • 5GB Storage • 250M Request Units Dedicated A full featured, single tenant instance. Deploy instantly on AWS or GCP in a single region or across multiple regions with 99.99% guaranteed uptime. Let our SRE team provision and manage your database. www.cockroachlabs.com
  • 28. What if I run out of request units (RUs)? CockroachDB Serverless doesn’t turn off once you use your spend limit capacity, it ensures you will have at least 100RUs/second for remainder of billing period (month) What is it good for? In its current state, We believe CockroachDB Serverless will be good for: ● side projects ● smaller apps ● low code apps ● learning SQL Gaining familiarity with SQL or CockroachDB
  • 29. SINGLE LOGICAL DATABASE CockroachDB: Architected For the Cloud A fundamentally better database for your developers and applications CockroachDB is a distributed, relational database that can be used for mundane and high value workloads It is a database cluster that is comprised of nodes that appear as a single logical database It gives your developers, familiar standard SQL USER: Ashley > INSERT (Kimball) INTO CUSTOMER;
  • 30. SINGLE LOGICAL DATABASE CockroachDB: Architected For the Cloud A fundamentally better database for your developers and applications Scale the database by simply adding more nodes. CockroachDB auto-balances to incorporate the new resource. No manual work is required. ● Easy scale for increase in database size ● Every node accepts reads and write so you also scale transactional volume USER: Ashley > INSERT (Kimball) INTO CUSTOMER; USER: Lindsay > SELECT * FROM ORDERS;
  • 31. SINGLE LOGICAL DATABASE CockroachDB: Architected For the Cloud A fundamentally better database for your developers and applications REGION 1 US-WEST REGION 1 US-WEST REGION 1 US-WEST Scale even further across regions and even clouds, yet still deliver a single logical database It excels when deployed across multiple data centers. USER: Ashley > INSERT (Kimball) INTO CUSTOMER; USER: Lindsay > SELECT * FROM ORDERS; USER: Peter > UPDATE (Kimball) FNAME=”Spencer”;
  • 32. SINGLE LOGICAL DATABASE CockroachDB: Architected For the Cloud A fundamentally better database for your developers and applications Scale even further across regions and even clouds, yet still deliver a single logical database It excels when deployed across multiple data centers. ...and even multi-cloud! USER: Ashley > INSERT (Kimball) INTO CUSTOMER; USER: Lindsay > SELECT * FROM ORDERS; USER: Peter > UPDATE (Kimball) FNAME=”Spencer”;
  • 33. SINGLE LOGICAL DATABASE CockroachDB: Architected For the Cloud A fundamentally better database for your developers and applications USER: Ashley > INSERT (Kimball) INTO CUSTOMER; USER: Lindsay > SELECT * FROM ORDERS; REGION 1 US-WEST REGION 1 US-WEST REGION 1 US-WEST USER: Peter > UPDATE (Kimball) FNAME=”Spencer”; CockroachDB is naturally resilient so you can survive the failure of a node or even an entire region without service disruption ● Always-on, always available w/ zero RPO/RTO ● Allows for no downtime rolling upgrades
  • 34. REGION 2 US-EAST REGION 3 EMEA REGION 1 US-WEST CockroachDB: Architected For the Cloud A fundamentally better database for your developers and applications USER: Random > INSERT (Kimball) INTO CUSTOMER; LOAD BALANCER Kimball Mattis Stewart LOAD BALANCER LOAD BALANCER Kimball Mattis Stewart Kimball Mattis Stewart Ask any node for data and it will find it in the cluster
  • 35. REGION 2 US-EAST REGION 3 EMEA REGION 1 US-WEST CockroachDB: Architected For the Cloud A fundamentally better database for your developers and applications USER: Random > INSERT (Kimball) INTO CUSTOMER; LOAD BALANCER Kimball Mattis Stewart USER: Kimball > SELECT (Kimball) FROM CUSTOMER; LOAD BALANCER LOAD BALANCER Ask any node for data and it will find it in the cluster Geo-locate data near user to reduce read/write latencies (or comply with regulations) Kimball Mattis Stewart Kimball Mattis Stewart