The public cloud provides services such as virtual private servers and databases hosted as a service to the general public on a subscription basis. Some platforms, such as Amazon, charge an hourly subscription or offer pay-as-you use (Lambda) services, while others charge a fixed amount for a month, such as DigitalOcean, and so on. The Windows Azure public cloud platform is one of the important pillars of Microsoft's Cloud OS vision that is transforming the traditional data center environment, helping businesses unlock insights in data stored anywhere, enabling the development of a wide range of modern business applications, and empowering IT to support users who work anywhere on any device while being able to manage these devices in a secure and consistent way.
In this chapter, we are going to cover the following points related to Microsoft Azure Cloud and Cosmos DB:
- Azure features
- Azure as a service, platform, and infrastructure (SPI)
- Azure components
- Getting started with Azure
- Azure Cosmos DB
- Azure Cosmos DB features
- Azure Cosmos DB use cases
Let's get started by explaining the topics one by one.
One of the famous and simplest quotes about Azure goes as follows:
Windows Azure can be anything you want it to be
Microsoft Azure Cloud provides a wide range of different services. Windows Azure lets you build, deploy, and manage solutions for almost any purpose you can imagine.
Windows Azure is a world of unlimited possibilities. Irrespective of whether you're a large enterprise spanning several continents that has to run server workloads or a small business that needs a website with a global presence, Windows Azure provides a platform for building applications that can leverage the cloud to meet the needs of your business.
Microsoft Azure provides the following key features:
- Open: Azure provides vast collections of software development kits (SDKs) and tools for various languages in order to build scalable cloud-based applications.
- Flexible: Whether you are running a small business or a huge, high-end processing system, Windows Azure provides various services and scalability to help you with all the stages of your business.
- Microsoft-managed: Microsoft has data centers across three continents—the United States, Europe, and Asia. Microsoft itself manages these data centers instead of hiring third-party people to run these, which most other providers do.
- Compatible: You can integrate your existing cloud premise with Azure easily using either support teams or tools.
- CDN: Azure provides a content delivery network (CDN) that consists of a geographically distributed system of servers that enables Windows Azure to deliver high-bandwidth content for performance-sensitive customers by caching data, images, pictures, and video from Windows Azure compute instances.
- Distributed database: Azure cloud provides easy-to-manage distributed databases such as SQL Server and Cosmos DB to help developers scale and build global range applications.
You can refer to this diagram for all of the components Azure Cloud offers:
Let's dive more into what Azure can do as a serial peripheral interface (SPI).
There are many cloud computing platforms offered by different organizations such as Google Cloud, Amazon Web Services, and so on. Windows Azure is one of them, and is provided by Microsoft Azure.
Azure is described as the managed data centers that are used to build, deploy, and manage the applications and provide services through a global network. Platform as a service (PaaS) and infrastructure as a service (IaaS) are the services provided by Microsoft Azure. It supports majority of the programming languages.
Azure provides platforms to clients to develop and deploy software without worrying about the server infrastructure and configuration. You can focus on the development of the application and leave the infrastructure worries to Azure.
One of the key perks of using Azure is the overall cost, which is low as the resources are allocated on demand and servers are automatically updated. Azure provides automatic updates to avoid security issues, and it does all that in the background without affecting the application.
Azure provides a managed compute service that gives complete control of the operating systems and the application platform stack to the application developers. It provides developers with control over the data center and allows them to manage it.
This is the ideal case for projects where complete control is required. The virtual machine can be completely altered to the requirements of the project or business. However, if not managed carefully, it could become troublesome; all the security updates then become the job of the developer who manages the infrastructure.
The maintenance of the legacy application also sometimes becomes difficult due to operating system and application stack updates.
Please refer to the following diagram, consisting of Azure components:
As you can see in the preceding diagram, there are different execution models, in particular the distinctive advancements that can be utilized to execute applications running in the Windows Azure cloud. The execution models mainly consist of the four Windows Azure compute services, websites, cloud services, and mobile services.
At the base are the SDKs for different languages which you can use for building, sending, and overseeing applications that can be kept running on Windows Azure.
The SDKs that are presently upheld incorporate .NET, Java, PHP, Node.js, Ruby, Swift, and Python. There is additionally a general Windows Azure SDK that gives essential help to any programming dialect, for instance C++.
Enough of the theories; let's get started with Azure.
To start with Azure, first you need to visit Microsoft Azure and create a new free account or use your existing Hotmail account. The free account comes with a credit and you can use that credit for 12 months. You need to add your credit card information and verify it. Microsoft Azure won't charge you without the required action from the user's side:
When your account is created, log in into the Azure portal. Once your login is successful, you should see a screen similar to the following:
Let's understand the components and functionalities of each module in brief.
Azure components are divided into the following major components:
- Compute modules
- Data management modules
- Networking module
- Big data module
- Caching and messaging module
- Identity module
- Mobile service module
- Internet of things
Let's look over each of them.
As the name suggests, the job of this module is to provide a set of tools and services to do computing. Here is the list of services which are provided under compute modules:
As seen in the preceding screenshot, these components mainly consist of virtual machines and containers, but as per the requirements you can join them together as well.
For example, a virtual machine with more disks and snapshots along with containers is used for continuous delivery.
Let's look over the next component, the data management modules.
Data management modules consist of SQL Server, Azure Cosmos DB, Redis, PostgreSQL, and data warehouses. You can deploy these data management modules and use them in your app.
Here is the complete list of data management modules:
We are going to cover Azure Cosmos DB in an upcoming section. Microsoft Azure started to support MySQL and PostgreSQL in the current version (only at the time of writing this book).
Let's look over the networking module.
The Azure traffic manager is in charge of directing the request of a user cleverly to an accessible data center. The procedure includes finding the closest data center to the user who makes the demand for the web application, and if the closest data center is not accessible because of different reasons, the traffic manager deviates the demand to another data center.
Be that as it may, rules are set by the administrator of the application regarding how the traffic manager should act in such cases. The virtual network permits a system between nearby machines at your commencing place and a virtual machine in Azure's data center. IPs to virtual machines can be appointed for identity and accessibility purposes. Virtual network setup requires a virtual private network device.
Azure also provides an application gateway which is very useful in micro services application development.
Following is the list of networking modules Azure supports at the time of writing this book:
Let's look over the big data and business intelligence modules.
The extensive measure of data can be stored and retrieved using Windows Azure. Azure offers HDInsight, which is a Hadoop-based service to determine and sense out enormous information stored as big data. Companies regularly need to oversee extensive measures of information which are not fundamentally relational in nature. Hadoop is used by many organizations nowadays, and it is used in Azure too.
In this manner, Azure offers Hadoop benefits on their platform for their customers. The term big compute alludes to high-performing calculations. This is accomplished by executing code in parallel on many machines in the meantime.
The components offered by big data modules are shown in following screenshot:
As you can see, Azure offers big data services ranging from storage using Hadoop clusters to performing analytics over big data, performing log analytics to determine errors, and generating reports based on your data.
Azure also provides machine learning web services to be used as smart algorithms to train and derive sense out of data.
Let's look over the caching and messaging modules.
The Windows Azure caching service helps you to build a high-end, scalable, and dedicated cache for your website.
Azure cache is offered in three different types:
- Basic: A cache size less than 1 GB comes with this type.
- Standard: A cache size ranging from 1 GB to 10 GB comes with this type.
- Premium: A cache size more than 5 GB and less than 150 GB comes with this type.
Let's look over the messaging module.
Windows Azure offers two options for handling the interactions between two apps:
- Message queues
- Service bus
Generally, service-oriented architecture or SOA-based applications use service buses to perform the communication between various services.
Distributed and independent services, such as micro services, use message queues to perform the communication between them. The developer can choose one according to their needs and requirements.
Let's look over the identity module.
This component is all about the administration of users, validation, and authentication/authorization. The active directory stores the data of clients getting to the application and, furthermore, the association's data within the organization. It can synchronize with the related data on nearby machines dwelling on-premises for effective sessions.
Here are the security and identity modules provided by Azure:
Microsoft Active Directory is one of the most mature and popular authentication and authorization modules on the market.
Let's look over the mobile service module.
Windows Azure offers a simple platform to create portable mobile applications. You can begin the development of your mobile app using the Azure mobile SDK. There are so many libraries already available in Azure SDK such as notification, authentication, and so on. You can focus on your business logic and Azure SDK will help you in the common routines to ship your app faster.
Windows Azure provides a very easy platform to develop mobile applications. You can simply start using mobile development tools after logging in to your account. You don't have to write big custom code for the mobile application if you use this service. The push notifications can be sent, data can be stored, and users can be authenticated in less time.
Please refer to the following screenshot for the full list of mobile service modules:
As you can see, the list of modules is enough for mobile app developers to bootstrap their application quickly and easily.
Let's look over the last, and one of my favorite, modules: the internet of things (IoT)!
IoT is a hot subject right now and Azure is one of the first providers in the cloud market to facilitate such services. IoT modules allow developers to deploy services such as IoT device communication, networking, and device allocation to the hub.
Refer to the following list of modules provided by Azure for IoT purposes:
There are other modules, along with add-ons such as developer tools, monitoring tools, Bing Maps application programming interfaces (APIs), and so on.
I hope this provides you with brief but useful insight into Azure. Let's dive into Azure Cosmos DB now.
Azure Cosmos DB is Microsoft's globally distributed, multi-model database with scaling at the click of a button. You can scale Azure Cosmos DB across 30+ Azure regions spread across the globe.
It's multi-model, hence it supports document storage, table storage, and graph values all together in a single database. Azure provides excellent throughput, latency, availability, and consistency guarantees with comprehensive service level agreements (SLAs) which, as of now, no other database provider is offering.
Note
SLAs represent the promise on paper. That means Microsoft Azure offers you upper bound time for various features such as latency, failover, and so on. For more information, visit https://azure.microsoft.com/en-us/support/legal/sla/cosmos-db/v1_0/.
Here is the featured and introductory representation of Azure Cosmos DB:
Here are the key features and capabilities Microsoft Azure Cosmos DB offers:
- Turnkey global distribution
- Multilevel data models
- Scale on demand
- High response with less latency
- High availability
- Consistency models
- Money-back guarantee with SLA
Let's look over each of them in brief.
Azure Cosmos DB is baked with scaling and distribution. Mobility and cloud are the current major sources of computing use and that creates the challenge of high availability with less latency.
Azure Cosmos DB provides an easy way to build and distribute your application across an Azure data center without doing manual work and configuration. Azure automatically replicates your data across a number of data centers available in the Azure network.
We will be covering turnkey distribution in the next chapter in detail.
Let's look over multilevel data models.
Azure Cosmos DB supports multiple data models, including document stores, key values, graphs, and tables. Azure offers consistency and high availability across all data models, regardless of their nature, to store the data.
At the time of writing this book, Azure supports APIs for the following models:
- Document DB API
- MongoDB API
- Table API
- Graph API
The Microsoft team is working to support other data models, if required, and to enhance the existing ones.
We will study the data models in detail in Chapter 3, Cosmos DB Multi-model Databases.
Let's look over the scaling feature of Cosmos DB.
Azure Cosmos DB introduces a global turnkey feature; using this, you can deploy and scale your application with literally the click of a button. Azure handles every key technical detail such as infrastructure management, replication, traffic diversion, and so on.
Almost every database as a service offers this scaling, so what's new? Azure offers a software level agreement for latency and deployment time, and if it takes more time than promised, you will get your money back!
Let's look over the latency responsiveness of Cosmos DB.
According to the Azure documentation:
"Azure Cosmos DB guarantees end-to-end low latency at the 99th percentile to its customers."
This is a huge promise. Cosmos DB offers end-to-end latency reading under 10 ms for 1 KB of payload, and write under 15 ms in the same region of Azure. This is very impressive and helpful.
With this high response rate and low latency, let's see how Cosmos DB manages consistency.
Most of the distributed databases offer consistency models, mainly strong and eventual consistency. Azure offers three more consistency levels. They are:
- Bounded staleness consistency: This guarantees that the read may lag behind the write. This consistency model increases the cost of a read option and is higher than session and eventual consistency.
- Session consistency: This is ideal for all scenarios in which a user is involved since it needs real-time reads and writes.
- Consistency prefix: This guarantees that the data written in order will be seen and read in the order that it was performed.
Let's look over the main promise of Azure Cosmos DB, which is its money-back guarantee.
Azure Cosmos DB promises that your data gets there fast, or they send your money back. Azure Cosmos DB provides service level agreements for availability, latency, throughput, and consistency.
An SLA, as of now, is offered only by Microsoft. You can refer to the complete documentation here: https://azure.microsoft.com/en-us/support/legal/sla/cosmos-db/v1_0/.
Let's look over the few use cases of Azure Cosmos DB.
You can use Cosmos DB in scenarios which are highly distributed, mission critical, highly available, and easy to deploy. The following are the use cases offered by the Microsoft team:
- IoT
- Retail and marketing
- Gaming
- Web and mobile
Let's look over the use cases briefly.
IoT consists of various devices that emit data every fraction of a second. This places a need for high ingestion from multiple sources. Azure IoT hub can be used to receive the data from various IoT devices.
Once the data is ingested, you can use Azure HDInsight to process and derive real-time insight. You can then store this data in multiple sources, such as tables, to view in SaaS-based applications, DocumentDB to process the data for graphs and processing, and so on.
Let's look over the next use case.
Microsoft uses Azure Cosmos DB in the Microsoft e-commerce platforms Windows Store and Xbox Live. Azure Cosmos DB can be used to store product data, search the products, and perform the session, which is very important for e-commerce applications.
Azure Cosmos DB can also be used for event sourcing using its own change feed functionality. Change feed provides the amazing event generation mechanism to handle micro service communication.
You can refer to the following diagram about micro service communication:
Change feed is a concept introduced by RethinkDB; Packt authored a book on this called Mastering RethinkDB.
Let's look at the next use case, which is my favorite one, gaming.
Games are highly mission critical and should be very much available at all times. That requires fast and highly available databases. Azure has already proved its worth in games such as Halo 5, The Walking Dead, and so on. Azure Cosmos DB performance can be used to handle millions of requests and to show real-time data feeds and social engagement.
Azure Cosmos DB provides an API that can be directly used in games, and with the help of database functions such as Hadoop, could be used for real-time analysis and feeds.
Let's look over the web and mobile use case.
Azure provides various sets of tools such as key value stores, traffic manager, gateways, and of course Cosmos DB. These can be used in building social media applications, news feeds, and mobile applications using various frameworks.
Azure machine learning and Hadoop can be used as well to generate personalization reports, feeds, and recommendations, which is an amazing part of any modern application. Since most of the data is stored in JSON, it can be communicated and parsed across various scenarios such as the frontend, mobile, backend, and database.
In this chapter, we learned about the Azure platform and its features. We looked at the services and infrastructure offered by Azure cloud to develop mission critical applications. We also looked over Azure Cosmos DB and its features and use cases.
In the next chapter, we are going to learn more about the Azure turnkey distribution feature which is one of the key selling points of Azure Cosmos DB.