EntityFrameworks - scale out & replication

David Thielen 2,281 Reputation points
2022-12-10T14:17:41.517+00:00

Hi all;

I am writing a simple CRUD ASP.NET Core 6 app that will hit Azure SQL Database. Three questions on this:

  1. I will host the app in 3 datacenters for faster response & failover (via Front Door). In each of these datacenters the system will be set to scale out. Am I correct in understanding that even if it scales out to say 10 or 20 instances, I still have just one SQL instance in that data center?
  2. I want the database to replicate across the 3 datacenters. Am I correct in understanding that each app instance can read from the database in their datacenter but the writes go to the primary database?
  3. Is there a good, preferably short, web page or document that tells me how to set this all up for this use case? I want to accomplish this with as small a learning curve as possible.

thanks - dave

ps - For those wondering why I just want "do this" without learning all the details, I'm a one man team creating this app and my expertise is programming. If I have to become an expert on installing/configuring/administering all the Azure pieces, this project will take an additional 6 months.

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
698 questions
Azure SQL Database
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,211 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,961 questions
0 comments No comments
{count} vote

Accepted answer
  1. Alberto Morillo 32,896 Reputation points MVP
    2022-12-11T04:29:57.387+00:00

    Below my answers,

    1. Up to four read-only geo-secondaries can be created for a primary on an active geo-replication configuration. You can find more information here. On this documentation you can also find how to use read-only replicas to offload read-only query workloads.
    2. You assumption is correct.
    3. Let me know if this tutorial serves your needs. If you like PowerShell you will find this script very useful to achieve your goal. This tutorial uses the Azure Portal to configure geo-replication, maybe your best option.

    One suggestion, since you are using EF do not enable automatic creation of indexes as it may cause migrations to fail by adding indexes EF do not know about it.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Alberto Morillo 32,896 Reputation points MVP
    2022-12-10T18:06:53.38+00:00

    Would you consider using Azure SQL Data Sync? You can define a central master database (hub database) and up to 30 client databases, but all client databases can accept receive read-write workload. The central master database should have a service tier assigned that can support the workload of syncing with the client databases (member database). You can get started here. The sync between master database and client databases can be manual or scheduled (seconds, minutes, hours, or days).