Get started with Elastic Database tools
This document introduces you to the developer experience by running the sample app. The sample creates a simple sharded application and explores key capabilities of elastic database tools. The sample demonstrates functions of the elastic database client library
To install the library, go to Microsoft.Azure.SqlDatabase.ElasticScale.Client. The library is installed with the sample app described below.
- Visual Studio 2012 or higher with C# is required. Download a free version at Visual Studio Downloads.
- NuGet 2.7 or higher. To get the latest version, see Installing NuGet
Download and run the sample app
The Elastic Database with Azure SQL— Getting Started sample application illustrates the most important aspects of the development experience for sharded applications using Azure SQL elastic database tools. It focuses on key use cases for shard map management, data-dependent routing and multi-shard querying. To download and run the sample, follow these steps:
- Open Visual Studio and select File -> New -> Project.
In the dialog, click Online.
Then click Visual C# under Samples.
In the search box, type elastic db to search for the sample. The title Elastic DB Tools for Azure SQL - Getting Started appears.
- Select the sample, choose a name and a location for the new project and press OK to create the project.
- Open the app.config file in the solution for the sample project and follow the instructions in the file to add your Azure SQL database server name and your login information (user name and password).
- Build and run the application. When asked, please allow Visual Studio to restore the NuGet packages of the solution. This will download the latest version of the elastic database client library from NuGet.
Play with the different options to learn more about the client library capabilities. Note the steps the application takes in the console output and feel free to explore the code behind the scenes.
Congratulations - you have successfully built and run your first sharded application using elastic database tools on Azure SQL Database. Take a quick look at the shards that the sample created by connecting with Visual Studio or SQL Server Management Studio to your Azure DB Server. You will notice new sample shard databases and a shard map manager database that the sample has created.
It is recommended that you always use the latest version of Management Studio to remain synchronized with updates to Microsoft Azure and SQL Database. Update SQL Server Management Studio.
Key pieces of the code sample
- Managing Shards and Shard Maps: The code illustrates how to work with shards, ranges, and mappings in file ShardMapManagerSample.cs. You can find more information about this topic here: Shard Map Management.
- Data Dependent Routing: Routing of transactions to the right shard is shown in DataDependentRoutingSample.cs. For more details, see Data Dependent Routing.
- Querying over Multiple Shards: Querying across shards is illustrated in the file MultiShardQuerySample.cs. For more details, see Multi-Shard Querying.
- Adding empty shards: The iterative adding of new empty shards is performed by the code in file AddNewShardsSample.cs. Details of this topic are covered here: Shard Map Management.
Other elastic scale operations
- Splitting an existing shard: The capability to split shards is provided through the split-merge tool. You can find more information on this tool here: split-merge tool overview.
- Merging existing shards: Shard merges are also performed using the split-merge tool. For more information, refer to: split-merge tool overview.
The elastic database tools are free of charge. Elastic database tools does not impose additional charges on top of the cost for your Azure usage.
For example, the sample application creates new databases. The cost depends on the Azure SQL DB database edition you choose and the Azure usage of your application.
For pricing information see SQL Database Pricing Details.
For more information about the elastic database tools, see:
- Elastic database tools documentation map
- Code Samples:
- Blog: Elastic Scale Announcement
- Microsoft Virtual Academy: Implementing Scale-Out Using Sharding with the Elastic Database Client Library Video
- Channel 9: Elastic Scale Overview Video
- Discussion Forum: Azure SQL Database forum
- To measure performance: Performance counters for shard map manager