SlideShare uma empresa Scribd logo
1 de 19
Baixar para ler offline
F1 - The Fault-Tolerant
Distributed RDBMS
Supporting Google's Ad
Business
Jeff Shute, Mircea Oancea, Stephan Ellner,
Ben Handy, Eric Rollins, Bart Samwel,
Radek Vingralek, Chad Whipkey, Xin Chen,
Beat Jegerlehner, Kyle Littlefield, Phoenix Tong

SIGMOD
May 22, 2012
Today's Talk
F1 - A Hybrid Database combining the
● Scalability of Bigtable
● Usability and functionality of SQL databases

Key Ideas
● Scalability: Auto-sharded storage
● Availability & Consistency: Synchronous replication
● High commit latency: Can be hidden
   ○ Hierarchical schema
   ○ Protocol buffer column types
   ○ Efficient client code

Can you have a scalable database without going NoSQL? Yes.
The AdWords Ecosystem
One shared database backing Google's core AdWords business

               advertiser


SOAP API         web UI             reports

                                                   Java / "frontend"
 ad-hoc
SQL users                                          C++ / "backend"
                  DB
                                log aggregation

ad servers    ad approvals
                                 spam analysis

                ad logs
Our Legacy DB: Sharded MySQL
Sharding Strategy
● Sharded by customer
● Apps optimized using shard awareness

Limitations
 ● Availability
     ○ Master / slave replication -> downtime during failover
     ○ Schema changes -> downtime for table locking
 ● Scaling
     ○ Grow by adding shards
     ○ Rebalancing shards is extremely difficult and risky
     ○ Therefore, limit size and growth of data stored in database
 ● Functionality
     ○ Can't do cross-shard transactions or joins
Demanding Users
Critical applications driving Google's core ad business
● 24/7 availability, even with datacenter outages
● Consistency required
      ○ Can't afford to process inconsistent data
      ○ Eventual consistency too complex and painful
● Scale: 10s of TB, replicated to 1000s of machines

Shared schema
● Dozens of systems sharing one database
● Constantly evolving - multiple schema changes per week

SQL Query
● Query without code
Our Solution: F1
A new database,
● built from scratch,
● designed to operate at Google scale,
● without compromising on RDBMS features.

Co-developed with new lower-level storage system, Spanner
Underlying Storage - Spanner
Descendant of Bigtable, Successor to Megastore

Properties
● Globally distributed
● Synchronous cross-datacenter replication (with Paxos)
● Transparent sharding, data movement
● General transactions
    ○ Multiple reads followed by a single atomic write
    ○ Local or cross-machine (using 2PC)
● Snapshot reads
F1
Architecture                                           F1
                                                      client
● Sharded Spanner servers
     ○ data on GFS and in memory
● Stateless F1 server
● Pool of workers for query execution
                                                     F1 server

                                          F1 query
                                          workers
Features
● Relational schema                                  Spanner
    ○ Extensions for hierarchy and rich data types    server
    ○ Non-blocking schema changes
● Consistent indexes
● Parallel reads with SQL or Map-Reduce                GFS
How We Deploy
● Five replicas needed for high availability
● Why not three?
   ○ Assume one datacenter down
   ○ Then one more machine crash => partial outage

Geography
● Replicas spread across the country to survive regional disasters
   ○ Up to 100ms apart

Performance
● Very high commit latency - 50-100ms
● Reads take 5-10ms - much slower than MySQL
● High throughput
Hierarchical Schema
Explicit table hierarchies. Example:
 ● Customer (root table): PK (CustomerId)
 ● Campaign (child): PK (CustomerId, CampaignId)
 ● AdGroup (child): PK (CustomerId, CampaignId, AdGroupId)



              Rows and PKs              Storage Layout
                                        Customer   (1)
                1              2        Campaign   (1,3)
                                        AdGroup    (1,3,5)
                                        AdGroup    (1,3,6)
        1,3           1,4     2,5
                                        Campaign   (1,4)
                                        AdGroup    (1,4,7)
                                        Customer   (2)
1,3,5         1,3,6   1,4,7   2,5,8
                                        Campaign   (2,5)
                                        AdGroup    (2,5,8)
Clustered Storage
●   Child rows under one root row form a cluster
●   Cluster stored on one machine (unless huge)
●   Transactions within one cluster are most efficient
●   Very efficient joins inside clusters (can merge with no sorting)

              Rows and PKs                    Storage Layout
                                              Customer    (1)
                1              2              Campaign    (1,3)
                                              AdGroup     (1,3,5)
                                              AdGroup     (1,3,6)
        1,3           1,4     2,5
                                              Campaign    (1,4)
                                              AdGroup     (1,4,7)
                                              Customer    (2)
1,3,5         1,3,6   1,4,7   2,5,8
                                              Campaign    (2,5)
                                              AdGroup     (2,5,8)
Protocol Buffer Column Types
Protocol Buffers
● Structured data types with optional and repeated fields
● Open-sourced by Google, APIs in several languages

Column data types are mostly Protocol Buffers
● Treated as blobs by underlying storage
● SQL syntax extensions for reading nested fields
● Coarser schema with fewer tables - inlined objects instead

Why useful?
● Protocol Buffers pervasive at Google -> no impedance mismatch
● Simplified schema and code - apps use the same objects
   ○ Don't need foreign keys or joins if data is inlined
SQL Query
● Parallel query engine implemented from scratch
● Fully functional SQL, joins to external sources
● Language extensions for protocol buffers


SELECT CustomerId
FROM Customer c PROTO JOIN c.Whitelist.feature f
WHERE f.feature_id = 302
  AND f.status = 'STATUS_ENABLED'


Making queries fast
● Hide RPC latency
● Parallel and batch execution
● Hierarchical joins
Coping with High Latency
Preferred transaction structure
● One read phase: No serial reads
    ○ Read in batches
    ○ Read asynchronously in parallel
● Buffer writes in client, send as one RPC

Use coarse schema and hierarchy
● Fewer tables and columns
● Fewer joins

For bulk operations
● Use small transactions in parallel - high throughput

Avoid ORMs that add hidden costs
ORM Anti-Patterns
● Obscuring database operations from app developers
● Serial reads
   ○ for loops doing one query per iteration
● Implicit traversal
   ○ Adding unwanted joins and loading unnecessary data

These hurt performance in all databases.
They are disastrous on F1.
Our Client Library
● Very lightweight ORM - doesn't really have the "R"
   ○ Never uses Relational joins or traversal
● All objects are loaded explicitly
   ○ Hierarchical schema and protocol buffers make this easy
   ○ Don't join - just load child objects with a range read
● Ask explicitly for parallel and async reads
Results
Development
● Code is slightly more complex
    ○ But predictable performance, scales well by default
● Developers happy
    ○ Simpler schema
    ○ Rich data types -> lower impedance mismatch

User-Facing Latency
● Avg user action: ~200ms - on par with legacy system
● Flatter distribution of latencies
    ○ Mostly from better client code
    ○ Few user actions take much longer than average
    ○ Old system had severe latency tail of multi-second transactions
Current Challenges
● Parallel query execution
   ○ Failure recovery
   ○ Isolation
   ○ Skew and stragglers
   ○ Optimization

● Migrating applications, without downtime
  ○ Core systems already on F1, many more moving
  ○ Millions of LOC
Summary
We've moved a large and critical application suite from MySQL to F1.

This gave us
● Better scalability
● Better availability
● Equivalent consistency guarantees
● Equally powerful SQL query

And also similar application latency, using
● Coarser schema with rich column types
● Smarter client coding patterns

In short, we made our database scale, and didn't lose any key
database features along the way.

Mais conteúdo relacionado

Mais procurados

Learn More About Object Store | MuleSoft Mysore Meetup #9
Learn More About Object Store | MuleSoft Mysore Meetup #9Learn More About Object Store | MuleSoft Mysore Meetup #9
Learn More About Object Store | MuleSoft Mysore Meetup #9MysoreMuleSoftMeetup
 
Robinhood’s Kafkaproxy: Decoupling Kafka Consumer Logic from Application Busi...
Robinhood’s Kafkaproxy: Decoupling Kafka Consumer Logic from Application Busi...Robinhood’s Kafkaproxy: Decoupling Kafka Consumer Logic from Application Busi...
Robinhood’s Kafkaproxy: Decoupling Kafka Consumer Logic from Application Busi...HostedbyConfluent
 
Dual write strategies for microservices
Dual write strategies for microservicesDual write strategies for microservices
Dual write strategies for microservicesBilgin Ibryam
 
IBP - Inventory Optimization Slides.pdf
IBP - Inventory Optimization Slides.pdfIBP - Inventory Optimization Slides.pdf
IBP - Inventory Optimization Slides.pdfMamtaShekhawat7
 
Designing Salesforce Platform Events
Designing Salesforce Platform EventsDesigning Salesforce Platform Events
Designing Salesforce Platform EventsCodeScience
 
Microservice Architecture
Microservice ArchitectureMicroservice Architecture
Microservice ArchitectureNguyen Tung
 
Salesforce integration best practices columbus meetup
Salesforce integration best practices   columbus meetupSalesforce integration best practices   columbus meetup
Salesforce integration best practices columbus meetupMuleSoft Meetup
 
Batch Processing vs Stream Processing Difference
Batch Processing vs Stream Processing DifferenceBatch Processing vs Stream Processing Difference
Batch Processing vs Stream Processing Differencejeetendra mandal
 
PIM, PAM, PUM: Best Practices for Unix/Linux Privileged Identity & Access Man...
PIM, PAM, PUM: Best Practices for Unix/Linux Privileged Identity & Access Man...PIM, PAM, PUM: Best Practices for Unix/Linux Privileged Identity & Access Man...
PIM, PAM, PUM: Best Practices for Unix/Linux Privileged Identity & Access Man...Ryan Gallavin
 
A deep dive session on Tableau
A deep dive session on TableauA deep dive session on Tableau
A deep dive session on TableauVisual_BI
 
Kafka replication apachecon_2013
Kafka replication apachecon_2013Kafka replication apachecon_2013
Kafka replication apachecon_2013Jun Rao
 
Effective API Governance: Lessons Learnt
Effective API Governance: Lessons LearntEffective API Governance: Lessons Learnt
Effective API Governance: Lessons LearntPronovix
 
How we Webflow at Webflow - No Code Conf 2019 Demo Theater
How we Webflow at Webflow - No Code Conf 2019 Demo TheaterHow we Webflow at Webflow - No Code Conf 2019 Demo Theater
How we Webflow at Webflow - No Code Conf 2019 Demo TheaterWebflow
 
Three layer API Design Architecture
Three layer API Design ArchitectureThree layer API Design Architecture
Three layer API Design ArchitectureHarish Kumar
 
Analyzing Petabyte Scale Financial Data with Apache Pinot and Apache Kafka | ...
Analyzing Petabyte Scale Financial Data with Apache Pinot and Apache Kafka | ...Analyzing Petabyte Scale Financial Data with Apache Pinot and Apache Kafka | ...
Analyzing Petabyte Scale Financial Data with Apache Pinot and Apache Kafka | ...HostedbyConfluent
 

Mais procurados (20)

Learn More About Object Store | MuleSoft Mysore Meetup #9
Learn More About Object Store | MuleSoft Mysore Meetup #9Learn More About Object Store | MuleSoft Mysore Meetup #9
Learn More About Object Store | MuleSoft Mysore Meetup #9
 
Robinhood’s Kafkaproxy: Decoupling Kafka Consumer Logic from Application Busi...
Robinhood’s Kafkaproxy: Decoupling Kafka Consumer Logic from Application Busi...Robinhood’s Kafkaproxy: Decoupling Kafka Consumer Logic from Application Busi...
Robinhood’s Kafkaproxy: Decoupling Kafka Consumer Logic from Application Busi...
 
Dual write strategies for microservices
Dual write strategies for microservicesDual write strategies for microservices
Dual write strategies for microservices
 
IBP - Inventory Optimization Slides.pdf
IBP - Inventory Optimization Slides.pdfIBP - Inventory Optimization Slides.pdf
IBP - Inventory Optimization Slides.pdf
 
Designing Salesforce Platform Events
Designing Salesforce Platform EventsDesigning Salesforce Platform Events
Designing Salesforce Platform Events
 
Microservice Architecture
Microservice ArchitectureMicroservice Architecture
Microservice Architecture
 
Salesforce integration best practices columbus meetup
Salesforce integration best practices   columbus meetupSalesforce integration best practices   columbus meetup
Salesforce integration best practices columbus meetup
 
Batch Processing vs Stream Processing Difference
Batch Processing vs Stream Processing DifferenceBatch Processing vs Stream Processing Difference
Batch Processing vs Stream Processing Difference
 
Kafka presentation
Kafka presentationKafka presentation
Kafka presentation
 
SAP Basis Overview
SAP Basis OverviewSAP Basis Overview
SAP Basis Overview
 
PIM, PAM, PUM: Best Practices for Unix/Linux Privileged Identity & Access Man...
PIM, PAM, PUM: Best Practices for Unix/Linux Privileged Identity & Access Man...PIM, PAM, PUM: Best Practices for Unix/Linux Privileged Identity & Access Man...
PIM, PAM, PUM: Best Practices for Unix/Linux Privileged Identity & Access Man...
 
A deep dive session on Tableau
A deep dive session on TableauA deep dive session on Tableau
A deep dive session on Tableau
 
Kafka replication apachecon_2013
Kafka replication apachecon_2013Kafka replication apachecon_2013
Kafka replication apachecon_2013
 
Different SoftwareAG webMethods components
Different SoftwareAG webMethods componentsDifferent SoftwareAG webMethods components
Different SoftwareAG webMethods components
 
Servicenow connector
Servicenow connectorServicenow connector
Servicenow connector
 
Effective API Governance: Lessons Learnt
Effective API Governance: Lessons LearntEffective API Governance: Lessons Learnt
Effective API Governance: Lessons Learnt
 
How we Webflow at Webflow - No Code Conf 2019 Demo Theater
How we Webflow at Webflow - No Code Conf 2019 Demo TheaterHow we Webflow at Webflow - No Code Conf 2019 Demo Theater
How we Webflow at Webflow - No Code Conf 2019 Demo Theater
 
Three layer API Design Architecture
Three layer API Design ArchitectureThree layer API Design Architecture
Three layer API Design Architecture
 
Analyzing Petabyte Scale Financial Data with Apache Pinot and Apache Kafka | ...
Analyzing Petabyte Scale Financial Data with Apache Pinot and Apache Kafka | ...Analyzing Petabyte Scale Financial Data with Apache Pinot and Apache Kafka | ...
Analyzing Petabyte Scale Financial Data with Apache Pinot and Apache Kafka | ...
 
RabbitMQ & Kafka
RabbitMQ & KafkaRabbitMQ & Kafka
RabbitMQ & Kafka
 

Semelhante a Google F1

Scylla Summit 2022: Building Zeotap's Privacy Compliant Customer Data Platfor...
Scylla Summit 2022: Building Zeotap's Privacy Compliant Customer Data Platfor...Scylla Summit 2022: Building Zeotap's Privacy Compliant Customer Data Platfor...
Scylla Summit 2022: Building Zeotap's Privacy Compliant Customer Data Platfor...ScyllaDB
 
Evolution of DBA in the Cloud Era
 Evolution of DBA in the Cloud Era Evolution of DBA in the Cloud Era
Evolution of DBA in the Cloud EraMydbops
 
Data has a better idea the in-memory data grid
Data has a better idea   the in-memory data gridData has a better idea   the in-memory data grid
Data has a better idea the in-memory data gridBogdan Dina
 
Benchmarking Apache Druid
Benchmarking Apache Druid Benchmarking Apache Druid
Benchmarking Apache Druid Matt Sarrel
 
Benchmarking Apache Druid
Benchmarking Apache DruidBenchmarking Apache Druid
Benchmarking Apache DruidImply
 
REX Hadoop et R
REX Hadoop et RREX Hadoop et R
REX Hadoop et Rpkernevez
 
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
 
MongoDB World 2019: Packing Up Your Data and Moving to MongoDB Atlas
MongoDB World 2019: Packing Up Your Data and Moving to MongoDB AtlasMongoDB World 2019: Packing Up Your Data and Moving to MongoDB Atlas
MongoDB World 2019: Packing Up Your Data and Moving to MongoDB AtlasMongoDB
 
Lessons learned from designing QA automation event streaming platform(IoT big...
Lessons learned from designing QA automation event streaming platform(IoT big...Lessons learned from designing QA automation event streaming platform(IoT big...
Lessons learned from designing QA automation event streaming platform(IoT big...Omid Vahdaty
 
OSMC 2023 | What’s new with Grafana Labs’s Open Source Observability stack by...
OSMC 2023 | What’s new with Grafana Labs’s Open Source Observability stack by...OSMC 2023 | What’s new with Grafana Labs’s Open Source Observability stack by...
OSMC 2023 | What’s new with Grafana Labs’s Open Source Observability stack by...NETWAYS
 
Lessons learned from designing a QA Automation for analytics databases (big d...
Lessons learned from designing a QA Automation for analytics databases (big d...Lessons learned from designing a QA Automation for analytics databases (big d...
Lessons learned from designing a QA Automation for analytics databases (big d...Omid Vahdaty
 
Cpp In Soa
Cpp In SoaCpp In Soa
Cpp In SoaWSO2
 
Red hat Storage Day LA - Designing Ceph Clusters Using Intel-Based Hardware
Red hat Storage Day LA - Designing Ceph Clusters Using Intel-Based HardwareRed hat Storage Day LA - Designing Ceph Clusters Using Intel-Based Hardware
Red hat Storage Day LA - Designing Ceph Clusters Using Intel-Based HardwareRed_Hat_Storage
 
Olap scalability
Olap scalabilityOlap scalability
Olap scalabilitylucboudreau
 
Technical Webinar: Patterns for Integrating Your Salesforce App with Off-Plat...
Technical Webinar: Patterns for Integrating Your Salesforce App with Off-Plat...Technical Webinar: Patterns for Integrating Your Salesforce App with Off-Plat...
Technical Webinar: Patterns for Integrating Your Salesforce App with Off-Plat...CodeScience
 
Everything You Need to Know About Sharding
Everything You Need to Know About ShardingEverything You Need to Know About Sharding
Everything You Need to Know About ShardingMongoDB
 
MySQL Scalability and Reliability for Replicated Environment
MySQL Scalability and Reliability for Replicated EnvironmentMySQL Scalability and Reliability for Replicated Environment
MySQL Scalability and Reliability for Replicated EnvironmentJean-François Gagné
 
MySQL Scalability and Reliability for Replicated Environment
MySQL Scalability and Reliability for Replicated EnvironmentMySQL Scalability and Reliability for Replicated Environment
MySQL Scalability and Reliability for Replicated EnvironmentJean-François Gagné
 
MongoDB Sharding Webinar 2014
MongoDB Sharding Webinar 2014MongoDB Sharding Webinar 2014
MongoDB Sharding Webinar 2014Dylan Tong
 

Semelhante a Google F1 (20)

Scylla Summit 2022: Building Zeotap's Privacy Compliant Customer Data Platfor...
Scylla Summit 2022: Building Zeotap's Privacy Compliant Customer Data Platfor...Scylla Summit 2022: Building Zeotap's Privacy Compliant Customer Data Platfor...
Scylla Summit 2022: Building Zeotap's Privacy Compliant Customer Data Platfor...
 
Evolution of DBA in the Cloud Era
 Evolution of DBA in the Cloud Era Evolution of DBA in the Cloud Era
Evolution of DBA in the Cloud Era
 
Data has a better idea the in-memory data grid
Data has a better idea   the in-memory data gridData has a better idea   the in-memory data grid
Data has a better idea the in-memory data grid
 
Benchmarking Apache Druid
Benchmarking Apache Druid Benchmarking Apache Druid
Benchmarking Apache Druid
 
Benchmarking Apache Druid
Benchmarking Apache DruidBenchmarking Apache Druid
Benchmarking Apache Druid
 
REX Hadoop et R
REX Hadoop et RREX Hadoop et R
REX Hadoop et R
 
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 World 2019: Packing Up Your Data and Moving to MongoDB Atlas
MongoDB World 2019: Packing Up Your Data and Moving to MongoDB AtlasMongoDB World 2019: Packing Up Your Data and Moving to MongoDB Atlas
MongoDB World 2019: Packing Up Your Data and Moving to MongoDB Atlas
 
Lessons learned from designing QA automation event streaming platform(IoT big...
Lessons learned from designing QA automation event streaming platform(IoT big...Lessons learned from designing QA automation event streaming platform(IoT big...
Lessons learned from designing QA automation event streaming platform(IoT big...
 
OSMC 2023 | What’s new with Grafana Labs’s Open Source Observability stack by...
OSMC 2023 | What’s new with Grafana Labs’s Open Source Observability stack by...OSMC 2023 | What’s new with Grafana Labs’s Open Source Observability stack by...
OSMC 2023 | What’s new with Grafana Labs’s Open Source Observability stack by...
 
Lessons learned from designing a QA Automation for analytics databases (big d...
Lessons learned from designing a QA Automation for analytics databases (big d...Lessons learned from designing a QA Automation for analytics databases (big d...
Lessons learned from designing a QA Automation for analytics databases (big d...
 
Cpp In Soa
Cpp In SoaCpp In Soa
Cpp In Soa
 
Red hat Storage Day LA - Designing Ceph Clusters Using Intel-Based Hardware
Red hat Storage Day LA - Designing Ceph Clusters Using Intel-Based HardwareRed hat Storage Day LA - Designing Ceph Clusters Using Intel-Based Hardware
Red hat Storage Day LA - Designing Ceph Clusters Using Intel-Based Hardware
 
Olap scalability
Olap scalabilityOlap scalability
Olap scalability
 
Technical Webinar: Patterns for Integrating Your Salesforce App with Off-Plat...
Technical Webinar: Patterns for Integrating Your Salesforce App with Off-Plat...Technical Webinar: Patterns for Integrating Your Salesforce App with Off-Plat...
Technical Webinar: Patterns for Integrating Your Salesforce App with Off-Plat...
 
Everything You Need to Know About Sharding
Everything You Need to Know About ShardingEverything You Need to Know About Sharding
Everything You Need to Know About Sharding
 
MySQL Scalability and Reliability for Replicated Environment
MySQL Scalability and Reliability for Replicated EnvironmentMySQL Scalability and Reliability for Replicated Environment
MySQL Scalability and Reliability for Replicated Environment
 
MySQL Scalability and Reliability for Replicated Environment
MySQL Scalability and Reliability for Replicated EnvironmentMySQL Scalability and Reliability for Replicated Environment
MySQL Scalability and Reliability for Replicated Environment
 
Cloud arch patterns
Cloud arch patternsCloud arch patterns
Cloud arch patterns
 
MongoDB Sharding Webinar 2014
MongoDB Sharding Webinar 2014MongoDB Sharding Webinar 2014
MongoDB Sharding Webinar 2014
 

Mais de ikewu83

《云计算核心技术剖析》Mini书
《云计算核心技术剖析》Mini书《云计算核心技术剖析》Mini书
《云计算核心技术剖析》Mini书ikewu83
 
云计算与NoSQL
云计算与NoSQL云计算与NoSQL
云计算与NoSQLikewu83
 
Yun table 云时代的数据库
Yun table 云时代的数据库Yun table 云时代的数据库
Yun table 云时代的数据库ikewu83
 
Dean keynote-ladis2009
Dean keynote-ladis2009Dean keynote-ladis2009
Dean keynote-ladis2009ikewu83
 
云计算091124(李德毅院士)
云计算091124(李德毅院士)云计算091124(李德毅院士)
云计算091124(李德毅院士)ikewu83
 
04 陈良忠ibm cloud forum ibm experience 0611
04 陈良忠ibm cloud forum  ibm experience 061104 陈良忠ibm cloud forum  ibm experience 0611
04 陈良忠ibm cloud forum ibm experience 0611ikewu83
 
05 朱近之 ibm云计算解决方案概览 0611
05 朱近之 ibm云计算解决方案概览 061105 朱近之 ibm云计算解决方案概览 0611
05 朱近之 ibm云计算解决方案概览 0611ikewu83
 
03 李实恭-乘云之势以智致远 0611
03 李实恭-乘云之势以智致远 061103 李实恭-乘云之势以智致远 0611
03 李实恭-乘云之势以智致远 0611ikewu83
 
Cisco nexus 1000v
Cisco nexus 1000vCisco nexus 1000v
Cisco nexus 1000vikewu83
 
OVF 1.0 Whitepaper
OVF 1.0 WhitepaperOVF 1.0 Whitepaper
OVF 1.0 Whitepaperikewu83
 
De 03 Introduction To V Cloud Api V1
De 03 Introduction To V Cloud Api V1De 03 Introduction To V Cloud Api V1
De 03 Introduction To V Cloud Api V1ikewu83
 

Mais de ikewu83 (13)

《云计算核心技术剖析》Mini书
《云计算核心技术剖析》Mini书《云计算核心技术剖析》Mini书
《云计算核心技术剖析》Mini书
 
云计算与NoSQL
云计算与NoSQL云计算与NoSQL
云计算与NoSQL
 
Yun table 云时代的数据库
Yun table 云时代的数据库Yun table 云时代的数据库
Yun table 云时代的数据库
 
Pnp
PnpPnp
Pnp
 
Dean keynote-ladis2009
Dean keynote-ladis2009Dean keynote-ladis2009
Dean keynote-ladis2009
 
云计算091124(李德毅院士)
云计算091124(李德毅院士)云计算091124(李德毅院士)
云计算091124(李德毅院士)
 
04 陈良忠ibm cloud forum ibm experience 0611
04 陈良忠ibm cloud forum  ibm experience 061104 陈良忠ibm cloud forum  ibm experience 0611
04 陈良忠ibm cloud forum ibm experience 0611
 
05 朱近之 ibm云计算解决方案概览 0611
05 朱近之 ibm云计算解决方案概览 061105 朱近之 ibm云计算解决方案概览 0611
05 朱近之 ibm云计算解决方案概览 0611
 
03 李实恭-乘云之势以智致远 0611
03 李实恭-乘云之势以智致远 061103 李实恭-乘云之势以智致远 0611
03 李实恭-乘云之势以智致远 0611
 
Cisco nexus 1000v
Cisco nexus 1000vCisco nexus 1000v
Cisco nexus 1000v
 
OVF 1.0 Whitepaper
OVF 1.0 WhitepaperOVF 1.0 Whitepaper
OVF 1.0 Whitepaper
 
De 03 Introduction To V Cloud Api V1
De 03 Introduction To V Cloud Api V1De 03 Introduction To V Cloud Api V1
De 03 Introduction To V Cloud Api V1
 
OVF 1.1
OVF 1.1OVF 1.1
OVF 1.1
 

Último

CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 

Último (20)

CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 

Google F1

  • 1. F1 - The Fault-Tolerant Distributed RDBMS Supporting Google's Ad Business Jeff Shute, Mircea Oancea, Stephan Ellner, Ben Handy, Eric Rollins, Bart Samwel, Radek Vingralek, Chad Whipkey, Xin Chen, Beat Jegerlehner, Kyle Littlefield, Phoenix Tong SIGMOD May 22, 2012
  • 2. Today's Talk F1 - A Hybrid Database combining the ● Scalability of Bigtable ● Usability and functionality of SQL databases Key Ideas ● Scalability: Auto-sharded storage ● Availability & Consistency: Synchronous replication ● High commit latency: Can be hidden ○ Hierarchical schema ○ Protocol buffer column types ○ Efficient client code Can you have a scalable database without going NoSQL? Yes.
  • 3. The AdWords Ecosystem One shared database backing Google's core AdWords business advertiser SOAP API web UI reports Java / "frontend" ad-hoc SQL users C++ / "backend" DB log aggregation ad servers ad approvals spam analysis ad logs
  • 4. Our Legacy DB: Sharded MySQL Sharding Strategy ● Sharded by customer ● Apps optimized using shard awareness Limitations ● Availability ○ Master / slave replication -> downtime during failover ○ Schema changes -> downtime for table locking ● Scaling ○ Grow by adding shards ○ Rebalancing shards is extremely difficult and risky ○ Therefore, limit size and growth of data stored in database ● Functionality ○ Can't do cross-shard transactions or joins
  • 5. Demanding Users Critical applications driving Google's core ad business ● 24/7 availability, even with datacenter outages ● Consistency required ○ Can't afford to process inconsistent data ○ Eventual consistency too complex and painful ● Scale: 10s of TB, replicated to 1000s of machines Shared schema ● Dozens of systems sharing one database ● Constantly evolving - multiple schema changes per week SQL Query ● Query without code
  • 6. Our Solution: F1 A new database, ● built from scratch, ● designed to operate at Google scale, ● without compromising on RDBMS features. Co-developed with new lower-level storage system, Spanner
  • 7. Underlying Storage - Spanner Descendant of Bigtable, Successor to Megastore Properties ● Globally distributed ● Synchronous cross-datacenter replication (with Paxos) ● Transparent sharding, data movement ● General transactions ○ Multiple reads followed by a single atomic write ○ Local or cross-machine (using 2PC) ● Snapshot reads
  • 8. F1 Architecture F1 client ● Sharded Spanner servers ○ data on GFS and in memory ● Stateless F1 server ● Pool of workers for query execution F1 server F1 query workers Features ● Relational schema Spanner ○ Extensions for hierarchy and rich data types server ○ Non-blocking schema changes ● Consistent indexes ● Parallel reads with SQL or Map-Reduce GFS
  • 9. How We Deploy ● Five replicas needed for high availability ● Why not three? ○ Assume one datacenter down ○ Then one more machine crash => partial outage Geography ● Replicas spread across the country to survive regional disasters ○ Up to 100ms apart Performance ● Very high commit latency - 50-100ms ● Reads take 5-10ms - much slower than MySQL ● High throughput
  • 10. Hierarchical Schema Explicit table hierarchies. Example: ● Customer (root table): PK (CustomerId) ● Campaign (child): PK (CustomerId, CampaignId) ● AdGroup (child): PK (CustomerId, CampaignId, AdGroupId) Rows and PKs Storage Layout Customer (1) 1 2 Campaign (1,3) AdGroup (1,3,5) AdGroup (1,3,6) 1,3 1,4 2,5 Campaign (1,4) AdGroup (1,4,7) Customer (2) 1,3,5 1,3,6 1,4,7 2,5,8 Campaign (2,5) AdGroup (2,5,8)
  • 11. Clustered Storage ● Child rows under one root row form a cluster ● Cluster stored on one machine (unless huge) ● Transactions within one cluster are most efficient ● Very efficient joins inside clusters (can merge with no sorting) Rows and PKs Storage Layout Customer (1) 1 2 Campaign (1,3) AdGroup (1,3,5) AdGroup (1,3,6) 1,3 1,4 2,5 Campaign (1,4) AdGroup (1,4,7) Customer (2) 1,3,5 1,3,6 1,4,7 2,5,8 Campaign (2,5) AdGroup (2,5,8)
  • 12. Protocol Buffer Column Types Protocol Buffers ● Structured data types with optional and repeated fields ● Open-sourced by Google, APIs in several languages Column data types are mostly Protocol Buffers ● Treated as blobs by underlying storage ● SQL syntax extensions for reading nested fields ● Coarser schema with fewer tables - inlined objects instead Why useful? ● Protocol Buffers pervasive at Google -> no impedance mismatch ● Simplified schema and code - apps use the same objects ○ Don't need foreign keys or joins if data is inlined
  • 13. SQL Query ● Parallel query engine implemented from scratch ● Fully functional SQL, joins to external sources ● Language extensions for protocol buffers SELECT CustomerId FROM Customer c PROTO JOIN c.Whitelist.feature f WHERE f.feature_id = 302 AND f.status = 'STATUS_ENABLED' Making queries fast ● Hide RPC latency ● Parallel and batch execution ● Hierarchical joins
  • 14. Coping with High Latency Preferred transaction structure ● One read phase: No serial reads ○ Read in batches ○ Read asynchronously in parallel ● Buffer writes in client, send as one RPC Use coarse schema and hierarchy ● Fewer tables and columns ● Fewer joins For bulk operations ● Use small transactions in parallel - high throughput Avoid ORMs that add hidden costs
  • 15. ORM Anti-Patterns ● Obscuring database operations from app developers ● Serial reads ○ for loops doing one query per iteration ● Implicit traversal ○ Adding unwanted joins and loading unnecessary data These hurt performance in all databases. They are disastrous on F1.
  • 16. Our Client Library ● Very lightweight ORM - doesn't really have the "R" ○ Never uses Relational joins or traversal ● All objects are loaded explicitly ○ Hierarchical schema and protocol buffers make this easy ○ Don't join - just load child objects with a range read ● Ask explicitly for parallel and async reads
  • 17. Results Development ● Code is slightly more complex ○ But predictable performance, scales well by default ● Developers happy ○ Simpler schema ○ Rich data types -> lower impedance mismatch User-Facing Latency ● Avg user action: ~200ms - on par with legacy system ● Flatter distribution of latencies ○ Mostly from better client code ○ Few user actions take much longer than average ○ Old system had severe latency tail of multi-second transactions
  • 18. Current Challenges ● Parallel query execution ○ Failure recovery ○ Isolation ○ Skew and stragglers ○ Optimization ● Migrating applications, without downtime ○ Core systems already on F1, many more moving ○ Millions of LOC
  • 19. Summary We've moved a large and critical application suite from MySQL to F1. This gave us ● Better scalability ● Better availability ● Equivalent consistency guarantees ● Equally powerful SQL query And also similar application latency, using ● Coarser schema with rich column types ● Smarter client coding patterns In short, we made our database scale, and didn't lose any key database features along the way.