In this Course, you will learn about Microsoft Azure, one of the main cloud service vendors.
Now that we have a good idea of what services are available in Azure, let’s see how we can put them together to create a more complex solution. One of the best ways to get started is to look at the examples in the Azure Architecture Center. If you click on “Browse Azure architectures”, you’ll see some recommended architectures for particular types of solutions. There are hundreds of example architectures, so it’s usually easiest to search for what you need. I’m going to walk you through an e-commerce example, so I’ll search for “e-commerce”.
The scenario in this example is that we need to build an Azure-based solution for customers who want to buy concert tickets. The diagram they use is a bit confusing, so we’ll use our own.
The first service we need to use is Azure App Service because it’s the easiest way to host a web app. To buy concert tickets, our customers will connect to our website, which will be hosted on Azure App Service.
The website won’t be able to do very much, though, until we add more services. For example, it would be pretty difficult to have a continually updated list of concerts without using a database. We could connect our website to a variety of databases, such as MySQL or Cosmos DB, but the most obvious choice is to use Azure SQL Database. We can store concert information there and then have a list of upcoming concerts appear on the website.
If we’re going to have a lot of concerts to choose from, then we should also allow customers to search for specific concerts. Azure Cognitive Search is a good choice for that. It indexes your content so it can provide quick responses to search queries.
Next, we’ll want to give customers the ability to purchase tickets. This example solution from Microsoft doesn’t include the actual payment handling part of the transaction, but it does include a couple of important pieces. First, we’ll want to give customers the option to create an account so they don’t have to re-enter their information every time they use our app to purchase tickets. A good solution is to use Azure Active Directory B2C. The B2C stands for “Business to Consumer”. It provides everything you need to handle authentication for people outside of your organization.
When we receive customer orders, we should put them in a queue. Then we can have a separate component that pulls orders from the queue and processes them. This is one of the best ways to pass data from one component to another because it makes applications more reliable and scalable. Even if a component goes down, the data will be buffered in the queue until that component comes back up. Microsoft has a special type of storage to handle this need, and it’s called, not surprisingly, Queue storage. It scales up and down as needed.
To retrieve orders from the queue and process them, we can use an Azure Function. The function will be triggered automatically whenever a new item is added to the queue. The function then creates a printable concert ticket for the customer. When it’s done, it stores the ticket in Blob storage, which is the perfect place for image files. The ticket will then be sent to the customer, although that’s not shown in this example app.
Okay, now we have a complete solution (other than the couple of missing pieces that I mentioned). But we can add more functionality to our app. Another feature we can add is to allow people to post a review after they’ve seen a concert.
This can be handled in a similar way to the order processing feature. We’ll add new concert reviews to another queue and have an Azure Function that retrieves those concert reviews from the queue. Then it will store the reviews in SQL Database so they can be displayed on the website.
All right, now we have all the functionality we need, but we can add some more services to make our app better.
First, we can add Azure Cache for Redis and use it to cache concert information. This will make searches faster when customers are looking for concerts.
Another important way to make our app faster is to use the Azure Content Delivery Network. It’ll cache our website’s static files so they’ll come up faster when customers access our site.
Yet another way to improve responsiveness is to use a service called Azure Traffic Manager. If we create multiple copies of our web app and host them in different regions around the world, then we can configure Traffic Manager to serve each customer from the web app instance that’s closest to the customer on the internet. So now, not only do they get the static website files from the closest point on the Content Delivery Network, but they also interact with the web app using the nearest instance.
To ensure that our app is functioning properly, we can use the Application Insights service. It takes care of monitoring the app and alerting us if there are issues. It also provides us with analytics to help diagnose issues and to understand how users are interacting with our app.
Finally, if we want to automatically classify concert reviews as positive or negative, we can use the Text Analytics component of Cognitive Services. We’ll have an Azure Function that runs a sentiment analysis on each concert review and then updates the concert review in the database to show whether it’s positive or negative.
That’s a lot of different services for one application. So, how much will everything cost? Thankfully, Microsoft provides sample pricing on the solution example page. It even has options for small, medium, and large implementations, depending on how much customer traffic we think we’ll get. Let’s try the medium option, which can handle up to 100,000 users per month.
This brings up the Pricing Calculator, which is a really handy feature for estimating the price of nearly any Azure service. I’m going to click the “Collapse all button” so we can see a summary of all of the costs. The total is up here. It’s around $900 per month for everything.
If you look through the breakdown of the price, you might be surprised to see that App Service is not the #1 cost on this list. Considering that it hosts the core application, it seems like it should have the highest cost, but actually Azure Active Directory B2C and Azure Cognitive Search are higher. That’s a bit misleading, though, because this pricing example only includes App Service hosting in one region. If we want to host the app in multiple regions and use Traffic Manager to make it more responsive for users around the world, then we’ll pay at least this much for each region, which would easily make App Service the most expensive component.
And that’s it for designing a solution.
A world-leading tech and digital skills organization, we help many of the world’s leading companies to build their tech and digital capabilities via our range of world-class training courses, reskilling bootcamps, work-based learning programs, and apprenticeships. We also create bespoke solutions, blending elements to meet specific client needs.