Home / Blog /

Scale Out Sql Server with Azure Federations

Background

More and more businesses look into scaling solutions for their DB. That is for good reasons! Usually the number of clients or sales or licenses grows over time as a linear function. As a result we have a linear function for number of DB Transactions, and amount of data accumulated by the business. However the query response time grows exponentially. Thus, the performance of your single DB solution will yield a bad user experience.

DB Query Response Time

Fig.1, DB Query Response Time

As we may clearly see from the diagram, eventually the business will run into the DB bottleneck.

 

DB Scaling solutions: Scale UP vs. Scale OUT

When scaling the DB you may consider two approaches: Scale Up and Scale Out.

Scale UP

This approach is related to improving the hardware solution of the DB. That means use faster processor, more RAM, faster Hard Drive, etc. This solution is works very well when you have to improve DB performance without changing the architecture. I.e. when dealing with a legacy system. It is not difficult however to see that this approach has limitations, including associated price for the upgraded units.

Scale OUT

The Scale OUT approach is related to implementing a DB solution in which the I/O process will be distributed across multiple DB partitions.  All options of Scale OUT assume some amount of re-work. What option to choose? Most of the choices revolve around the nature of your data and the nature of use of the data. Let us review the possible options of Scale OUT:

  • Table partitioning
  • Master/Slave configurations
  • Custer Computing
  • Sharding

 

Table Partitioning. In the case of Table Partitioning a large table is split into two or more physically separate partitions. For instance you may have clients who live on the east coast to be stored in the table CustomersEast and clients who live on the West Coast to be stored in the table CustomersWest. In case of such distribution the queries will end up hitting two separate tables. The tables can also be located in different DB files which helps the I/O performance.

Master/Slave configurations. In the Master/Slave solution we have one database which is called “Master” and multiple databases called “Slaves”. The Master DB is setup for read/write access; the Slave databases are read-only. There is a data replication between the Master and the Slaves. Master/Slave configuration is suggested by Microsoft when doing Peer-to-Peer Replication. The drawback of this solution is related to the situation in which the Master fails. The Master/Slave approach does not require complex changes and provides good performance result. Microsoft recommends this solution when you expect moderate amount of data updates.

Cluster Computing. Similar to the Master/Slave in the DB Cluster we have one database node which is a DB available for read/write and multiple nodes which are in the read-only mode. All data updates are received by the “Master” node and replicated into the read-only nodes. The DB Cluster Computing solution addresses the case of the failing Master. In such scenario one of the read-only nodes becomes the new “Master”. Thus the DB Cluster solution is more reliable than the Master/Slave solution.

Sharding. The term “Sharding” or “Shared nothing” was coined by Google engineers and implies a solution in which the application operates with “Shards” which can be physically separate databases. With Sharding there are queries which run inside the shard and queries which are distributed across multiple shards. It is important to design your data model to minimize the amount of distributed queries.

Sharding

Fig.2, Scaling OUT: Sharding

 

SQL Azure Federations

Azure Federation is a Sharding technology which allows distributing the DB transactions across multiple databases which are called Federation Members.Azure Federation

Fig.3, SQL Azure Feredation

Let us review some terminology. The SQL Azure Federation have following essential objects:

  • Federation object
  • Federation Key
  • Federation Member
  • Atomic Unit

Federation

Is an object stored in SQL Azure database. This object is responsible for the distribution schema of the Federation Members as well as the type of the Federation Key. The Federation object is of a Range value.  It covers the possible values of the Federation Key.

Example 01

Federation Key

Federation Key is a column in the Federated Table. The value of the Federation Key determines in which Federation Member the data row is stored. As you can see from the listing, the CREATE TABLE instruction for the Federated table differs from the regular CREATE TABLE by “FEDERATED ON” clause.

Example 02

Federation Member

Federation Member is a physically separate SQL Azure database. The Federation Member holds data related to a range of Federation Keys, configured for this Federation Member in the Federation object. The Federation Member can have two types of tables: Federated tables and Non-Federated tables.

Atomic Unit

Atomic Unit represents all rows of data from Federated Table(s) which have a particular value of the Federation Key.

How does it work?

Once you connect to the SQL Azure DB you create a Federation object. The Federation object is created and stored in the DB you connected. This database becomes Federation Root. When you create a Federation object your first Federation Member, a separated SQL Azure DB, is also created. The size and the type of the newly created Federation Member SQL Azure DB is inherited from the size and type of the Federation Root SQL Azure DB.

Federation 02

Fig.4, Azure Federation Databases and Tables

Management of Azure Federations

Azure Federation is an out-of-the box solution. As such it provides an interface for following manipulation of the Federation object:

  • Split/Drop Azure Federation
  • Monitor Azure Federation

 

Split/Drop Azure Federation

Once you create the Federation object, your first Federation Member is created. Hopefully your business picks up and your Federation Member DB is not enough to handle the load. In such case you need to add more databases. That is achieved by splitting your Federation Member. On contrary, if you need to downsize, you may want to drop the Federation member.

Example 03

I would like to provide the example listing which you may use to explore Azure Federation. Run this code segment by segment. Be sure to establish a connection to Azure DB first.

Listing 01

Monitoring Azure Federation

You can monitor your Azure Federation through a set of Diagnostic Views and tables:

  • Federation Operation Views. These system diagnostic views contain information about the current operations on Azure Federation Objects
  • Federation History Tables. The Federation History Tables contain the historical information about the operations which affect the Federation object.

Federation Metadata Tables – contain the current distribution of federation members in the Federation.

Azure Diagnostics

Fig.5 Azure Diagnostics Views and Tables

Pricing and Billing

The pricing of Azure Federations is no different than pricing of SQL Azure:

  • DB Charges are prorated to a day.

                Example: Cost of 1Gb Web edition is $0.33/day

  • All DB that exist in the day are charged
  • Only DB that are in ready state are charged

 

Following operations related to Azure Federations will affect your bill:

  • Federation Creation
  • Federation Repartitioning Operations

Modification of Federation Billing properties. Please see below how you may alter your SQL Azure DB to reduce/upgrade the size and the edition of your DB.

Azure Example 04

 

Conclusion

SQL Azure Federations provide a powerful OUT-OF-THE box solution for scaling out your SQL Azure DB. The solution is based on SQL Azure and comes with all good things of SQL Azure including two backup copies, pay-as –you-go pricing model. Finally the bulk of the db partitioning complexity is implemented “under the hood”. That is very convenient as it allows the developer to concentrate on creating the scalable solution.

Share this:

Comments 24

  1. Cintia
    5/30/2012
    This is what I have been searching in quite a few web pages and I ulalettmiy identified it right here. Wonderful post. I am so impressed. Could under no circumstances imagine of these a point is attainable with it…I imagine you have a excellent information in particular while dealings with these kinds of topics.
  2. kjmsvsadcbm
    6/1/2012
    7x0fmw , [url=http://mxkvjvgfinff.com/]mxkvjvgfinff[/url], [link=http://acdfkyviovem.com/]acdfkyviovem[/link], http://ybfslqyidmxm.com/
  3. wkrwmelg
    6/2/2012
    yPhBcd , [url=http://zdbotkbofrod.com/]zdbotkbofrod[/url], [link=http://hrqtojyykkoy.com/]hrqtojyykkoy[/link], http://brcefclncqbz.com/
  4. Cheap Mulberry Bags
    9/17/2012
    Magnificent goods from you, man. I have understand your stuff previous to and you are just extremely excellent. I really like what you've acquired here, really like what you are stating and the way in which you say it. You make it entertaining and you still care for to keep it wise. I can not wait to read far more from you. This is really a wonderful web site. http://mulberrybags360.tumblr.com
  5. www.equal-jus.eu/node/292#comment-17750
    9/19/2012
    On the night we will have the subsequent stores get aspect in the vogue display: wardrobe clothes and heels footwear Klasse Boutique Komodo Boutique The True Women of all ages Ladies Vogue and Underwear Heaton's Wicklow City Magnificence Underwear and Nightwear Wicklow Rugby Club Sport and Supporters ware Jenny's Glad Rags John Flood Mensware Ahoy Ahoy Fashions Anne Harris Jewellers Broga Sneakers and Ashford Bridal Studio. http://www.equal-jus.eu/node/292#comment-17750
  6. newbusinessethiopia.com/index.php?option=com_content&view=article&id=684:standard-bank-scoops-top-honours-at-project-finance-awards&catid=37:finance&Itemid=37#josc110643
    9/20/2012
    The 'tennis whites' search, nevertheless, is pass? The captivating, pleated white skirt may perfectly be thought to be a classic inside of the most stringent tennis sectors nevertheless, you could nevertheless include a compact punch to your sophisticated wardrobe by heading in for a few fascinating trend versions. Tennis Attire are essentially readily available in a wide range of good styles, silhouettes as well as cuts, and search wonderful in light and vivid hues this kind of as mango, aqua, olive green and Dark red. http://newbusinessethiopia.com/index.php?option=com_content&view=article&id=684:standard-bank-scoops-top-honours-at-project-finance-awards&catid=37:finance&Itemid=37#josc110643
  7. www.storenvy.com/qyzuvehxyle4
    9/21/2012
    It appears to be Paris Hilton is a celeb 1st and foremost for getting money, and then functioning that fame to make even much more. The form of man or woman who will get paid out just for exhibiting up at a bash, Paris is oftentimes much more a marketable model than a man or woman. And what an unfortunate model! Paris released an exclusive line for Kitson Boutiques marketing her individual model of model ?typically t-shirts display printed with her confront in gold lame. With plenty of low-cost, shiny dresses also, it has to be a single of the most unattractive celeb trend lines on the sector. http://www.storenvy.com/qyzuvehxyle4
  8. pzvudlhnlb
    10/18/2012
    klortdpefnbtufstjoum, http://www.hmxahjemsz.com bliinrquaq
  9. cheap nike shoes
    2/1/2013
    i like your post
  10. klgotndqky
    4/28/2013
    uxdeodpefnbtufstjoum, http://www.yxxuwrijdv.com rbybbzrmfg
  11. ocfikmzdyl
    5/3/2013
    zmrmodpefnbtufstjoum, [url=http://www.qbukjevhxc.com]pmfzheglbt[/url]
  12. ydazxtdeto
    5/3/2013
    cqwpidpefnbtufstjoum, [url=http://www.wkhbioykvq.com]qlotezbxlo[/url]
  13. vbhxomrste
    5/3/2013
    gnexcdpefnbtufstjoum, [url=http://www.nfhtqfkqym.com]avoyvefzhz[/url]
  14. emnwqnkmer
    5/4/2013
    pshfadpefnbtufstjoum, [url=http://www.ttcdgnfarr.com]zdxtwxumfx[/url]
  15. gogwpkycpg
    5/4/2013
    ivaxmdpefnbtufstjoum, [url=http://www.ovctzbdavf.com]nallxyhrba[/url]
  16. xyxgpevuey
    5/4/2013
    ujqqadpefnbtufstjoum, [url=http://www.qarlllvrak.com]frxrulmjsb[/url]
  17. fmrsumjqcb
    5/11/2013
    fkseldpefnbtufstjoum, http://www.tanvbpfsfu.com ddqrrolzwx
  18. qnltiucpza
    5/11/2013
    ebycgdpefnbtufstjoum, http://www.hwsiyzafeh.com umzlwbwnll
  19. sopjkmefys
    5/11/2013
    fbfrbdpefnbtufstjoum, [url=http://www.ikodjkxhby.com]ohrokjhcsv[/url]
  20. pxmcmnbqdb
    5/11/2013
    qslxadpefnbtufstjoum, [url=http://www.rhimutgyaq.com]qjxrxaxnzm[/url]
  21. eeqhna147
    5/19/2013
    mbt Shoes outlet http://www.threeslotpayphone.com/mbtshoes.php mbt Shoes outlet
  22. dghfafipax
    5/25/2013
    sigrsdpefnbtufstjoum, http://www.udsnwkxock.com iupliplvzj
  23. wrwzrnfvbp
    5/25/2013
    slrybdpefnbtufstjoum, http://www.bvmbxtqanf.com spkwjyijiz
  24. ugurewaiqq
    5/25/2013
    fmfcqdpefnbtufstjoum, http://www.vnbrjqlmfe.com dkgjlrvmmh

Add comment