2
votes

I'm thinking about moving my DAL which uses DocumentDb and Azure Table Storage to a separate Web API and host it as a cloud service on Azure.

The primary purpose of doing this is to make sure that I keep a high performance DAL that can scale up easily and independently of my front-end application -- currently ASP.NET MVC 5 running as a cloud service on Azure but I'll definitely add mobile apps as well. With DocumentDb and Azure Table Storage, I'm finding myself doing a lot of data handling in my C# code, therefore, I think it would be a good idea to keep that separate from my front-end application.

However, I'm very concerned about latency issues introduced by HTTP calls from one cloud service to another which would defeat the purpose of separating DAL into its own application/cloud service.

What is the best way to separate my DAL from my front-end application without introducing any latency issues?

2

2 Answers

2
votes

I think the trade off between scaling-out/partitioning resources and network latency is unavoidable. That being said, you may find the trade-off well worth it for many reasons (i.e. enabling parallel execution of application tasks, increased reliability, etc.) when working w/ large-scale systems.

Here are some general tips to help you minimize the hit on network latency:

  • Use caching to avoid cross-service calls whenever possible.
  • Batch cross-service calls and re-use connections whenever possible to minimize the cost associated w/ traversing the NAT out of one cloud service and through the load balancer into another. Note - your application must also be able to handle dropped connections (inevitable in cloud architecture).
  • Monitor performance metrics as much as possible to take measurements and identify bottlenecks.
  • Co-locate your applications layers within the same datacenter to keep cross-service latency to a minimum.

You may also find the following literature useful: http://azure.microsoft.com/en-us/documentation/articles/best-practices-performance/

1
votes

I recently split out my DAL to a WebAPI that serves data from DocumentDB for both the MVC website and mobile applications for the same reasons stated by the questioner.

The statements from aliuy are valid performance considerations generally accepted as good practice.

But more specifically - in order to call Web API from MVC without latency using Azure cloud services, one should specify same affinity group for each resource (websites, cloud services, etc).

Affinity groups are a way you can group your cloud services by proximity to each other in the Azure datacenter in order to achieve optimal performance. When you create an affinity group, it lets Azure know to keep all of the services that belong to your affinity group as physically close to each other as possible.

https://azure.microsoft.com/en-us/documentation/articles/virtual-networks-migrate-to-regional-vnet/