SlideShare une entreprise Scribd logo
1  sur  34
Télécharger pour lire hors ligne
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

Contenu connexe

Similaire à 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
 

Similaire à 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
 

Plus de 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
 

Plus de 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
 

Dernier

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
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
 
"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
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
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
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 

Dernier (20)

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
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
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
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
 
"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
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
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
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.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