Skip to main content

Custom Content Delivery Network Mechanism using Cloud (Azure)

Requirements:
Lets’ imagine an application that need to deliver Excel report in different location of the world. Based on the client origin the application should be able to deliver specific Excel version. The application should be deployed in different location on the world.
The current CDN solution cannot be used because the master node needs to push the content to the slaves (CDN nodes) and the total report size for each slave will be over 20GB.
Non-Cloud solution:
If we would go on a non-cloud solution we should develop an application that is deployed on different location all around the world. Each application should be able to detect the source of the request and provide the specific Excel report. We should also develop a redirecting mechanism/ load balancing solution that is able to redirect the user to a specific node.
Cloud solution:
If we go on a cloud solution, based on Windows Azure we can imagine a master slave solution.
Each slave of our application will have the Excel reports for the country in his region. This slaves will be able to provide reports for the countries in his own region.
Having an application deployed on different data centers give us the possibility to use Traffic Manager. Traffic Manger is an out of the box mechanism that redirect a call to the closest data center where our application is deployed.
We can have our slaves deployed on different data centers around the globe. Each slave will have the reports for the countries that are served by him. When a request is coming from a country that is not served by the specific slave, the request will be redirected to the global slave, which has the reports for all the countries.
This slaves could detect if there to many requests that are coming for a country that is not mapped for their location and trigger an alert of the provisioning action for reports for that country.
Each slave will have an endpoint that will be used to resolve an Excel report request and a storage (blobs) that will be used to store the reports itself. Based on the client attributes, this service will return a URL with a Shared Access Signature (SAS) of a blob storage where the report is stored. Using SAS the access to the content will be controlled.
The solution will contains a master that will manage all the Excel reports from all the nodes. The master will be able to deploy new version of reports, delete the old one and so on from each slave node. Beside this, the master will the one that can trigger the provisioning of a slave with additional countries. The master will contains a storage (blob) with all the reports that exists and are valid and a service that is able to manage and maintain all the slave nodes.
When the provisioning is triggered, the download process to a specific slave should not be done by the master node. Because we can have a lot of slaves, this action consume a lot of resources and can give us a lot of problems. The master node should send a notification to a specific slave that a specific report is available for download/update/delete. In that moment the slave node should receive the notification and trigger the specific action. In this way we are able to move all the load from master to slaves.
The notification mechanism can be done over Service Bus. Each slave node will be represented by a different subscription. When the download/update/delete action is finished, the slave node can send a notification to the master node using a queue or a Service Bus Topic.

Things that I like to this solution:

  • Traffic Manager – Is able to automatically redirect request and when he detect a slave node is down redirect to the next slave
  • SAS – The content of the blob can be shared in a secure manner
  • Slave’s endpoint – If we have slaves that are hit by a lot of clients we can scale up the numbers of instances of that slave without affecting the rest of the slaves
  • Redundancy – When a slave is down all the request will be redirect to the closest slave
  • Report resolver – When a report cannot be resolve by a specific slave, the request is resolve by the global slave that is able not only to log this issues but also he can notify the master node about this incident. In this way the master node can trigger custom action like provisioning
  • Scalability – Each slave can scale independently based on the load
  • Provisioning mechanism – The provisioning is made using the slave processor resource. In this way the master node will not have peaks
  • Service Bus – Notifications from master to slave can be made using Service Bus Topics. In this way we can have one or more slaves register to the same countries
  • Download – The download itself will be made directly from Azure Storage. The load of the slaves itself will be minimal

We could have a similar approach and eliminate the endpoints from slave. Each slave could have only the storage part. This is a good solution when you the number of request that need to be handled is not very high. But when you have hundreds of request per minutes, that a solution like this is more suitable. The slave endpoints can be hosted on small instances.



Comments

Popular posts from this blog

Windows Docker Containers can make WIN32 API calls, use COM and ASP.NET WebForms

After the last post , I received two interesting questions related to Docker and Windows. People were interested if we do Win32 API calls from a Docker container and if there is support for COM. WIN32 Support To test calls to WIN32 API, let’s try to populate SYSTEM_INFO class. [StructLayout(LayoutKind.Sequential)] public struct SYSTEM_INFO { public uint dwOemId; public uint dwPageSize; public uint lpMinimumApplicationAddress; public uint lpMaximumApplicationAddress; public uint dwActiveProcessorMask; public uint dwNumberOfProcessors; public uint dwProcessorType; public uint dwAllocationGranularity; public uint dwProcessorLevel; public uint dwProcessorRevision; } ... [DllImport("kernel32")] static extern void GetSystemInfo(ref SYSTEM_INFO pSI); ... SYSTEM_INFO pSI = new SYSTEM_INFO(

Azure AD and AWS Cognito side-by-side

In the last few weeks, I was involved in multiple opportunities on Microsoft Azure and Amazon, where we had to analyse AWS Cognito, Azure AD and other solutions that are available on the market. I decided to consolidate in one post all features and differences that I identified for both of them that we should need to take into account. Take into account that Azure AD is an identity and access management services well integrated with Microsoft stack. In comparison, AWS Cognito is just a user sign-up, sign-in and access control and nothing more. The focus is not on the main features, is more on small things that can make a difference when you want to decide where we want to store and manage our users.  This information might be useful in the future when we need to decide where we want to keep and manage our users.  Feature Azure AD (B2C, B2C) AWS Cognito Access token lifetime Default 1h – the value is configurable 1h – cannot be modified

What to do when you hit the throughput limits of Azure Storage (Blobs)

In this post we will talk about how we can detect when we hit a throughput limit of Azure Storage and what we can do in that moment. Context If we take a look on Scalability Targets of Azure Storage ( https://azure.microsoft.com/en-us/documentation/articles/storage-scalability-targets/ ) we will observe that the limits are prety high. But, based on our business logic we can end up at this limits. If you create a system that is hitted by a high number of device, you can hit easily the total number of requests rate that can be done on a Storage Account. This limits on Azure is 20.000 IOPS (entities or messages per second) where (and this is very important) the size of the request is 1KB. Normally, if you make a load tests where 20.000 clients will hit different blobs storages from the same Azure Storage Account, this limits can be reached. How we can detect this problem? From client, we can detect that this limits was reached based on the HTTP error code that is returned by HTTP