SlideShare a Scribd company logo
1 of 33
SQL to NoSQL Lessons learnt migrating a large and highly-relational database into a "classic" NoSQL Enda Farrell @endafarrell
“It’s not you, it’s me …” This doesn’t apply to you … possibly … probably … 2
Here’s what’s coming What Why Complexity People Tools Data 3 Lessons
What is this service? Nokia’s “Ovi Places Registry” aims to be the largest validated point of interest repository in the world 4
What kind of data? Names  Categories  Tags Location information  longitude and latitude postal address Contact data 5
6
7
What about it is large and highly relational? 10s of millions points of interest Many many 100s of millions of contributing records MySQL DB is 600 GB on disk 32 tables, 202 columns 46 non-PRIMARY constraints 8
What usage patterns do you have? 9
“Classic” NoSQL? What did you use? It isn’t CouchDB but a variation of a Nokia internal one It’s a Key Value store holding JSON  Without the key you cannot access the value  It isn’t a “document store” as the store does nothing with the structure 10
Why did you port this to NoSQL? bigger and bigger Nokia maps – web and phone Yahoo! and soon Bing, => Facebook Postponed sharding by bigger HDD We learnt a lot over the last 3 years 11
Why did you port this to NoSQL? (continued) SQL databases can be rigid The world is a messy place “State field”? Integrating other organisations’ data 12
Complicated? The SQL and NoSQL databases will need to run in parallel for some time Ops &Disk space Truth or System of Record  Reconciliation  Syncronisation Querying 13
Complicated Ops & disk Releases, QA, staging and live deployments are more complex when there are two concurrent data storage systems What assumptions are other people making? 2 x HDD 14
Complicated truth When the two systems disagree, which one is “right”? 15
Complicated reconciliation How do you know that your two data stores disagree? Do you check each on on each read/write, or do you have some “batch” code to check equivalence? Top tip: build a batch reconciler to check keys and revision/etags you _do_ have etags don’t you?!  16
Complicated synchronisation	 Have you ever tried to keep two different calendars synchronised? Ever get two email clients telling you you have different numbers of unread mail for the same email account? 17
Complicated querying	 KV stores generally don’t do querying Some NoSQL stores allow some, but usually more restricted than SQL We used Solr for performance even though it isn’t as powerful as SQL The synchronisation complexity is here to stay for us  18
Complexity Complexity is often mistaken for “cleverness” 19
Lessons learnt: people Why.  It’s a question you will be asked and you will have to answer 20
Lesson learnt: people  The “DB~A” role is still needed Here the “~A” is more to do with data/information architecture than with administration  Top tip: design your JSON. Print it out. 21
Lesson learnt: people The effect on your team You may have a team of enterprise Java-types who are used to writing Eclipse-enabled code In our case we wanted to keep the flexibility that JSON gives us, but it meant we no longer had the same sort of model objects 22
Lessons learnt: tools Build “SQL to NoSQL” and “NoSQL to SQL” seeders You will need to seed your NoSQL from your SQL. You probably have existing DAOs which can form the basis – but this assumes your entities are essentially the same (top tip: keep them so!) 23
Lessons learnt: tools Build “SQL to NoSQL” and “NoSQL to SQL” seeders “NoSQL to SQL” was a seeder we learnt the hard way.  24
Lessons learnt: tools What’s your unit/integration test coverage? 5 releases post initial launch, is your test data still exercising all code paths? 25
Lesson learnt: tools You may find that not everything fits into a Key Value engine Even with a queryable index, some data sets really are relational ;-) The down-side is that you may therefore have to keep long term the SQL database 26
Lesson learnt: tools Visualise your system Monitoring: calls, load, response times Volumetrics: num docs, HDD, milestones Context: draw a systems context diagram (which reminds me …) 27
Lesson learnt: data Key generation – it’s not sequence numbers nor “auto-increments” anymore Many are UUIDs and they are long and ugly But “guess and check” is ugly too 	Consistent hash? 28
Lesson learnt: data Make the revision/etag of the JSON data visible in the JSON Not just in a header (assuming HTTP here) The data will be taken off-platform, if you want to change it you will need to know that the revision is (or is not) still the same 29
Lesson learnt: data Version of the JSON “schema” in the KV You have many docs You might have to “upgrade” the structure of the KV doc Keep the schema version in the JSON  30
Lesson learnt: data Many little not few big? Easier to replicate “Big” docs can be tough on networks Trade-off with more client calls (esp error handling) 31
Probably good ideas If you’re _thinking_ about doing this, do use one of the open source ones Get one that replicates easily Build POCs 32
Thank you!Other questions? @endafarrell http://endafarrell.net

More Related Content

What's hot

MongoDB Best Practices for Developers
MongoDB Best Practices for DevelopersMongoDB Best Practices for Developers
MongoDB Best Practices for DevelopersMoshe Kaplan
 
MongoDB for Coder Training (Coding Serbia 2013)
MongoDB for Coder Training (Coding Serbia 2013)MongoDB for Coder Training (Coding Serbia 2013)
MongoDB for Coder Training (Coding Serbia 2013)Uwe Printz
 
When to Use MongoDB...and When You Should Not...
When to Use MongoDB...and When You Should Not...When to Use MongoDB...and When You Should Not...
When to Use MongoDB...and When You Should Not...MongoDB
 
Hybrid MongoDB and RDBMS Applications
Hybrid MongoDB and RDBMS ApplicationsHybrid MongoDB and RDBMS Applications
Hybrid MongoDB and RDBMS ApplicationsSteven Francia
 
An Introduction To NoSQL & MongoDB
An Introduction To NoSQL & MongoDBAn Introduction To NoSQL & MongoDB
An Introduction To NoSQL & MongoDBLee Theobald
 
Advanced Schema Design Patterns
Advanced Schema Design PatternsAdvanced Schema Design Patterns
Advanced Schema Design PatternsMongoDB
 
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB
 
Azure CosmosDb - Where we are
Azure CosmosDb - Where we areAzure CosmosDb - Where we are
Azure CosmosDb - Where we areMarco Parenzan
 
Agility and Scalability with MongoDB
Agility and Scalability with MongoDBAgility and Scalability with MongoDB
Agility and Scalability with MongoDBMongoDB
 
Migrating to MongoDB: Best Practices
Migrating to MongoDB: Best PracticesMigrating to MongoDB: Best Practices
Migrating to MongoDB: Best PracticesMongoDB
 
Webinar: Schema Patterns and Your Storage Engine
Webinar: Schema Patterns and Your Storage EngineWebinar: Schema Patterns and Your Storage Engine
Webinar: Schema Patterns and Your Storage EngineMongoDB
 
MongoDB Pros and Cons
MongoDB Pros and ConsMongoDB Pros and Cons
MongoDB Pros and Consjohnrjenson
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBJustin Smestad
 
CBDW2014 - NoSQL Development With Couchbase and ColdFusion (CFML)
CBDW2014 - NoSQL Development With Couchbase and ColdFusion (CFML)CBDW2014 - NoSQL Development With Couchbase and ColdFusion (CFML)
CBDW2014 - NoSQL Development With Couchbase and ColdFusion (CFML)Ortus Solutions, Corp
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBMongoDB
 
MongoDB - An Agile NoSQL Database
MongoDB - An Agile NoSQL DatabaseMongoDB - An Agile NoSQL Database
MongoDB - An Agile NoSQL DatabaseGaurav Awasthi
 
MongoDB World 2019: Finding the Right MongoDB Atlas Cluster Size: Does This I...
MongoDB World 2019: Finding the Right MongoDB Atlas Cluster Size: Does This I...MongoDB World 2019: Finding the Right MongoDB Atlas Cluster Size: Does This I...
MongoDB World 2019: Finding the Right MongoDB Atlas Cluster Size: Does This I...MongoDB
 
Common MongoDB Use Cases
Common MongoDB Use CasesCommon MongoDB Use Cases
Common MongoDB Use CasesDATAVERSITY
 
Using NoSQL MongoDB with ColdFusion
Using NoSQL MongoDB with ColdFusionUsing NoSQL MongoDB with ColdFusion
Using NoSQL MongoDB with ColdFusionindiver
 

What's hot (20)

Mongo DB
Mongo DBMongo DB
Mongo DB
 
MongoDB Best Practices for Developers
MongoDB Best Practices for DevelopersMongoDB Best Practices for Developers
MongoDB Best Practices for Developers
 
MongoDB for Coder Training (Coding Serbia 2013)
MongoDB for Coder Training (Coding Serbia 2013)MongoDB for Coder Training (Coding Serbia 2013)
MongoDB for Coder Training (Coding Serbia 2013)
 
When to Use MongoDB...and When You Should Not...
When to Use MongoDB...and When You Should Not...When to Use MongoDB...and When You Should Not...
When to Use MongoDB...and When You Should Not...
 
Hybrid MongoDB and RDBMS Applications
Hybrid MongoDB and RDBMS ApplicationsHybrid MongoDB and RDBMS Applications
Hybrid MongoDB and RDBMS Applications
 
An Introduction To NoSQL & MongoDB
An Introduction To NoSQL & MongoDBAn Introduction To NoSQL & MongoDB
An Introduction To NoSQL & MongoDB
 
Advanced Schema Design Patterns
Advanced Schema Design PatternsAdvanced Schema Design Patterns
Advanced Schema Design Patterns
 
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
 
Azure CosmosDb - Where we are
Azure CosmosDb - Where we areAzure CosmosDb - Where we are
Azure CosmosDb - Where we are
 
Agility and Scalability with MongoDB
Agility and Scalability with MongoDBAgility and Scalability with MongoDB
Agility and Scalability with MongoDB
 
Migrating to MongoDB: Best Practices
Migrating to MongoDB: Best PracticesMigrating to MongoDB: Best Practices
Migrating to MongoDB: Best Practices
 
Webinar: Schema Patterns and Your Storage Engine
Webinar: Schema Patterns and Your Storage EngineWebinar: Schema Patterns and Your Storage Engine
Webinar: Schema Patterns and Your Storage Engine
 
MongoDB Pros and Cons
MongoDB Pros and ConsMongoDB Pros and Cons
MongoDB Pros and Cons
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
CBDW2014 - NoSQL Development With Couchbase and ColdFusion (CFML)
CBDW2014 - NoSQL Development With Couchbase and ColdFusion (CFML)CBDW2014 - NoSQL Development With Couchbase and ColdFusion (CFML)
CBDW2014 - NoSQL Development With Couchbase and ColdFusion (CFML)
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
MongoDB - An Agile NoSQL Database
MongoDB - An Agile NoSQL DatabaseMongoDB - An Agile NoSQL Database
MongoDB - An Agile NoSQL Database
 
MongoDB World 2019: Finding the Right MongoDB Atlas Cluster Size: Does This I...
MongoDB World 2019: Finding the Right MongoDB Atlas Cluster Size: Does This I...MongoDB World 2019: Finding the Right MongoDB Atlas Cluster Size: Does This I...
MongoDB World 2019: Finding the Right MongoDB Atlas Cluster Size: Does This I...
 
Common MongoDB Use Cases
Common MongoDB Use CasesCommon MongoDB Use Cases
Common MongoDB Use Cases
 
Using NoSQL MongoDB with ColdFusion
Using NoSQL MongoDB with ColdFusionUsing NoSQL MongoDB with ColdFusion
Using NoSQL MongoDB with ColdFusion
 

Similar to SQL to NoSQL Lessons Learnt Migrating Large Relational DB

Enterprise NoSQL: Silver Bullet or Poison Pill
Enterprise NoSQL: Silver Bullet or Poison PillEnterprise NoSQL: Silver Bullet or Poison Pill
Enterprise NoSQL: Silver Bullet or Poison PillBilly Newport
 
NoSQL databases - An introduction
NoSQL databases - An introductionNoSQL databases - An introduction
NoSQL databases - An introductionPooyan Mehrparvar
 
What Your Database Query is Really Doing
What Your Database Query is Really DoingWhat Your Database Query is Really Doing
What Your Database Query is Really DoingDave Stokes
 
To SQL or NoSQL, that is the question
To SQL or NoSQL, that is the questionTo SQL or NoSQL, that is the question
To SQL or NoSQL, that is the questionKrishnakumar S
 
Polyglot Database - Linuxcon North America 2016
Polyglot Database - Linuxcon North America 2016Polyglot Database - Linuxcon North America 2016
Polyglot Database - Linuxcon North America 2016Dave Stokes
 
Three Tools for "Human-in-the-loop" Data Science
Three Tools for "Human-in-the-loop" Data ScienceThree Tools for "Human-in-the-loop" Data Science
Three Tools for "Human-in-the-loop" Data ScienceAditya Parameswaran
 
Databases benoitg 2009-03-10
Databases benoitg 2009-03-10Databases benoitg 2009-03-10
Databases benoitg 2009-03-10benoitg
 
NoSQL for great good [hanoi.rb talk]
NoSQL for great good [hanoi.rb talk]NoSQL for great good [hanoi.rb talk]
NoSQL for great good [hanoi.rb talk]Huy Do
 
NoSQLDatabases
NoSQLDatabasesNoSQLDatabases
NoSQLDatabasesAdi Challa
 
Databases & Microsoft SQL Server
Databases & Microsoft SQL ServerDatabases & Microsoft SQL Server
Databases & Microsoft SQL ServerMahmoud Abdallah
 
SQL vs NoSQL deep dive
SQL vs NoSQL deep diveSQL vs NoSQL deep dive
SQL vs NoSQL deep diveAhmed Shaaban
 
Relational and non relational database 7
Relational and non relational database 7Relational and non relational database 7
Relational and non relational database 7abdulrahmanhelan
 
Why no sql ? Why Couchbase ?
Why no sql ? Why Couchbase ?Why no sql ? Why Couchbase ?
Why no sql ? Why Couchbase ?Ahmed Rashwan
 
Agile Data: Building Hadoop Analytics Applications
Agile Data: Building Hadoop Analytics ApplicationsAgile Data: Building Hadoop Analytics Applications
Agile Data: Building Hadoop Analytics ApplicationsDataWorks Summit
 
Not Your Father's Database by Databricks
Not Your Father's Database by DatabricksNot Your Father's Database by Databricks
Not Your Father's Database by DatabricksCaserta
 
Data massage: How databases have been scaled from one to one million nodes
Data massage: How databases have been scaled from one to one million nodesData massage: How databases have been scaled from one to one million nodes
Data massage: How databases have been scaled from one to one million nodesUlf Wendel
 

Similar to SQL to NoSQL Lessons Learnt Migrating Large Relational DB (20)

Enterprise NoSQL: Silver Bullet or Poison Pill
Enterprise NoSQL: Silver Bullet or Poison PillEnterprise NoSQL: Silver Bullet or Poison Pill
Enterprise NoSQL: Silver Bullet or Poison Pill
 
NoSQL databases - An introduction
NoSQL databases - An introductionNoSQL databases - An introduction
NoSQL databases - An introduction
 
No sql3 rmoug
No sql3 rmougNo sql3 rmoug
No sql3 rmoug
 
What Your Database Query is Really Doing
What Your Database Query is Really DoingWhat Your Database Query is Really Doing
What Your Database Query is Really Doing
 
To SQL or NoSQL, that is the question
To SQL or NoSQL, that is the questionTo SQL or NoSQL, that is the question
To SQL or NoSQL, that is the question
 
NOSQL
NOSQLNOSQL
NOSQL
 
Polyglot Database - Linuxcon North America 2016
Polyglot Database - Linuxcon North America 2016Polyglot Database - Linuxcon North America 2016
Polyglot Database - Linuxcon North America 2016
 
Three Tools for "Human-in-the-loop" Data Science
Three Tools for "Human-in-the-loop" Data ScienceThree Tools for "Human-in-the-loop" Data Science
Three Tools for "Human-in-the-loop" Data Science
 
Databases benoitg 2009-03-10
Databases benoitg 2009-03-10Databases benoitg 2009-03-10
Databases benoitg 2009-03-10
 
NoSQL for great good [hanoi.rb talk]
NoSQL for great good [hanoi.rb talk]NoSQL for great good [hanoi.rb talk]
NoSQL for great good [hanoi.rb talk]
 
NoSQLDatabases
NoSQLDatabasesNoSQLDatabases
NoSQLDatabases
 
Databases & Microsoft SQL Server
Databases & Microsoft SQL ServerDatabases & Microsoft SQL Server
Databases & Microsoft SQL Server
 
SQL vs NoSQL deep dive
SQL vs NoSQL deep diveSQL vs NoSQL deep dive
SQL vs NoSQL deep dive
 
Relational and non relational database 7
Relational and non relational database 7Relational and non relational database 7
Relational and non relational database 7
 
NoSQL databases
NoSQL databasesNoSQL databases
NoSQL databases
 
Why no sql ? Why Couchbase ?
Why no sql ? Why Couchbase ?Why no sql ? Why Couchbase ?
Why no sql ? Why Couchbase ?
 
Agile Data: Building Hadoop Analytics Applications
Agile Data: Building Hadoop Analytics ApplicationsAgile Data: Building Hadoop Analytics Applications
Agile Data: Building Hadoop Analytics Applications
 
Automating SolidWorks with Excel
Automating SolidWorks with ExcelAutomating SolidWorks with Excel
Automating SolidWorks with Excel
 
Not Your Father's Database by Databricks
Not Your Father's Database by DatabricksNot Your Father's Database by Databricks
Not Your Father's Database by Databricks
 
Data massage: How databases have been scaled from one to one million nodes
Data massage: How databases have been scaled from one to one million nodesData massage: How databases have been scaled from one to one million nodes
Data massage: How databases have been scaled from one to one million nodes
 

Recently uploaded

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
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
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
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
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 

Recently uploaded (20)

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
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
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
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
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 

SQL to NoSQL Lessons Learnt Migrating Large Relational DB

  • 1. SQL to NoSQL Lessons learnt migrating a large and highly-relational database into a "classic" NoSQL Enda Farrell @endafarrell
  • 2. “It’s not you, it’s me …” This doesn’t apply to you … possibly … probably … 2
  • 3. Here’s what’s coming What Why Complexity People Tools Data 3 Lessons
  • 4. What is this service? Nokia’s “Ovi Places Registry” aims to be the largest validated point of interest repository in the world 4
  • 5. What kind of data? Names Categories Tags Location information longitude and latitude postal address Contact data 5
  • 6. 6
  • 7. 7
  • 8. What about it is large and highly relational? 10s of millions points of interest Many many 100s of millions of contributing records MySQL DB is 600 GB on disk 32 tables, 202 columns 46 non-PRIMARY constraints 8
  • 9. What usage patterns do you have? 9
  • 10. “Classic” NoSQL? What did you use? It isn’t CouchDB but a variation of a Nokia internal one It’s a Key Value store holding JSON Without the key you cannot access the value It isn’t a “document store” as the store does nothing with the structure 10
  • 11. Why did you port this to NoSQL? bigger and bigger Nokia maps – web and phone Yahoo! and soon Bing, => Facebook Postponed sharding by bigger HDD We learnt a lot over the last 3 years 11
  • 12. Why did you port this to NoSQL? (continued) SQL databases can be rigid The world is a messy place “State field”? Integrating other organisations’ data 12
  • 13. Complicated? The SQL and NoSQL databases will need to run in parallel for some time Ops &Disk space Truth or System of Record Reconciliation Syncronisation Querying 13
  • 14. Complicated Ops & disk Releases, QA, staging and live deployments are more complex when there are two concurrent data storage systems What assumptions are other people making? 2 x HDD 14
  • 15. Complicated truth When the two systems disagree, which one is “right”? 15
  • 16. Complicated reconciliation How do you know that your two data stores disagree? Do you check each on on each read/write, or do you have some “batch” code to check equivalence? Top tip: build a batch reconciler to check keys and revision/etags you _do_ have etags don’t you?! 16
  • 17. Complicated synchronisation Have you ever tried to keep two different calendars synchronised? Ever get two email clients telling you you have different numbers of unread mail for the same email account? 17
  • 18. Complicated querying KV stores generally don’t do querying Some NoSQL stores allow some, but usually more restricted than SQL We used Solr for performance even though it isn’t as powerful as SQL The synchronisation complexity is here to stay for us 18
  • 19. Complexity Complexity is often mistaken for “cleverness” 19
  • 20. Lessons learnt: people Why. It’s a question you will be asked and you will have to answer 20
  • 21. Lesson learnt: people The “DB~A” role is still needed Here the “~A” is more to do with data/information architecture than with administration Top tip: design your JSON. Print it out. 21
  • 22. Lesson learnt: people The effect on your team You may have a team of enterprise Java-types who are used to writing Eclipse-enabled code In our case we wanted to keep the flexibility that JSON gives us, but it meant we no longer had the same sort of model objects 22
  • 23. Lessons learnt: tools Build “SQL to NoSQL” and “NoSQL to SQL” seeders You will need to seed your NoSQL from your SQL. You probably have existing DAOs which can form the basis – but this assumes your entities are essentially the same (top tip: keep them so!) 23
  • 24. Lessons learnt: tools Build “SQL to NoSQL” and “NoSQL to SQL” seeders “NoSQL to SQL” was a seeder we learnt the hard way. 24
  • 25. Lessons learnt: tools What’s your unit/integration test coverage? 5 releases post initial launch, is your test data still exercising all code paths? 25
  • 26. Lesson learnt: tools You may find that not everything fits into a Key Value engine Even with a queryable index, some data sets really are relational ;-) The down-side is that you may therefore have to keep long term the SQL database 26
  • 27. Lesson learnt: tools Visualise your system Monitoring: calls, load, response times Volumetrics: num docs, HDD, milestones Context: draw a systems context diagram (which reminds me …) 27
  • 28. Lesson learnt: data Key generation – it’s not sequence numbers nor “auto-increments” anymore Many are UUIDs and they are long and ugly But “guess and check” is ugly too Consistent hash? 28
  • 29. Lesson learnt: data Make the revision/etag of the JSON data visible in the JSON Not just in a header (assuming HTTP here) The data will be taken off-platform, if you want to change it you will need to know that the revision is (or is not) still the same 29
  • 30. Lesson learnt: data Version of the JSON “schema” in the KV You have many docs You might have to “upgrade” the structure of the KV doc Keep the schema version in the JSON 30
  • 31. Lesson learnt: data Many little not few big? Easier to replicate “Big” docs can be tough on networks Trade-off with more client calls (esp error handling) 31
  • 32. Probably good ideas If you’re _thinking_ about doing this, do use one of the open source ones Get one that replicates easily Build POCs 32
  • 33. Thank you!Other questions? @endafarrell http://endafarrell.net

Editor's Notes

  1. There may be large chunks of this talk that simply do not apply to your situation.If so, sorry. Perhaps you can identify situations that you will want to continue to avoid?I’ve tried to be “general” in that I hope it isn’t team/project/tool specific, but I’ve also tried to be at least a little specific in the lessons learntThe mail goal of this talk is to give you food for thought so that when you do this there will be a little less to be uncertain about or fewer “gotchas”I probably have not done a brilliant job of removing all of the “my situation” specifics, so if it’s confusing, please be kind ;-)
  2. There may be large chunks of this talk that simply do not apply to your situation.If so, sorry. Perhaps you can identify situations that you will want to continue to avoid?I probably have not done a brilliant job of removing all of the “my situation” specifics, so if it’s confusing, please be kind ;-)
  3. Nokia’s “Places Registry” aims to be the largest validated “point of interest” repository in the world.Question: hands up if you have you ever owned a Nokia phone?Question: who knows that you have free navigation on the Nokia devices?You know that navigation needs some sort of destination and that they are often interesting places (not just your friend’s address  )Hence Nokia built an ecosystem of applications/services to deal with this, and has bought some big names in the Geo/Mapping/SatNav world
  4. Names - one mandatory 'default' name and many optional alternative names in multiple languagesCategories - at least one predefined core categoryTags - free text keywordsLocation information – the longitude and latitude of the place on Earth as well as the postal addressContact data - information such as phone number, email address and website URL that may help matching and de-duplication
  5. The registry is from where all place information comes from for maps on the web and on Nokia devices – and soon on Windows Phone devices too.
  6. Very large? The financial industries will think not …Is it something that any of you will be dealing with? I think so …XX = I can’t say this number ;-o There’s a “Where 2.0” conference coming up soon and those folks have asked that I don’t steal their thunder!
  7. These are odd graphs. It’s an unusually quiet Monday morning, but clearly shows a background/underlying pattern.OPR is often a “write heavy” application. Read operations generally take place in constant time, the response times are generally consistent. Write times are pretty quick (200ms or so) for updates to existing POIs and much longer for registrations of new POIS (we check the existing places to see if we already know about that place – a process known as “matching”).The fact that we are (a) write heavy and (b) write costly was something that affected our decision to move to NoSQL.
  8. There are more complications here – I had to build another KV (which had the same API as the Nokia vShards) which could be replicated across multiple data centres (as I am in two and will soon be in three) and the Nokia vShards does not yet support multiple data centres.Apologies if you were hoping to see CouchDB-specific lessons
  9. Learnt about the business, the first version
  10. Moving to custom JPA-based DAOs helped enormously, but writing so many rows in many different tables (some of which were UNINDEXED to speed up insert performance) things were slow
  11. If everything “just works” this won’t be an issue, but, …When problems arise, as the ops team still see a regular SQL database and unless you have “real dev-ops” (another top tip) you’re app teams will have to check people’s assumptions
  12. In the first releases, when the NoSQL is a synchronised “slave” of the SQL the answer is clearIn later releases if you have a single “cutover” release the answer is clearIf the two co-exist side by side, you will want to have a predefined policy for handling thisbut how do you know that your two systems disagree?
  13. If you’re at this conference and you’re in the state of putting a new storage engine under an existing application you probably have more code than you want. Code to check two stores on each request is extraordinarily hard to write and have unit/integrations tests for
  14. It can be easy if you can have some sort of cross-system two phased commit
  15. What's wrong with what you have? It will take some time - during which things will get worseDo you have to maintain operational capability/up time/processing/new features/customers/clients etcetc while rebuilding? If so there may wellbe senior people in your organisation who do not understand the pros and cons of NoSQL and will be skeptical.
  16. It’s just as easy to make bad KV JSON design decisions as it is to make bad schema designs!The team argued over the JSON and we changed the structure a few times. This then meant re-writes of code that accessed things. For other reasons we did not use model objects – and these changes therefore took more and more time.
  17. We needed it as we had a wetware/pilot error when one DBA splatted our production database and also managed to corrupt the backup. Good work there. 1.2 million POIs were lost from the SQL database – but as they were in the NoSQL we were able eventually to repair.What are seeders?
  18. We needed it as we had a wetware/pilot error when one DBA splatted our production database and also managed to corrupt the backup. Good work there. 1.2 million POIs were lost from the SQL database – but as they were in the NoSQL we were able eventually to