9

Is it possible to scale-out a SQL Server database?

There are some solutions for fail-over clustering and always on, but is there a solution for load balancing and horizontal partitioning on SQL Server?

There are some in Azure, but not in a standalone SQL Server instance...

0

2 Answers 2

21

You've kinda got a bunch of questions in here:

It is possible to scale out READS in Azure SQL DB? Yes.

Depending on the service you use, like Azure SQL DB's Active Secondary Replicas, your read workload can automatically be scaled out across multiple servers without big changes to your application code. However, you do still need to add a separate connection string in your application specifying ApplicationIntent=ReadOnly so that they know it's safe to move your read query over to a readable replica.

Is it possible to scale out WRITES in Azure SQL DB? Yes, if you change code.

The document you linked to, Data Partitioning, is a set of design guidelines that you can use when you code your application. However, those are indeed code changes, not a feature of Azure SQL DB that you just flip on the same way you flip on secondary replicas.

It's up to you to design a layer of code so that when your app needs to run a query, it connects to the appropriate location.

Think of it like the World Wide Web: at Stack Overflow, write workloads are separated out across StackOverflow.com, DBA.StackExchange.com, ServerFault.com, and other sites. However you, the user, have to know which site has the data you want to write to - you can't post an answer to this question over at ServerFault.com. That logic is built into your brain - and the same logic needs to be built into your app if you want to scale out writes across multiple servers.

There was a brief moment in time where Microsoft thought they'd do this work for you with Azure SQL DB Federations, but that was quickly deprecated.

Are the same things possible with SQL Server? Yes.

Scaling out reads is as easy as:

  1. Buying more SQL Servers and building them into an Availability Group
  2. Adding another connection string in your app specifying ApplicationIntent=ReadOnly
  3. Profit!

Scaling out writes isn't that easy, and requires code changes just like it does in Azure SQL DB.

Does either of those do true load balancing? No.

Neither Azure SQL DB nor SQL Server Always On Availability Groups truly balance load across multiple secondaries. You can get into a situation where one replica is running a handful of awful queries, and the rest are sitting around idle. And in that situation, you can still end up getting new queries assigned equally to both the underworked and overworked servers.

Doing true load balancing - keeping the work requirements similar across multiple replicas - is left as an exercise for the reader.

0
0

Given that people have made scale out way before it became automatic - yes, you can scale it out as you want. Replication between 100 instances, distributing somehow either hard or by cpu or whatever load - done.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.