SlideShare a Scribd company logo
1 of 44
A journey
through Cosmos
avinash.ramakanth@inmobi.com
Avinash.Ramakanth @inmobi.com
Overview
Problem ?
High-throughput User Store
Choice of technology
Cosmos DB
Design journey Optimization layer
DSP @ InMobi
Customer Data Platform
● Typical DSP loads: 250k - 1M req/sec
● Overall latencies: p99 < 50ms
● Data response latencies: p99 < 10ms
● Geo Replicated and Redundant
● Scalable
Problem ?
High-throughput User Store
Choice of technology
Cosmos DB
Design journey Optimization layer
On Prem Cloud Native
Theoretical caps on scale No such caps
Scalable in steps Granular scalability
Cost of maintenance and
upgrades
Amortized cost
(Man hours and infra)
In house skill set Customer Care
Custom buildable Not as much flexibility
Rationale
● Cloud native
○ To mitigate the limits of scaling business
● Inmobi - Microsoft Partnership
● Top contenders
○ Cosmos DB, Aerospike
Cosmos DB
● Cloud native alternative for
Cassandra/Aerospike/MongoDB
● Azure equivalent of AWS Dynamodb with a few extra
bells and whistles
● Document store supporting point lookups and queries
○ Fetch document given unique ID
○ SQL type queries spanning across documents
Problem ?
High-throughput User Store
Choice of technology
Cosmos DB
Design journey Optimization layer
How should we store data ?
Database -> Collection -> Documents
Cost units
Document Size
Data Splits
● Extending the observations on cost of read and write, data can be
split in unique ways to enable various use cases, based on access
patterns
● User timelines
○ Date boundaries
○ Container Splitting
● User profiles
○ Apps owned
● The InMobi team determines the primary and secondary key,
based on read-write pattern and distribution of records.
● Apart from the read-write pattern, we also consider
○ immutability of records,
○ record size,
○ item level TTL.
Data modelling
Data modelling
Useful models at InMobi:
● User level aggregates - for aggregate profiles
● Time based partitioning - for immutable timelines
● Enable top level keys in document which give flexibility for
design change
Did you say queries on a NoSql DB ?
Indexing + Querying
{
"locations": [
{ "country": "Germany", "city":
"Berlin" },
{ "country": "France", "city":
"Paris" }
],
"headquarters": { "country":
"Belgium", "employees": 250 },
"exports": [
{ "city": "Moscow" },
{ "city": "Athens" }
]
}
Indexing
How do we scale ?
Partitioning
RU = f(docSize, partitions)
● Read RUs are directly proportional to document size
Regardless of increase in partition count and collection size
● RUs consumed for getting non existing document is constant
Regardless of increase in partition count and collection size
● As the collection size grows, though query costs remain constant
The minimum provisioning keeps growing
Provisioning skew
Geo Replication
● Asymmetry in data access
● Outbound bandwidth costs are applicable
The numbers don’t add up !
Cost of Degradation
“HTTP Status Code 429: The user has sent too many requests in a given amount of time (rate limiting).”
Cost of Degradation
If provisioned for 100 read calls/sec (assume 100RU) and bombarded with say
1000 read calls/sec, we will encounter HTTP 429 error.
The behaviour observed would be <100 calls would succeed as the failed calls
would also consume resources.
Cost of degradation
● Recommendation: Honor backoff
● Corner case : In serving systems, such backoff cannot be honored, leaving
the only solution as scaling out systems.
Problem ?
High-throughput User Store
Choice of technology
Cosmos DB
Design journey Optimization layer
This is too costly. Help !
Autoscaling
Factors to consider when autoscaling
● Noise in traffic
● Skew in partitions
● Degradation costs
● Hourly billing
Autoscaler in action
Document compression
We need partial updates !
Multiversion Concurrency Control
Version 1.0 - Client C1 Version 2.0 -
Client C2
Multiversion Concurrency Control
Problem ?
High-throughput User Store
Choice of technology
Cosmos DB
Design journey Optimization layer
Summary
● On Prem vs Cloud Native
● Levers to optimize cost
and performance
○ Size of documents
○ Data models to enable
document splitting
○ Autoscaler
○ Data compression
Future looking
● Partial document updates
● AI to tune autoscaler, and
handle burst traffic
● Enable multi-region write
We would love to learn about your typical use
cases of Cosmos DB.
how do you approach costs in your system?
Collaborators:
avinash.ramakanth@inmobi.com
utkarsh.kumar@inmobi.com
jainesh.patel@inmobi.com

More Related Content

What's hot

Snowball 180625113523
Snowball 180625113523Snowball 180625113523
Snowball 180625113523Guna Shekar
 
In-Memory Computing: How, Why? and common Patterns
In-Memory Computing: How, Why? and common PatternsIn-Memory Computing: How, Why? and common Patterns
In-Memory Computing: How, Why? and common PatternsSrinath Perera
 
0812 2014 01_toronto-smac meetup_i_os_cloudant_worklight_part2
0812 2014 01_toronto-smac meetup_i_os_cloudant_worklight_part20812 2014 01_toronto-smac meetup_i_os_cloudant_worklight_part2
0812 2014 01_toronto-smac meetup_i_os_cloudant_worklight_part2Raul Chong
 
SOLR Power FTW: short version
SOLR Power FTW: short versionSOLR Power FTW: short version
SOLR Power FTW: short versionAlex Pinkin
 
Office 365 + Azure service bus
Office 365 + Azure service busOffice 365 + Azure service bus
Office 365 + Azure service busVitaly Zhukov
 
DAX: A Widely Distributed Multi-tenant Storage Service for DBMS Hosting
DAX: A Widely Distributed Multi-tenant Storage Service for DBMS HostingDAX: A Widely Distributed Multi-tenant Storage Service for DBMS Hosting
DAX: A Widely Distributed Multi-tenant Storage Service for DBMS HostingRui Liu
 
Dynamo db and Cross Region Migration
Dynamo db and Cross Region MigrationDynamo db and Cross Region Migration
Dynamo db and Cross Region MigrationAnamika Gupta
 
Nosql databases for the .net developer
Nosql databases for the .net developerNosql databases for the .net developer
Nosql databases for the .net developerJesus Rodriguez
 
Hypercubes In Hbase
Hypercubes In HbaseHypercubes In Hbase
Hypercubes In HbaseGeorge Ang
 
Building a Directed Graph with MongoDB
Building a Directed Graph with MongoDBBuilding a Directed Graph with MongoDB
Building a Directed Graph with MongoDBTony Tam
 
Update on Crimson - the Seastarized Ceph - Seastar Summit
Update on Crimson  - the Seastarized Ceph - Seastar SummitUpdate on Crimson  - the Seastarized Ceph - Seastar Summit
Update on Crimson - the Seastarized Ceph - Seastar SummitScyllaDB
 
Building Expedia’s Travel Graph using MongoDB
Building Expedia’s Travel Graph using MongoDBBuilding Expedia’s Travel Graph using MongoDB
Building Expedia’s Travel Graph using MongoDBMongoDB
 
Benchmarking your cloud performance with top 4 global public clouds
Benchmarking your cloud performance with top 4 global public cloudsBenchmarking your cloud performance with top 4 global public clouds
Benchmarking your cloud performance with top 4 global public cloudsdata://disrupted®
 
Alluxio Data Orchestration Platform for the Cloud
Alluxio Data Orchestration Platform for the CloudAlluxio Data Orchestration Platform for the Cloud
Alluxio Data Orchestration Platform for the CloudShubham Tagra
 
Amazon Web Services lection 4
Amazon Web Services lection 4  Amazon Web Services lection 4
Amazon Web Services lection 4 Binary Studio
 

What's hot (20)

Snowball 180625113523
Snowball 180625113523Snowball 180625113523
Snowball 180625113523
 
In-Memory Computing: How, Why? and common Patterns
In-Memory Computing: How, Why? and common PatternsIn-Memory Computing: How, Why? and common Patterns
In-Memory Computing: How, Why? and common Patterns
 
0812 2014 01_toronto-smac meetup_i_os_cloudant_worklight_part2
0812 2014 01_toronto-smac meetup_i_os_cloudant_worklight_part20812 2014 01_toronto-smac meetup_i_os_cloudant_worklight_part2
0812 2014 01_toronto-smac meetup_i_os_cloudant_worklight_part2
 
SOLR Power FTW: short version
SOLR Power FTW: short versionSOLR Power FTW: short version
SOLR Power FTW: short version
 
Office 365 + Azure service bus
Office 365 + Azure service busOffice 365 + Azure service bus
Office 365 + Azure service bus
 
DAX: A Widely Distributed Multi-tenant Storage Service for DBMS Hosting
DAX: A Widely Distributed Multi-tenant Storage Service for DBMS HostingDAX: A Widely Distributed Multi-tenant Storage Service for DBMS Hosting
DAX: A Widely Distributed Multi-tenant Storage Service for DBMS Hosting
 
Dynamo db and Cross Region Migration
Dynamo db and Cross Region MigrationDynamo db and Cross Region Migration
Dynamo db and Cross Region Migration
 
No(Geo)SQL
No(Geo)SQLNo(Geo)SQL
No(Geo)SQL
 
RubiX
RubiXRubiX
RubiX
 
Nosql databases for the .net developer
Nosql databases for the .net developerNosql databases for the .net developer
Nosql databases for the .net developer
 
Hypercubes In Hbase
Hypercubes In HbaseHypercubes In Hbase
Hypercubes In Hbase
 
Building a Directed Graph with MongoDB
Building a Directed Graph with MongoDBBuilding a Directed Graph with MongoDB
Building a Directed Graph with MongoDB
 
Update on Crimson - the Seastarized Ceph - Seastar Summit
Update on Crimson  - the Seastarized Ceph - Seastar SummitUpdate on Crimson  - the Seastarized Ceph - Seastar Summit
Update on Crimson - the Seastarized Ceph - Seastar Summit
 
Building Expedia’s Travel Graph using MongoDB
Building Expedia’s Travel Graph using MongoDBBuilding Expedia’s Travel Graph using MongoDB
Building Expedia’s Travel Graph using MongoDB
 
Benchmarking your cloud performance with top 4 global public clouds
Benchmarking your cloud performance with top 4 global public cloudsBenchmarking your cloud performance with top 4 global public clouds
Benchmarking your cloud performance with top 4 global public clouds
 
Alluxio Data Orchestration Platform for the Cloud
Alluxio Data Orchestration Platform for the CloudAlluxio Data Orchestration Platform for the Cloud
Alluxio Data Orchestration Platform for the Cloud
 
Introduce to spark
Introduce to sparkIntroduce to spark
Introduce to spark
 
Amazon Web Services lection 4
Amazon Web Services lection 4  Amazon Web Services lection 4
Amazon Web Services lection 4
 
Cimagraphi8
Cimagraphi8Cimagraphi8
Cimagraphi8
 
Apache Gobblin at MZ
Apache Gobblin at MZApache Gobblin at MZ
Apache Gobblin at MZ
 

Similar to A journey through cosmos - 5th el

MongoDB 4.0 새로운 기능 소개
MongoDB 4.0 새로운 기능 소개MongoDB 4.0 새로운 기능 소개
MongoDB 4.0 새로운 기능 소개Ha-Yang(White) Moon
 
Webinar: Dyn + DataStax - helping companies deliver exceptional end-user expe...
Webinar: Dyn + DataStax - helping companies deliver exceptional end-user expe...Webinar: Dyn + DataStax - helping companies deliver exceptional end-user expe...
Webinar: Dyn + DataStax - helping companies deliver exceptional end-user expe...DataStax
 
AquaQ Analytics Kx Event - Data Direct Networks Presentation
AquaQ Analytics Kx Event - Data Direct Networks PresentationAquaQ Analytics Kx Event - Data Direct Networks Presentation
AquaQ Analytics Kx Event - Data Direct Networks PresentationAquaQ Analytics
 
Azure DocumentDB Overview
Azure DocumentDB OverviewAzure DocumentDB Overview
Azure DocumentDB OverviewAndrew Liu
 
Taking High Performance Computing to the Cloud: Windows HPC and
Taking High Performance Computing to the Cloud: Windows HPC and Taking High Performance Computing to the Cloud: Windows HPC and
Taking High Performance Computing to the Cloud: Windows HPC and Saptak Sen
 
Ops Jumpstart: MongoDB Administration 101
Ops Jumpstart: MongoDB Administration 101Ops Jumpstart: MongoDB Administration 101
Ops Jumpstart: MongoDB Administration 101MongoDB
 
Introduction to Azure DocumentDB
Introduction to Azure DocumentDBIntroduction to Azure DocumentDB
Introduction to Azure DocumentDBDenny Lee
 
AWS re:Invent 2016| DAT318 | Migrating from RDBMS to NoSQL: How Sony Moved fr...
AWS re:Invent 2016| DAT318 | Migrating from RDBMS to NoSQL: How Sony Moved fr...AWS re:Invent 2016| DAT318 | Migrating from RDBMS to NoSQL: How Sony Moved fr...
AWS re:Invent 2016| DAT318 | Migrating from RDBMS to NoSQL: How Sony Moved fr...Amazon Web Services
 
Lessons from Building Large-Scale, Multi-Cloud, SaaS Software at Databricks
Lessons from Building Large-Scale, Multi-Cloud, SaaS Software at DatabricksLessons from Building Large-Scale, Multi-Cloud, SaaS Software at Databricks
Lessons from Building Large-Scale, Multi-Cloud, SaaS Software at DatabricksDatabricks
 
AMF304-Optimizing Design and Engineering Performance in the Cloud for Manufac...
AMF304-Optimizing Design and Engineering Performance in the Cloud for Manufac...AMF304-Optimizing Design and Engineering Performance in the Cloud for Manufac...
AMF304-Optimizing Design and Engineering Performance in the Cloud for Manufac...Amazon Web Services
 
Solving enterprise challenges through scale out storage &amp; big compute final
Solving enterprise challenges through scale out storage &amp; big compute finalSolving enterprise challenges through scale out storage &amp; big compute final
Solving enterprise challenges through scale out storage &amp; big compute finalAvere Systems
 
Amf304 optimizing-design-and-e-660cc73d-5c4c-4331-8f59-48cccdc1b7f4-135588426...
Amf304 optimizing-design-and-e-660cc73d-5c4c-4331-8f59-48cccdc1b7f4-135588426...Amf304 optimizing-design-and-e-660cc73d-5c4c-4331-8f59-48cccdc1b7f4-135588426...
Amf304 optimizing-design-and-e-660cc73d-5c4c-4331-8f59-48cccdc1b7f4-135588426...Ramprasad Nagaraja
 
MongoDB World 2018: Breaking the Mold - Redesigning Dell's E-Commerce Platform
MongoDB World 2018: Breaking the Mold - Redesigning Dell's E-Commerce PlatformMongoDB World 2018: Breaking the Mold - Redesigning Dell's E-Commerce Platform
MongoDB World 2018: Breaking the Mold - Redesigning Dell's E-Commerce PlatformMongoDB
 
Challenges of Implementing an Advanced SQL Engine on Hadoop
Challenges of Implementing an Advanced SQL Engine on HadoopChallenges of Implementing an Advanced SQL Engine on Hadoop
Challenges of Implementing an Advanced SQL Engine on HadoopDataWorks Summit
 
Big Data in 200 km/h | AWS Big Data Demystified #1.3
Big Data in 200 km/h | AWS Big Data Demystified #1.3  Big Data in 200 km/h | AWS Big Data Demystified #1.3
Big Data in 200 km/h | AWS Big Data Demystified #1.3 Omid Vahdaty
 
Challenges of Building a First Class SQL-on-Hadoop Engine
Challenges of Building a First Class SQL-on-Hadoop EngineChallenges of Building a First Class SQL-on-Hadoop Engine
Challenges of Building a First Class SQL-on-Hadoop EngineNicolas Morales
 
Design Like a Pro: How to Pick the Right System Architecture
Design Like a Pro: How to Pick the Right System ArchitectureDesign Like a Pro: How to Pick the Right System Architecture
Design Like a Pro: How to Pick the Right System ArchitectureInductive Automation
 
Public Cloud Workshop
Public Cloud WorkshopPublic Cloud Workshop
Public Cloud WorkshopAmer Ather
 

Similar to A journey through cosmos - 5th el (20)

MongoDB 4.0 새로운 기능 소개
MongoDB 4.0 새로운 기능 소개MongoDB 4.0 새로운 기능 소개
MongoDB 4.0 새로운 기능 소개
 
Webinar: Dyn + DataStax - helping companies deliver exceptional end-user expe...
Webinar: Dyn + DataStax - helping companies deliver exceptional end-user expe...Webinar: Dyn + DataStax - helping companies deliver exceptional end-user expe...
Webinar: Dyn + DataStax - helping companies deliver exceptional end-user expe...
 
MongoDB 3.4 webinar
MongoDB 3.4 webinarMongoDB 3.4 webinar
MongoDB 3.4 webinar
 
AquaQ Analytics Kx Event - Data Direct Networks Presentation
AquaQ Analytics Kx Event - Data Direct Networks PresentationAquaQ Analytics Kx Event - Data Direct Networks Presentation
AquaQ Analytics Kx Event - Data Direct Networks Presentation
 
Azure DocumentDB Overview
Azure DocumentDB OverviewAzure DocumentDB Overview
Azure DocumentDB Overview
 
Taking High Performance Computing to the Cloud: Windows HPC and
Taking High Performance Computing to the Cloud: Windows HPC and Taking High Performance Computing to the Cloud: Windows HPC and
Taking High Performance Computing to the Cloud: Windows HPC and
 
Ops Jumpstart: MongoDB Administration 101
Ops Jumpstart: MongoDB Administration 101Ops Jumpstart: MongoDB Administration 101
Ops Jumpstart: MongoDB Administration 101
 
Gcp dataflow
Gcp dataflowGcp dataflow
Gcp dataflow
 
Introduction to Azure DocumentDB
Introduction to Azure DocumentDBIntroduction to Azure DocumentDB
Introduction to Azure DocumentDB
 
AWS re:Invent 2016| DAT318 | Migrating from RDBMS to NoSQL: How Sony Moved fr...
AWS re:Invent 2016| DAT318 | Migrating from RDBMS to NoSQL: How Sony Moved fr...AWS re:Invent 2016| DAT318 | Migrating from RDBMS to NoSQL: How Sony Moved fr...
AWS re:Invent 2016| DAT318 | Migrating from RDBMS to NoSQL: How Sony Moved fr...
 
Lessons from Building Large-Scale, Multi-Cloud, SaaS Software at Databricks
Lessons from Building Large-Scale, Multi-Cloud, SaaS Software at DatabricksLessons from Building Large-Scale, Multi-Cloud, SaaS Software at Databricks
Lessons from Building Large-Scale, Multi-Cloud, SaaS Software at Databricks
 
AMF304-Optimizing Design and Engineering Performance in the Cloud for Manufac...
AMF304-Optimizing Design and Engineering Performance in the Cloud for Manufac...AMF304-Optimizing Design and Engineering Performance in the Cloud for Manufac...
AMF304-Optimizing Design and Engineering Performance in the Cloud for Manufac...
 
Solving enterprise challenges through scale out storage &amp; big compute final
Solving enterprise challenges through scale out storage &amp; big compute finalSolving enterprise challenges through scale out storage &amp; big compute final
Solving enterprise challenges through scale out storage &amp; big compute final
 
Amf304 optimizing-design-and-e-660cc73d-5c4c-4331-8f59-48cccdc1b7f4-135588426...
Amf304 optimizing-design-and-e-660cc73d-5c4c-4331-8f59-48cccdc1b7f4-135588426...Amf304 optimizing-design-and-e-660cc73d-5c4c-4331-8f59-48cccdc1b7f4-135588426...
Amf304 optimizing-design-and-e-660cc73d-5c4c-4331-8f59-48cccdc1b7f4-135588426...
 
MongoDB World 2018: Breaking the Mold - Redesigning Dell's E-Commerce Platform
MongoDB World 2018: Breaking the Mold - Redesigning Dell's E-Commerce PlatformMongoDB World 2018: Breaking the Mold - Redesigning Dell's E-Commerce Platform
MongoDB World 2018: Breaking the Mold - Redesigning Dell's E-Commerce Platform
 
Challenges of Implementing an Advanced SQL Engine on Hadoop
Challenges of Implementing an Advanced SQL Engine on HadoopChallenges of Implementing an Advanced SQL Engine on Hadoop
Challenges of Implementing an Advanced SQL Engine on Hadoop
 
Big Data in 200 km/h | AWS Big Data Demystified #1.3
Big Data in 200 km/h | AWS Big Data Demystified #1.3  Big Data in 200 km/h | AWS Big Data Demystified #1.3
Big Data in 200 km/h | AWS Big Data Demystified #1.3
 
Challenges of Building a First Class SQL-on-Hadoop Engine
Challenges of Building a First Class SQL-on-Hadoop EngineChallenges of Building a First Class SQL-on-Hadoop Engine
Challenges of Building a First Class SQL-on-Hadoop Engine
 
Design Like a Pro: How to Pick the Right System Architecture
Design Like a Pro: How to Pick the Right System ArchitectureDesign Like a Pro: How to Pick the Right System Architecture
Design Like a Pro: How to Pick the Right System Architecture
 
Public Cloud Workshop
Public Cloud WorkshopPublic Cloud Workshop
Public Cloud Workshop
 

Recently uploaded

Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 

Recently uploaded (20)

Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 

A journey through cosmos - 5th el

Editor's Notes

  1. The major business for InMobi is mobile advertising. Which is to show the right advertisement to the right users at the right opportunity.
  2. The flow of information is from right to left and flow of money is from left to right Publishers are apps which a user is engaging with SSP aggregates all ad requests from various apps Exchanges aggregate requests from various SSPs DSP listens to multiple Exchanges and using intelligence powered by its DMP, responds with the best possible ad for that user at that point in time The overall latency of this system is typically within 50ms Consequently the latency with DMP < 10ms
  3. The rate of ad requests received directly impacts the money spent and varies hugely, based on time of day, day of the week and various other seasonal and geographical factors e.g. Cricket World Cup causes increase in content consumption by users. The number of ads served drives the revenue generated and is dependent on the advertising funds available and not on the number of requests received. InMobi operates at a global scale and so it needs to serve ads across various geographies while adhering to latency requirements. A huge global presence implies that the traffic patterns vary widely across geographies e.g. The US and India have huge differences in terms of peak traffic times, seasonal behaviours like Diwali or Christmas, types of apps used etc. An ad request from a user can land on one of many InMobi’s geo redundant serving systems. We need the user’s information to be consistently available across all serving regions, to serve ads uniformly. Global consistency also enables us to support easy fallbacks, load balancing and account for the fact that users travel. This could be achieved using either a master-master or master-slave setup, either ways, globally consistent view of a user’s information is critical.
  4. Upgrades - Security, performance, features etc. Common scenario where someone sets up a system and is no longer working on it 6 months down the line, when it breaks and adds to the pain of maintanence
  5. Why Cosmos DB ? The story behing this choice Redis, Cassandra vs Aerospike - Aerospike. Reliability, scalability etc. Inhouse expertise with Aerospike. Cosmos vs Dynamo - Due to partnership makes more financial sense to chose Cosmos DB.
  6. Note this is not an exhaustive list of capabilities of Cosmos DB, but the major use cases for our needs.
  7. The first question we ask ourselves is where and how is the data stored
  8. This follows with a logical next step of what is the cost of this system and how is it measured ? Introduce Request Units: It is a uber number denoting the CPU/Memory/IO utilization on Cosmos DB. Measured per read/write/query etc.
  9. Now that we know about documents and RU, how do they relate ?? Did you observe the drastic changes in RU utilization at 16, 32, 64kB?
  10. 32KB document split into 16KB documents - If every write on big document translates to 2 small write, total cost would not change. 24KB document split into 16KB + 8KB document - If every write on big document translates to 2 writes on smaller documents, the total cost after split would be higher, since the cost of 24KB write = cost of 16KB write. If each write on a big document translates to only one write on a smaller document, then splitting a 32KB document would mean your write cost would halve straight away. Whereas for a 24KB document the cost benefit would not be as significant even when doing a single write on one of the smaller documents. In contrast, a case where we see significant benefit is when working with large documents. Reading multiple split documents is cheaper than reading one big document under certain conditions - if a 40KB document is split into 4x10KB documents, all with the same partition key, total read and write RU falls significantly in the latter case.
  11. So the main takeaway is keep document sizes small, This may result in bigger collections, which can be split into smaller collections
  12. Indexing is required to enable _ttl and queries. With full indexing enabled, it will be possible to run spark jobs using Cosmos DB as the backend DB
  13. Indexing increases write costs, while the read costs remain stable. Avoid indexing indiscriminately, unless a cost-benefit analysis is done on the use of running queries on Cosmos DB. Alternatives include running batch jobs on dumps of the data.
  14. Understanding costs is nice, but how does my system scale ? What are the building blocks ? Horizontal scalability is achieved using partitioning and replication
  15. Given what we know about documents, cost and scaling factors, how do these interplay ??
  16. The expected behaviour might be that in a second first 100 read calls would succeed and remaining 900 calls would fail. This would be the case if those 900 failure calls were not consuming any resources. But in the case of “Too many requests” (HTTP error code 429) these failed read calls also consume some amount of constant resources, which eats into your 100 success calls. Thus the behaviour is not 100 calls success and 900 calls failure, the behaviour is all 1000 calls consume resources, and few of those will succeed and rest fail, implying a successful response for less than 100 calls.
  17. Image for skewed degradation
  18. Cosmos DB supports scaling of RUs provisioned through API and also via the portal. Automating this scaling is a critical feature, to optimize the cost utilization. Depending on the variation in the usage pattern of Cosmos DB RUs, the auto scaling feature can make or break the whole system being built. At InMobi, the traffic observed across days is dependent on various factors as explored earlier, and if we provision our systems to the maximum required, Cosmos DB costing would become unreasonably large to build a sustainable business model.
  19. A decrease in RU consumption on throttling - RU consumption decreases due to honouring backoff retry logic, but we have to increase the RU at this point of time. Handling hot partitions on throttling - Contrary to the previous point, there can be some hot-partitions getting throttled which might push the auto-scaler to increase RU more than whatever is needed. Interestingly, even though the overall provisioning is sufficient enough, we will see few 429s in the system. This might seem similar to situation #2 at first glance. Simply increasing the RUs for such a scenario will massively overprovision the system, bloating up the cost significantly. Before increasing RUs, the algorithm needs to be cognizant of request skewness. Cost model of Cosmos for RU consumption: As mentioned earlier, RUs are charged at hourly quota for the maximum RU allocated for the running hour. Do we really need to decrease the RUs if we are paying for the maximum allocated RUs during an hourly interval?
  20. When building a user profile, disparate information is ingested from various sources. Summarization of this information is stored in Cosmos DB Information coming from various sources will not have the same schema User profiles also evolve with time. Modification of the records concurrently is prone to data loss due to race condition.
  21. We perform partial serialization and deserialization at client-end to handle corner cases. Records are serialized in Cosmos as json objects. During deserialization, the respective schema of event is fetched from a schema registry. The registry helps in book-keeping the schema-mapping (Avro schemas in our use case) for every user feature, and the respective record fragments (fragment of record with the User Feature we want to update) are deserialized. Any operations applicable over the fragment are performed before serializing again to JSON and dumping to Cosmos DB.