Earlier this week Cihan Biyikoglu of Microsoft provided a preview of how developers will need to adapt their code for the upcoming SQL Azure Federations to supports its connectivity model. SQL Azure Federations will support a new connection called FILTERING used to work with federated data and provide the re-partitioning component which will support full-availability. The intent is to provide a safe model for developers to work with federated data and/or multi-tenant applications.
Sharding Pre-SQL Azure Federations
Today, before the release of SQL Azure Federations, Azure developers and architects must overcome two main issues when dealing with federated data: Connection Pool Management and Cache Coherency. Fragmentation is a developers largest concern in regards to connection pool management as connections tend to become stale over time. Cache coherency is difficult to maintain during data movement among shards and developers need to be wise to update the shard map simultaneously as data movement occurs.
Coming with Federations
Federations will free developers from having to manage connections to individual shards and they will instead supply a USE FEDERATION statement, like below from Cihan's preview:
USE FEDERATION orders_federation(customer_id=55) WITH RESET, FILTERING=ON
Filtering turned on applies the desired predicate automatically on behalf of the developer, in this case customer_id=55. When Filtering is suggested to be turned off only when performing bulk operations or when querying data over many atomic units.
Federations will also allow great support for multi-tenancy in applications through the built-in sharding capabilities which over time should reduce the number of individual databases needing management and care. The SQL Azure team has yet to announce when SQL Azure Federations will be released.