Going Global with Azure Cosmos DB

If you have an app with users all over the globe, where should you host your database? This is one of the most difficult questions faced by today’s app-builders. In most cases, any location you choose will be thousands of miles away from a significant percentage of your users. And the farther away your users are from your data, the longer the data-access delays they will experience due to network latency. The result is a sub-optimal or even unacceptable user experience for many users. Although Content Delivery Networks (CDNs) can greatly reduce latency associated with loading files that can be cached, such as images, CDNs generally cannot help reduce latency associated with retrieving information stored in a remote database. This is where Azure Cosmos DB comes in. As a turnkey, global data distribution service, Azure’s solution ensures that your data is stored not in one or two regions, but in as many regions as necessary to fulfill your global strategy.

Users all over the globe

To illustrate the primary problem that Cosmos DB solves, the Azure team asks us to imagine that we’ve just launched an app with a back-end that resides in the U.S. Yet our app quickly grows in popularity and soon has users all over the globe, including Australia. Database-dependent interactions with our app are fast for our users in the U.S., who experience an average latency of only 10 milliseconds. However, our users in Australia experience an average latency that is 15 times greater (150 ms), leading to access delays and an often unacceptable user experience. However, we soon realize that Azure has a datacenter in Australia that can deliver a 10 ms latency to our Australian user base. We just need to find a way to replicate our data in Azure’s Australian datacenter. And this is what Azure Cosmos DB does as its core offering. When we extend this example to other regions around the globe, we begin to see the tremendous potential that Cosmos DB offers us. So we sign up for Cosmos DB, and our app soon delivers a uniform, low-latency, optimal user-experience across the globe.

Options for data distribution

Cosmos DB provides a wide range of options when it comes to global data distribution and replication: you can choose the specific regions you wish to have your data stored; or you can have Cosmos DB programmatically distribute your data according to your app’s usage; or you can distribute your data according to a world-clock approach that follows local peak-usage patterns around the globe each day; or you can choose from still other options. You can also setup Cosmos DB to handle datacenter outages or availability issues by having the system automatically failover to the nearest healthy Azure datacenter, according to your specifications.

RELATED  How to Protect Your Company from the Rogue IT Ex-Employee

To ensure reliability, Cosmos DB backs up their service with an SLA guaranteeing that latency will remain at 10 ms or less at least 99% of the time. Cosmos DB also provides an industry-leading 99.999% SLA for availability; guarantees consistency and throughput; and offers enterprise-class compliance and security.

A unique database architecture

Native support for NoSQL

With native support for NoSQL, Cosmos DB is designed to serve as the ideal solution for apps that don’t rely heavily on the primary strengths of relational, SQL databases (e.g. creating joins)Although NoSQL databases often have workarounds to approximate key features of relational databases, their greatest strengths lie in their capacity to handle very large bodies of data, high-volumes of data consumption, and frequent updates.

One database, many kinds of data

Many of today’s apps make use of two or more databases, each specialized for a specific kind of data or task. However, using multiple databases can lead to a number of conflicts and inefficiencies on both the user and the DBA side. Cosmos DB helps solve this problem by storing key-value data, column-family data, graph data, and document data (Mongo or SQL) all within a single schema-agnostic database solution.

Cosmos DB as a mobile app-building platform

While Cosmos DB can clearly solve the latency problem and the multi-database problem for many app-builders, the Azure team has taken their solution still further. With a keen eye on mobile apps, the Cosmos DB team has streamlined the app-building process to the point that developers can “build planet scale mobile apps in minutes” with Cosmos DB. To stand behind their bold claim, the Azure team provides a five-minute Cosmos DB quickstart for each of five database APIs (DocumentDB, MongoDB, Graph, Table, and Cassandra) and across four programming languages/frameworks: Java, .NET, Node.js, and Python. The service also provides step-by-step tutorials for querying data, replicating databases, importing data, and performing other key functions and actions within Cosmos DB.

Serverless computing

Azure Cosmos DB gives app-builders the freedom to focus on their app without having to worry about back-end concerns, such as provisioning servers and deciding on a database schema. Because the Cosmos DB back-end is fully managed, the only input you need to provide is the number of requests you want to handle per second. This makes Cosmos DB an ideal fit for serverless computing, an emerging development strategy that lets app-builders focus entirely on building their apps, and not on infrastructure. Because serverless computing involves fully managed cloud infrastructure services that take care of server provisioning and management, app-builders need only to deploy their code. High availability comes automatically, and built-in, elastic scaling allows your app’s usage to grow at any pace. As an event-driven approach, serverless computing also allows you to pay only for the infrastructure you use.

RELATED  Azure Time Series Insights: A New Platform for Enterprise IoT

Getting started

To get started with Cosmos DB, simply create an account by clicking on the Cosmos DB link from the main navigation menu in the Azure portal. Then click the Add button. The service will ask you to fill out a few basic fields, then Cosmos DB will guide you through a streamlined Quickstart process.

Achieving planet scale with Cosmos DB

As the example of accessing a U.S.-hosted app in Australia clearly illustrates, high latency can lead to serious user-experience problems. However, by signing up for Cosmos DB, your app will deliver a uniform, low-latency, optimal user experience across the globe. You can manually select datacenters by region; have Cosmos DB programmatically distribute your data according to your app’s usage; use a world-clock approach to data distribution; or choose from a wide range of other options. The service also comes with an SLA that guarantees low latency and high availability.

All of the above is possible due to Cosmos DB’s unique database architecture. Natively supporting NoSQL, Cosmos DB is ideal for handling large bodies of data, high volumes of data consumption, and frequently updated databases. The schema-agnostic architecture also has APIs for many different kinds of data, including key-value data, column-family data, graph data, and document data (Mongo or SQL) all within a single solution. Cosmos DB’s unified, streamlined approach also extends to app-building, as shown by the service’s five-minute quickstarts for building mobile apps with any of four different kinds of data using any of four different programming languages/frameworks. Known as serverless computing, Cosmos DB’s strategy gives app-builders the freedom to focus on their coding without any back-end concerns to slow them down.

To learn more about Cosmos DB and other Azure services that are solving longstanding computing problems with creative cloud solutions, contact us or visit our Azure support services for more information

About Paul William

Throughout my career, I have been a contributor for several tech-companies as a technical writer. I have also written business plans, product development roadmaps and dozens of online newsletters. In terms of my writing strengths, my strongest categories are IT, startups, science and real estate. I bring a wealth of knowledge around technology, the cloud and IT and I enjoy writing about these topics.