Getting the Most from DocumentDB
An Introduction to Azure DocumentDB
It's been common, if inconsistently applied, knowledge for many years that relational databases are a less-than-ideal fit for some types of software problems. Indeed, entire categories of software development tooling, such as object-relational mappers (ORMs), exists to bridge the gap between highly normalized relational data and in-memory, object-oriented representations. In practice, ORMs can create as much complexity as they alleviate, so developers began looking at the relational database itself as ripe for potential disruption.
Thus came the rise of NoSQL and databases that eschew the traditional rows/columns/tables/foreign keys metaphor for other choices like JSON document stores, graph databases that represent data and relationships as nodes with connecting edges, key/value stores that act as a glorified hashtable, and others. The wide range of options meant you could choose the right tool for your particular needs, instead of trying to squeeze a relational database square peg into your application's round hole. Solutions like MongoDB, Cassandra, Redis, and Neo4j rose to prominence and became de facto industry standards for developers interested in leveraging the power and flexibility NoSQL.
While NoSQL was a boon to software developer productivity, the initial product offerings did little to alleviate the administrative burden of managing your database. Server provisioning, backups, data security at-rest and in-transit... all these challenges (and many more) remained as developers adopted NoSQL in greater numbers. Fortunately for them and all of us, the rise of the cloud and managed database service offerings like Azure DocumentDB brought us the best of both worlds: fast, flexible, infinitely-scalable NoSQL with most of the administrative headaches assumed by a dedicated team of experts from Microsoft. You focus on your data and your application, and rely on a 99.99% SLA for the rest!
In this "Introduction to Azure DocumentDB" course, you’ll learn how to use Azure DocumentDB (DocDB) in your applications. You'll create DocDB accounts, databases, and collections. You'll perform ad-hoc and application-based queries, and see how features like stored procedures and MongoDB protocol support can help you. You'll also learn about ideal DocDB use cases and the pricing model. By the end of this course, you’ll have a solid foundation to continue exploring NoSQL and DocumentDB.
An Introduction to Azure DocumentDB: What You'll Learn
|Lecture||What you'll learn|
|Intro||What to expect from this course|
|DocumentDB Overview||A high-level overview of the DocumentDB feature set|
|Overview of Managing DocumentDB||A discussion of DocumentDB features for managing resources, data, scalability, configuration, and so on|
|Creating an Account||Creating a top-level DocDB account in the Azure portal|
|Creating a Collection||Creating and configuring a DocDB collection in the Azure portal|
|Importing Data||Discussion and demonstration of moving data into a DocDB collection|
|Overview of Developing with DocumentDB||A discussion of DocumentDB features from a development point of view|
|SQL Queries||How to author queries in the Azure portal|
|Programming with DocumentDB||Reading and writing data in code, using the .NET SDK|
|Stored Procedures||Authoring DocDB stored procedures and executing them using the DocDB REST API|
|MongoDB Protocol Support||Configuring and using DocDB's MongoDB protocol support|
|Use Cases||A brief discussion of scenarios well-suited for DocDB use|
|Pricing||A review of the DocDB pricing model, and discussion of cost estimation and Total Cost of Ownership|
|Ecosystem Integration||A short review of DocDB integration with other Azure services|
|Summary||Course wrap up|
If you have thoughts or suggestions for this course, please contact Cloud Academy at email@example.com.
In this last section of the course, we'll consider how to get the most out of Document DB. Let's start with a brief summary of common use cases for No Sequel and Doc DB. The internet of things (IoT) is an important macro-level trend in cloud computing. Connected devices of all kinds across a variety of industries produce huge amounts of operational and diagnostic data that must be collected, stored and analyzed quickly. Use of relational databases in such large scale data collection and aggregation is often restricted to offline Ad Hoc Query and Analysis. Due to the inherent challenges of mapping highly variable device data formats to normalized schemas, and dealing with the scalability and performance problems that can often result.
Several capabilities of Document DB make it well suited for large-scale IoT applications: terabyte level storage capacity, low latency reads and writes that remain consistent as data size grows, horizontal scale is a transparent data participant, and push button geo-redundancy across as your data centers. The ability to store raw JSON data without static schema definition. And finally, the easy integration that Doc DB has with other as your services, like cloud scale messaging infrastructure, analytics and server list compute capabilities.
Online multiplayer gaming is another area where the Document DB service can shine. Modern games require elastic scale to accommodate changing workloads at different times of the day or year as well as fast single millisecond queries for things like player stats and in-game leaderboards. The Document DB feature set provides these foundational capabilities and much more. Mobile games such as The Walking Dead, No Mans Land, and console shooters like Halo 5 rely on Doc DB as part of their core text stack.
Social media is also an area where a schemaless document store like Document DB will shine. Consider the challenge of storing user data for a service like Twitter. While it's possible to normalize such data across a series of relational tables and foreign key definitions, queries would be difficult to optimize as user load increases. In many social application scenarios data like messages, likes, comments, profile information, and so on can be queried and displayed on a per user basis. It's also common to add new data attributes over time as new capabilities are added to the platform. A JSON document storage model makes an ideal solution here. In addition, as user population expands into multiple geographies it can be useful to replicate data across geographies to minimize latency and maximize the user experience. Document DB provides all these capabilities and more and can be a powerful platform upon which to build connected social graph-enabled applications.
About the Author
Josh Lane is a Microsoft Azure MVP and Azure Trainer and Researcher at Cloud Academy. He’s spent almost twenty years architecting and building enterprise software for companies around the world, in industries as diverse as financial services, insurance, energy, education, and telecom. He loves the challenges that come with designing, building, and running software at scale. Away from the keyboard you'll find him crashing his mountain bike, drumming quasi-rythmically, spending time outdoors with his wife and daughters, or drinking good beer with good friends.