SlideShare ist ein Scribd-Unternehmen logo
1 von 34
Downloaden Sie, um offline zu lesen
High Replication
                              Datastore
                                    Ikai Lan
                               plus.ikailan.com
                                NYC GTUG
                                 July 27, 2011




Wednesday, July 27, 2011
About the speaker

                    • Ikai Lan
                    • Developer Relations at Google based out
                           of San Francisco, CA
                    • Twitter: @ikai
                    • Google+: plus.ikailan.com

Wednesday, July 27, 2011
Agenda

                    • What is App Engine?
                    • What is High Replication datastore?
                    • Underneath the hood


Wednesday, July 27, 2011
What is App Engine?



Wednesday, July 27, 2011
Software

                             Platform


                           Infrastructure

                                            Source: Gartner AADI Summit Dec 2009


Wednesday, July 27, 2011
Software

                             Platform


                           Infrastructure

                                            Source: Gartner AADI Summit Dec 2009


Wednesday, July 27, 2011
Software

                             Platform


                           Infrastructure

                                            Source: Gartner AADI Summit Dec 2009


Wednesday, July 27, 2011
Software

                             Platform


                           Infrastructure

                                            Source: Gartner AADI Summit Dec 2009


Wednesday, July 27, 2011
SDK & “The Cloud”

                 Hardware

                 Networking

                 Operating system

                 Application runtime

                           Java, Python, Go

                 Static file serving


Wednesday, July 27, 2011
Scales dynamically



                                        App
                                       Server




Wednesday, July 27, 2011
Scales dynamically

                                            App
                                           Server



                                        App
                                       Server



                                            App
                                           Server




Wednesday, July 27, 2011
Customer: WebFilings




  Disruptive multi-tenant App Engine application adopted by
  Fortune 500 companies.


Wednesday, July 27, 2011
Customer: The Royal Wedding




  Peaked at 32,000 requests per second with no disruption!




Wednesday, July 27, 2011
>100K Developers

                               >200K Apps

                           >1.5B daily pageviews


Wednesday, July 27, 2011
App Engine
                   Datastore
           Schemaless, non-relational
           datastore built on top of
           Google’s Bigtable technology

           Enables rapid development
           and scalability




Wednesday, July 27, 2011
High Replication
                • strongly consistent
                • multi datacenter
                • High reliability
                • consistent
                       performance
                • no data loss
Wednesday, July 27, 2011
How do I use HR?

                    • Create a new application! Just remember
                           the rules
                    • Fetch by key and ancestor queries exhibit
                           strongly consistent behavior

                    • Queries without an ancestor exhibit
                           eventually consistent behavior



Wednesday, July 27, 2011
Strong vs. Eventual
                    • Strong consistency means immediately after
                           the datastore tells us the data has been
                           committed, a subsequent read will return
                           the data written
                    • Eventual consistency means that some time
                           after the datastore tells us data has been
                           committed, a read will return written data -
                           immediate read may or may not

Wednesday, July 27, 2011
This is strongly
                              consistent
                     DatastoreService datastore = DatastoreServiceFactory
                   	 	 .getDatastoreService();

                   	 Entity item = new Entity("Item");
                   	 item.setProperty("data", 123);

                   	 Key key = datastore.put(item);

                   	 // This exhibits strong consistency.
                   	 // It should return the item we just saved.
                   	 Entity result = datastore.get(key);




Wednesday, July 27, 2011
This is strongly
                                 consistent
                 // Save the entity root
            	    Entity root = new Entity("Root");
            	    Key rootKey = datastore.put(root);

            	     // Save the child
            	     Entity childItem = new Entity("Item", rootKey);
            	     childItem.setProperty("data", 123);
            	     datastore.put(childItem);

            	     Query strongConsistencyQuery = new Query("Item");
            	     strongConsistencyQuery.setAncestor(rootKey);
            	     strongConsistencyQuery.addFilter("data", FilterOperator.EQUAL, 123);

            	     FetchOptions opts = FetchOptions.Builder.withDefaults();

            	     // This query exhibits strong consistency.
            	     // It will return the item we just saved.
            	     List<Entity> results = datastore.prepare(strongConsistencyQuery)
            	     	 .asList(opts);



Wednesday, July 27, 2011
This is eventually
                              consistent
       	     Entity item = new Entity("Item");
       	     item.setProperty("data", 123);
       	     datastore.put(item);

       	     // Not an ancestor query
       	     Query eventuallyConsistentQuery = new Query("Item");
       	     eventuallyConsistentQuery.addFilter("data", FilterOperator.EQUAL, 123);

       	     FetchOptions opts = FetchOptions.Builder.withDefaults();

       	     // This query exhibits eventual consistency.
       	     // It will likely return an empty list.
       	     List<Entity> results = datastore.prepare(eventuallyConsistentQuery)
       	     	 .asList(opts);




Wednesday, July 27, 2011
Why?

                    • Reads are transactional
                    • On a read, we try to determine if we have
                           the latest version of some data
                    • If not, we catch up the data on the node to
                           the latest version



Wednesday, July 27, 2011
To understand this ...

                    • We need some understanding of Paxos ...
                    • ... which necessitates some understanding
                           of transactions
                    • ... which necessitates some understanding
                           of entity groups



Wednesday, July 27, 2011
Entity Groups
                           Entity
                                                         User
                           group root


                                                Blog            Blog


                                        Entry          Entry      Entry


                                 Comment
                                 Comment                               Comment



Wednesday, July 27, 2011
Entity groups
                 // Save the entity root
            	    Entity root = new Entity("Root");
            	    Key rootKey = datastore.put(root);

            	     // Save the child
            	     Entity childItem = new Entity("Item", rootKey);
            	     childItem.setProperty("data", 123);
            	     datastore.put(childItem);

            	     Query strongConsistencyQuery = new Query("Item");
            	     strongConsistencyQuery.setAncestor(rootKey);
            	     strongConsistencyQuery.addFilter("data", FilterOperator.EQUAL, 123);

            	     FetchOptions opts = FetchOptions.Builder.withDefaults();

            	     // This query exhibits strong consistency.
            	     // It will return the item we just saved.
            	     List<Entity> results = datastore.prepare(strongConsistencyQuery)
            	     	 .asList(opts);



Wednesday, July 27, 2011
Entity groups
                 // Save the entity root
            	    Entity root = new Entity("Root");
            	    Key rootKey = datastore.put(root);

            	     // Save the child
            	     Entity childItem = new Entity("Item", rootKey);
            	     childItem.setProperty("data", 123);
            	     datastore.put(childItem);

            	     Query strongConsistencyQuery = new Query("Item");
            	     strongConsistencyQuery.setAncestor(rootKey);
            	     strongConsistencyQuery.addFilter("data", FilterOperator.EQUAL, 123);

            	     FetchOptions opts = FetchOptions.Builder.withDefaults();

            	     // This query exhibits strong consistency.
            	     // It will return the item we just saved.
            	     List<Entity> results = datastore.prepare(strongConsistencyQuery)
            	     	 .asList(opts);



Wednesday, July 27, 2011
Optimistic locking
                            Client A reads                        Client B
                               data. It's                      reads data.
                                current                         It's current
                            version is 11                     version is 11




                              Modify data.                     Modify data.
                           Increment version                Increment version
                                 to 12          Datastore         to 12




                                                              Client B tries
                            Client ! tries to                 to save data.
                              save data.                        Success!
                               Datastore
                               version is
                            higher or equal
                                than my
                            version - FAIL



Wednesday, July 27, 2011
Transactional reads
                 // Save the entity root
            	    Entity root = new Entity("Root");
            	    Key rootKey = datastore.put(root);

            	     // Save the child
            	     Entity childItem = new Entity("Item", rootKey);
            	     childItem.setProperty("data", 123);
            	     datastore.put(childItem);

            	     Query strongConsistencyQuery = new Query("Item");
            	     strongConsistencyQuery.setAncestor(rootKey);
            	     strongConsistencyQuery.addFilter("data", FilterOperator.EQUAL, 123);

            	     FetchOptions opts = FetchOptions.Builder.withDefaults();

            	     // This query exhibits strong consistency.
            	     // It will return the item we just saved.
            	     List<Entity> results = datastore.prepare(strongConsistencyQuery)
            	     	 .asList(opts);



Wednesday, July 27, 2011
Transactional reads
                                                                                      Still being committed
                                                           Blog Entry
                                                           Version 11


                                                          Comment             Comment
                                                         Parent: Entry       Parent: Entry
                                                          Version 11          Version 12




                                                                                                   Client B
                  Client A reads
                                                           Datastore                           transactionally
                       data
                                                                                                 writing data



                                   Version 12 has not finished committing -
                                         Datastore returns version 11




Wednesday, July 27, 2011
Paxos simplified
                                       Give me the
                                       newest data        Node A                               Node B
                           Datastore
                            Client




                                                                   Is my data
                                                                   up to date?




                                                          Node C                               Node D




                                                     1. If the data is up to date, return it

                                                     2. if the data is NOT up to date, "catch up" the data
                                                     by applying the jobs in the journal and return the latest
                                                     data




Wednesday, July 27, 2011
More reading

                    • My example was grossly oversimplified
                    • More details can be found here:
                           http://www.cidrdb.org/cidr2011/Papers/
                           CIDR11_Paper32.pdf




Wednesday, July 27, 2011
Contradictory advice

                    • Entity groups must be as big as possible to
                           cover as much related data as you can
                    • Entity groups must be small enough such
                           that your write rate per entity group never
                           goes above one write/second




Wednesday, July 27, 2011
Summary

                    • Remember the rules of strong consistency
                           and eventual consistency
                    • Group your data into entity groups when
                           possible and use ancestor queries




Wednesday, July 27, 2011
Questions?


                    • Twitter: @ikai
                    • Google+: plus.ikailan.com


Wednesday, July 27, 2011

Weitere ähnliche Inhalte

Ähnlich wie 2011 july-gtug-high-replication-datastore

Infrastructure and Workflow for the Formal Evaluation of Semantic Search Tech...
Infrastructure and Workflow for the Formal Evaluation of Semantic Search Tech...Infrastructure and Workflow for the Formal Evaluation of Semantic Search Tech...
Infrastructure and Workflow for the Formal Evaluation of Semantic Search Tech...Stuart Wrigley
 
SplunkLive New York 2011: DealerTrack
SplunkLive New York 2011: DealerTrackSplunkLive New York 2011: DealerTrack
SplunkLive New York 2011: DealerTrackSplunk
 
Beyond Horizontal Scalability: Concurrency and Messaging Using Spring
Beyond Horizontal Scalability: Concurrency and Messaging Using SpringBeyond Horizontal Scalability: Concurrency and Messaging Using Spring
Beyond Horizontal Scalability: Concurrency and Messaging Using SpringBruce Snyder
 
2011 June - Singapore GTUG presentation. App Engine program update + intro to Go
2011 June - Singapore GTUG presentation. App Engine program update + intro to Go2011 June - Singapore GTUG presentation. App Engine program update + intro to Go
2011 June - Singapore GTUG presentation. App Engine program update + intro to Goikailan
 
Building an experimentation framework
Building an experimentation frameworkBuilding an experimentation framework
Building an experimentation frameworkzsqr
 
iPhone App from concept to product
iPhone App from concept to productiPhone App from concept to product
iPhone App from concept to productjoeysim
 
Selenium Page Objects101
Selenium Page Objects101Selenium Page Objects101
Selenium Page Objects101Adam Goucher
 
Time Series Data Storage in MongoDB
Time Series Data Storage in MongoDBTime Series Data Storage in MongoDB
Time Series Data Storage in MongoDBsky_jackson
 
JavaSE - The road forward
JavaSE - The road forwardJavaSE - The road forward
JavaSE - The road forwardeug3n_cojocaru
 
Strudel: Framework for Transaction Performance Analyses on SQL/NoSQL Systems
Strudel: Framework for Transaction Performance Analyses on SQL/NoSQL SystemsStrudel: Framework for Transaction Performance Analyses on SQL/NoSQL Systems
Strudel: Framework for Transaction Performance Analyses on SQL/NoSQL Systemstatemura
 
Mapping Java Objects with JPA
Mapping Java Objects with JPAMapping Java Objects with JPA
Mapping Java Objects with JPAAaron Schram
 
Governing services, data, rules, processes and more
Governing services, data, rules, processes and moreGoverning services, data, rules, processes and more
Governing services, data, rules, processes and moreRandall Hauch
 
Waters North American Trading Architecture Summit April 2011
Waters North American Trading Architecture Summit April 2011Waters North American Trading Architecture Summit April 2011
Waters North American Trading Architecture Summit April 2011Matt Davey
 
PushToTest TestMaker 6.5 Open Source Test Design Document
PushToTest TestMaker 6.5 Open Source Test Design DocumentPushToTest TestMaker 6.5 Open Source Test Design Document
PushToTest TestMaker 6.5 Open Source Test Design DocumentClever Moe
 
Open Source Test Workshop for CIOs, CTOs, Managers
Open Source Test Workshop for CIOs, CTOs, ManagersOpen Source Test Workshop for CIOs, CTOs, Managers
Open Source Test Workshop for CIOs, CTOs, ManagersClever Moe
 
Commercialization of OpenStack Object Storage
Commercialization of OpenStack Object StorageCommercialization of OpenStack Object Storage
Commercialization of OpenStack Object StorageJoe Arnold
 
Monitoring is easy, why are we so bad at it presentation
Monitoring is easy, why are we so bad at it  presentationMonitoring is easy, why are we so bad at it  presentation
Monitoring is easy, why are we so bad at it presentationTheo Schlossnagle
 
Building Scalable Web Apps
Building Scalable Web AppsBuilding Scalable Web Apps
Building Scalable Web Appszeeg
 

Ähnlich wie 2011 july-gtug-high-replication-datastore (20)

STI Summit 2011 - Linked services
STI Summit 2011 - Linked servicesSTI Summit 2011 - Linked services
STI Summit 2011 - Linked services
 
Infrastructure and Workflow for the Formal Evaluation of Semantic Search Tech...
Infrastructure and Workflow for the Formal Evaluation of Semantic Search Tech...Infrastructure and Workflow for the Formal Evaluation of Semantic Search Tech...
Infrastructure and Workflow for the Formal Evaluation of Semantic Search Tech...
 
SplunkLive New York 2011: DealerTrack
SplunkLive New York 2011: DealerTrackSplunkLive New York 2011: DealerTrack
SplunkLive New York 2011: DealerTrack
 
Beyond Horizontal Scalability: Concurrency and Messaging Using Spring
Beyond Horizontal Scalability: Concurrency and Messaging Using SpringBeyond Horizontal Scalability: Concurrency and Messaging Using Spring
Beyond Horizontal Scalability: Concurrency and Messaging Using Spring
 
2011 June - Singapore GTUG presentation. App Engine program update + intro to Go
2011 June - Singapore GTUG presentation. App Engine program update + intro to Go2011 June - Singapore GTUG presentation. App Engine program update + intro to Go
2011 June - Singapore GTUG presentation. App Engine program update + intro to Go
 
Building an experimentation framework
Building an experimentation frameworkBuilding an experimentation framework
Building an experimentation framework
 
iPhone App from concept to product
iPhone App from concept to productiPhone App from concept to product
iPhone App from concept to product
 
Anarchist guide to titanium ui
Anarchist guide to titanium uiAnarchist guide to titanium ui
Anarchist guide to titanium ui
 
Selenium Page Objects101
Selenium Page Objects101Selenium Page Objects101
Selenium Page Objects101
 
Time Series Data Storage in MongoDB
Time Series Data Storage in MongoDBTime Series Data Storage in MongoDB
Time Series Data Storage in MongoDB
 
JavaSE - The road forward
JavaSE - The road forwardJavaSE - The road forward
JavaSE - The road forward
 
Strudel: Framework for Transaction Performance Analyses on SQL/NoSQL Systems
Strudel: Framework for Transaction Performance Analyses on SQL/NoSQL SystemsStrudel: Framework for Transaction Performance Analyses on SQL/NoSQL Systems
Strudel: Framework for Transaction Performance Analyses on SQL/NoSQL Systems
 
Mapping Java Objects with JPA
Mapping Java Objects with JPAMapping Java Objects with JPA
Mapping Java Objects with JPA
 
Governing services, data, rules, processes and more
Governing services, data, rules, processes and moreGoverning services, data, rules, processes and more
Governing services, data, rules, processes and more
 
Waters North American Trading Architecture Summit April 2011
Waters North American Trading Architecture Summit April 2011Waters North American Trading Architecture Summit April 2011
Waters North American Trading Architecture Summit April 2011
 
PushToTest TestMaker 6.5 Open Source Test Design Document
PushToTest TestMaker 6.5 Open Source Test Design DocumentPushToTest TestMaker 6.5 Open Source Test Design Document
PushToTest TestMaker 6.5 Open Source Test Design Document
 
Open Source Test Workshop for CIOs, CTOs, Managers
Open Source Test Workshop for CIOs, CTOs, ManagersOpen Source Test Workshop for CIOs, CTOs, Managers
Open Source Test Workshop for CIOs, CTOs, Managers
 
Commercialization of OpenStack Object Storage
Commercialization of OpenStack Object StorageCommercialization of OpenStack Object Storage
Commercialization of OpenStack Object Storage
 
Monitoring is easy, why are we so bad at it presentation
Monitoring is easy, why are we so bad at it  presentationMonitoring is easy, why are we so bad at it  presentation
Monitoring is easy, why are we so bad at it presentation
 
Building Scalable Web Apps
Building Scalable Web AppsBuilding Scalable Web Apps
Building Scalable Web Apps
 

Mehr von ikailan

Your language doesn't scale
Your language doesn't scaleYour language doesn't scale
Your language doesn't scaleikailan
 
From 0-1 billion in 46 days
From 0-1 billion in 46 daysFrom 0-1 billion in 46 days
From 0-1 billion in 46 daysikailan
 
2011 august-gdd-mexico-city-rest-json-oauth
2011 august-gdd-mexico-city-rest-json-oauth2011 august-gdd-mexico-city-rest-json-oauth
2011 august-gdd-mexico-city-rest-json-oauthikailan
 
2011 aug-gdd-mexico-city-high-replication-datastore
2011 aug-gdd-mexico-city-high-replication-datastore2011 aug-gdd-mexico-city-high-replication-datastore
2011 aug-gdd-mexico-city-high-replication-datastoreikailan
 
2011 july-nyc-gtug-go
2011 july-nyc-gtug-go2011 july-nyc-gtug-go
2011 july-nyc-gtug-goikailan
 
2011 june-kuala-lumpur-gtug-hackathon
2011 june-kuala-lumpur-gtug-hackathon2011 june-kuala-lumpur-gtug-hackathon
2011 june-kuala-lumpur-gtug-hackathonikailan
 
Rapid web development using tornado web and mongodb
Rapid web development using tornado web and mongodbRapid web development using tornado web and mongodb
Rapid web development using tornado web and mongodbikailan
 
Introducing the App Engine datastore
Introducing the App Engine datastoreIntroducing the App Engine datastore
Introducing the App Engine datastoreikailan
 
What is App Engine? O
What is App Engine? OWhat is App Engine? O
What is App Engine? Oikailan
 
OSCON Google App Engine Codelab - July 2010
OSCON Google App Engine Codelab - July 2010OSCON Google App Engine Codelab - July 2010
OSCON Google App Engine Codelab - July 2010ikailan
 
Boot camp 2010_app_engine_101
Boot camp 2010_app_engine_101Boot camp 2010_app_engine_101
Boot camp 2010_app_engine_101ikailan
 
Building TweetEngine
Building TweetEngineBuilding TweetEngine
Building TweetEngineikailan
 

Mehr von ikailan (12)

Your language doesn't scale
Your language doesn't scaleYour language doesn't scale
Your language doesn't scale
 
From 0-1 billion in 46 days
From 0-1 billion in 46 daysFrom 0-1 billion in 46 days
From 0-1 billion in 46 days
 
2011 august-gdd-mexico-city-rest-json-oauth
2011 august-gdd-mexico-city-rest-json-oauth2011 august-gdd-mexico-city-rest-json-oauth
2011 august-gdd-mexico-city-rest-json-oauth
 
2011 aug-gdd-mexico-city-high-replication-datastore
2011 aug-gdd-mexico-city-high-replication-datastore2011 aug-gdd-mexico-city-high-replication-datastore
2011 aug-gdd-mexico-city-high-replication-datastore
 
2011 july-nyc-gtug-go
2011 july-nyc-gtug-go2011 july-nyc-gtug-go
2011 july-nyc-gtug-go
 
2011 june-kuala-lumpur-gtug-hackathon
2011 june-kuala-lumpur-gtug-hackathon2011 june-kuala-lumpur-gtug-hackathon
2011 june-kuala-lumpur-gtug-hackathon
 
Rapid web development using tornado web and mongodb
Rapid web development using tornado web and mongodbRapid web development using tornado web and mongodb
Rapid web development using tornado web and mongodb
 
Introducing the App Engine datastore
Introducing the App Engine datastoreIntroducing the App Engine datastore
Introducing the App Engine datastore
 
What is App Engine? O
What is App Engine? OWhat is App Engine? O
What is App Engine? O
 
OSCON Google App Engine Codelab - July 2010
OSCON Google App Engine Codelab - July 2010OSCON Google App Engine Codelab - July 2010
OSCON Google App Engine Codelab - July 2010
 
Boot camp 2010_app_engine_101
Boot camp 2010_app_engine_101Boot camp 2010_app_engine_101
Boot camp 2010_app_engine_101
 
Building TweetEngine
Building TweetEngineBuilding TweetEngine
Building TweetEngine
 

Kürzlich hochgeladen

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...apidays
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 

Kürzlich hochgeladen (20)

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 

2011 july-gtug-high-replication-datastore

  • 1. High Replication Datastore Ikai Lan plus.ikailan.com NYC GTUG July 27, 2011 Wednesday, July 27, 2011
  • 2. About the speaker • Ikai Lan • Developer Relations at Google based out of San Francisco, CA • Twitter: @ikai • Google+: plus.ikailan.com Wednesday, July 27, 2011
  • 3. Agenda • What is App Engine? • What is High Replication datastore? • Underneath the hood Wednesday, July 27, 2011
  • 4. What is App Engine? Wednesday, July 27, 2011
  • 5. Software Platform Infrastructure Source: Gartner AADI Summit Dec 2009 Wednesday, July 27, 2011
  • 6. Software Platform Infrastructure Source: Gartner AADI Summit Dec 2009 Wednesday, July 27, 2011
  • 7. Software Platform Infrastructure Source: Gartner AADI Summit Dec 2009 Wednesday, July 27, 2011
  • 8. Software Platform Infrastructure Source: Gartner AADI Summit Dec 2009 Wednesday, July 27, 2011
  • 9. SDK & “The Cloud” Hardware Networking Operating system Application runtime Java, Python, Go Static file serving Wednesday, July 27, 2011
  • 10. Scales dynamically App Server Wednesday, July 27, 2011
  • 11. Scales dynamically App Server App Server App Server Wednesday, July 27, 2011
  • 12. Customer: WebFilings Disruptive multi-tenant App Engine application adopted by Fortune 500 companies. Wednesday, July 27, 2011
  • 13. Customer: The Royal Wedding Peaked at 32,000 requests per second with no disruption! Wednesday, July 27, 2011
  • 14. >100K Developers >200K Apps >1.5B daily pageviews Wednesday, July 27, 2011
  • 15. App Engine Datastore Schemaless, non-relational datastore built on top of Google’s Bigtable technology Enables rapid development and scalability Wednesday, July 27, 2011
  • 16. High Replication • strongly consistent • multi datacenter • High reliability • consistent performance • no data loss Wednesday, July 27, 2011
  • 17. How do I use HR? • Create a new application! Just remember the rules • Fetch by key and ancestor queries exhibit strongly consistent behavior • Queries without an ancestor exhibit eventually consistent behavior Wednesday, July 27, 2011
  • 18. Strong vs. Eventual • Strong consistency means immediately after the datastore tells us the data has been committed, a subsequent read will return the data written • Eventual consistency means that some time after the datastore tells us data has been committed, a read will return written data - immediate read may or may not Wednesday, July 27, 2011
  • 19. This is strongly consistent DatastoreService datastore = DatastoreServiceFactory .getDatastoreService(); Entity item = new Entity("Item"); item.setProperty("data", 123); Key key = datastore.put(item); // This exhibits strong consistency. // It should return the item we just saved. Entity result = datastore.get(key); Wednesday, July 27, 2011
  • 20. This is strongly consistent // Save the entity root Entity root = new Entity("Root"); Key rootKey = datastore.put(root); // Save the child Entity childItem = new Entity("Item", rootKey); childItem.setProperty("data", 123); datastore.put(childItem); Query strongConsistencyQuery = new Query("Item"); strongConsistencyQuery.setAncestor(rootKey); strongConsistencyQuery.addFilter("data", FilterOperator.EQUAL, 123); FetchOptions opts = FetchOptions.Builder.withDefaults(); // This query exhibits strong consistency. // It will return the item we just saved. List<Entity> results = datastore.prepare(strongConsistencyQuery) .asList(opts); Wednesday, July 27, 2011
  • 21. This is eventually consistent Entity item = new Entity("Item"); item.setProperty("data", 123); datastore.put(item); // Not an ancestor query Query eventuallyConsistentQuery = new Query("Item"); eventuallyConsistentQuery.addFilter("data", FilterOperator.EQUAL, 123); FetchOptions opts = FetchOptions.Builder.withDefaults(); // This query exhibits eventual consistency. // It will likely return an empty list. List<Entity> results = datastore.prepare(eventuallyConsistentQuery) .asList(opts); Wednesday, July 27, 2011
  • 22. Why? • Reads are transactional • On a read, we try to determine if we have the latest version of some data • If not, we catch up the data on the node to the latest version Wednesday, July 27, 2011
  • 23. To understand this ... • We need some understanding of Paxos ... • ... which necessitates some understanding of transactions • ... which necessitates some understanding of entity groups Wednesday, July 27, 2011
  • 24. Entity Groups Entity User group root Blog Blog Entry Entry Entry Comment Comment Comment Wednesday, July 27, 2011
  • 25. Entity groups // Save the entity root Entity root = new Entity("Root"); Key rootKey = datastore.put(root); // Save the child Entity childItem = new Entity("Item", rootKey); childItem.setProperty("data", 123); datastore.put(childItem); Query strongConsistencyQuery = new Query("Item"); strongConsistencyQuery.setAncestor(rootKey); strongConsistencyQuery.addFilter("data", FilterOperator.EQUAL, 123); FetchOptions opts = FetchOptions.Builder.withDefaults(); // This query exhibits strong consistency. // It will return the item we just saved. List<Entity> results = datastore.prepare(strongConsistencyQuery) .asList(opts); Wednesday, July 27, 2011
  • 26. Entity groups // Save the entity root Entity root = new Entity("Root"); Key rootKey = datastore.put(root); // Save the child Entity childItem = new Entity("Item", rootKey); childItem.setProperty("data", 123); datastore.put(childItem); Query strongConsistencyQuery = new Query("Item"); strongConsistencyQuery.setAncestor(rootKey); strongConsistencyQuery.addFilter("data", FilterOperator.EQUAL, 123); FetchOptions opts = FetchOptions.Builder.withDefaults(); // This query exhibits strong consistency. // It will return the item we just saved. List<Entity> results = datastore.prepare(strongConsistencyQuery) .asList(opts); Wednesday, July 27, 2011
  • 27. Optimistic locking Client A reads Client B data. It's reads data. current It's current version is 11 version is 11 Modify data. Modify data. Increment version Increment version to 12 Datastore to 12 Client B tries Client ! tries to to save data. save data. Success! Datastore version is higher or equal than my version - FAIL Wednesday, July 27, 2011
  • 28. Transactional reads // Save the entity root Entity root = new Entity("Root"); Key rootKey = datastore.put(root); // Save the child Entity childItem = new Entity("Item", rootKey); childItem.setProperty("data", 123); datastore.put(childItem); Query strongConsistencyQuery = new Query("Item"); strongConsistencyQuery.setAncestor(rootKey); strongConsistencyQuery.addFilter("data", FilterOperator.EQUAL, 123); FetchOptions opts = FetchOptions.Builder.withDefaults(); // This query exhibits strong consistency. // It will return the item we just saved. List<Entity> results = datastore.prepare(strongConsistencyQuery) .asList(opts); Wednesday, July 27, 2011
  • 29. Transactional reads Still being committed Blog Entry Version 11 Comment Comment Parent: Entry Parent: Entry Version 11 Version 12 Client B Client A reads Datastore transactionally data writing data Version 12 has not finished committing - Datastore returns version 11 Wednesday, July 27, 2011
  • 30. Paxos simplified Give me the newest data Node A Node B Datastore Client Is my data up to date? Node C Node D 1. If the data is up to date, return it 2. if the data is NOT up to date, "catch up" the data by applying the jobs in the journal and return the latest data Wednesday, July 27, 2011
  • 31. More reading • My example was grossly oversimplified • More details can be found here: http://www.cidrdb.org/cidr2011/Papers/ CIDR11_Paper32.pdf Wednesday, July 27, 2011
  • 32. Contradictory advice • Entity groups must be as big as possible to cover as much related data as you can • Entity groups must be small enough such that your write rate per entity group never goes above one write/second Wednesday, July 27, 2011
  • 33. Summary • Remember the rules of strong consistency and eventual consistency • Group your data into entity groups when possible and use ancestor queries Wednesday, July 27, 2011
  • 34. Questions? • Twitter: @ikai • Google+: plus.ikailan.com Wednesday, July 27, 2011