Skip to content

Commit 3228691

Browse files
authored
Merge pull request #218330 from davidmrdavid/netherite-quickstart
Add Netherite quickstart
2 parents 4c7f13a + d6b95f0 commit 3228691

File tree

8 files changed

+166
-0
lines changed

8 files changed

+166
-0
lines changed

articles/azure-functions/durable/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
- name: Create durable function - Java
2929
displayName: get started, chaining
3030
href: quickstart-java.md
31+
- name: Configure storage provider - Netherite
32+
href: quickstart-netherite.md
3133
- name: Configure storage provider - MSSQL
3234
href: quickstart-mssql.md
3335
- name: Tutorials
111 KB
Loading
66.3 KB
Loading
87.7 KB
Loading
118 KB
Loading
72 KB
Loading
76 KB
Loading
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
---
2+
title: Configure storage provider - Netherite
3+
description: Configure a Durable Functions app to use Netherite
4+
author: sebastianburckhardt
5+
ms.topic: quickstart
6+
ms.date: 11/14/2022
7+
ms.reviewer: azfuncdf
8+
---
9+
10+
# Configure Durable Functions with the Netherite storage provider
11+
12+
Durable Functions offers several [storage providers](durable-functions-storage-providers.md), also called "backends", for storing orchestration and entity runtime state. By default, new projects are configured to use the [Azure Storage provider](durable-functions-storage-providers.md#azure-storage). In this article, we walk through how to configure a Durable Functions app to utilize the [Netherite storage provider](durable-functions-storage-providers.md#netherite).
13+
14+
> [!NOTE]
15+
> Netherite was designed and developed by [Microsoft Research](https://www.microsoft.com/research) for [high throughput](https://microsoft.github.io/durabletask-netherite/#/scenarios) scenarios. In some [benchmarks](https://microsoft.github.io/durabletask-netherite/#/throughput?id=multi-node-throughput), throughput increased by over an order of magnitude compared to the default Azure Storage provider. To learn more about when to use the Netherite storage provider, see the [storage providers](durable-functions-storage-providers.md) documentation.
16+
17+
## Note on data migration
18+
19+
Migration of [Task Hub data](durable-functions-task-hubs.md) across storage providers isn't currently supported. Function apps with existing runtime data will start with a fresh, empty task hub after switching to the Netherite backend. Similarly, the task hub contents created with Netherite can't be preserved when switching to a different storage provider.
20+
21+
## Prerequisites
22+
23+
The following steps assume that you are starting with an existing Durable Functions app and are familiar with how to operate it.
24+
25+
In particular, this quickstart assumes that you have already:
26+
1. Created an Azure Functions project on your local machine.
27+
2. Added Durable Functions to your project with an [orchestrator function](durable-functions-bindings.md#orchestration-trigger) and a [client function](durable-functions-bindings.md#orchestration-client) that triggers it.
28+
3. Configured the project for local debugging.
29+
4. Learned how to deploy an Azure Functions project to Azure.
30+
31+
If this isn't the case, we suggest you start with one of the following articles, which provides detailed instructions on how to achieve all the requirements above:
32+
33+
- [Create your first durable function - C#](durable-functions-create-first-csharp.md)
34+
- [Create your first durable function - JavaScript](quickstart-js-vscode.md)
35+
- [Create your first durable function - Python](quickstart-python-vscode.md)
36+
- [Create your first durable function - PowerShell](quickstart-powershell-vscode.md)
37+
- [Create your first durable function - Java](quickstart-java.md)
38+
39+
## Add the Netherite extension (.NET only)
40+
41+
> [!NOTE]
42+
> If your app uses [Extension Bundles](../functions-bindings-register.md#extension-bundles), you should ignore this section as Extension Bundles removes the need for manual Extension management.
43+
44+
You'll need to install the latest version of the `Microsoft.Azure.DurableTask.Netherite.AzureFunctions` [Extension on NuGet](https://www.nuget.org/packages/Microsoft.Azure.DurableTask.Netherite.AzureFunctions) on your app. This usually means to include a reference to it in your `.csproj` file and building the project.
45+
46+
You can install the Extension using the following [Azure Functions Core Tools CLI](../functions-run-local.md#install-the-azure-functions-core-tools) command
47+
48+
```cmd
49+
func extensions install --package Microsoft.Azure.DurableTask.Netherite.AzureFunctions --version <latestVersionOnNuget>
50+
```
51+
52+
For more information on installing Azure Functions Extensions via the Core Tools CLI, see [this guide](../functions-run-local.md#install-extensions).
53+
54+
## Configure local.settings.json for local development
55+
56+
The Netherite backend requires a connection string to [Event Hubs](https://azure.microsoft.com/products/event-hubs/) to run on Azure. However, for local development, providing the string `"SingleHost"` bypasses the need for Event Hubs.
57+
58+
In `local.settings.json`, set the value of `EventHubsConnection` to `SingleHost` as shown below:
59+
60+
```json
61+
{
62+
"IsEncrypted": false,
63+
"Values": {
64+
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
65+
"EventHubsConnection": "SingleHost",
66+
"FUNCTIONS_WORKER_RUNTIME": "<dependent on your programming language>"
67+
}
68+
}
69+
```
70+
71+
> [!NOTE]
72+
> The value of `FUNCTIONS_WORKER_RUNTIME` is dependent on your programming language of choice. For more information, please see its [reference docs](../functions-app-settings.md#functions_worker_runtime).
73+
74+
## Update host.json
75+
76+
Edit the storage provider section of the `host.json` file so it sets the `type` to `Netherite`.
77+
78+
```json
79+
{
80+
"version": "2.0",
81+
"extensions": {
82+
"durableTask": {
83+
"storageProvider": {
84+
"type": "Netherite"
85+
}
86+
}
87+
}
88+
}
89+
```
90+
91+
The snippet above is just a *minimal* configuration. Later, you may want to consider [additional parameters](https://microsoft.github.io/durabletask-netherite/#/settings?id=typical-configuration).
92+
93+
94+
## Test locally
95+
96+
Your app is now ready for local development: You can start the Function app to test it. One way to do this is to run `func host start` on your application's root and executing a simple orchestrator Function.
97+
98+
While the function app is running, Netherite will publish load information about its active partitions to an Azure Storage table named "DurableTaskPartitions". You can use [Azure Storage Explorer](/articles/vs-azure-tools-storage-manage-with-storage-explorer?tabs=windows) to check that it's working as expected. If Netherite is running correctly, the table won't be empty; see the example below.
99+
100+
![Data on the "DurableTaskPartitions" table in the Azure Storage Explorer.](./media/quickstart-netherite/partition-table.png)
101+
102+
> [!NOTE]
103+
> For more information on the contents of this table, see the [Partition Table](https://microsoft.github.io/durabletask-netherite/#/ptable) article.
104+
105+
## Run your app on Azure
106+
107+
You need to create an Azure Functions app on Azure. To do this, follow the instructions in the **Create a function app** section of [these instructions](/articles/azure-functions/functions-create-function-app-portal.md#create-a-function-app-a-function).
108+
109+
### Set up Event Hubs
110+
111+
You will need to set up an Event Hubs namespace to run Netherite on Azure. You can also set it up if you prefer to use Event Hubs during local development.
112+
113+
> [!NOTE]
114+
> An Event Hubs namespace incurs an ongoing cost, whether or not it is being used by Durable Functions. Microsoft offers a [12-month free Azure subscription account](https://azure.microsoft.com/free/) if you’re exploring Azure for the first time.
115+
116+
#### Create an Event Hubs namespace
117+
118+
Follow [these steps](/articles/event-hubs/event-hubs-create#create-an-event-hubs-namespace) to create an Event Hubs namespace on the Azure portal. When creating the namespace, you may be prompted to:
119+
120+
1. Choose a *resource group*: Use the same resource group as the Function app.
121+
2. Choose a *plan* and provision *throughput units*. Select the defaults, this setting can be changed later.
122+
3. Choose the *retention* time: Select the default, this setting has no effect on Netherite.
123+
124+
#### Obtain the Event Hubs connection string
125+
126+
To obtain the connection string for your Event Hubs namespace, go to your Event Hubs namespace in the Azure portal, select **Shared access policies**, and then select **RootManagedSharedAccessKey**. This should reveal a field named **Connection string-primary key** and that field's value is the connection string.
127+
128+
Below are guiding screenshots on how to find this data in the portal:
129+
130+
![Find the connection string primary key on the portal"](./media/quickstart-netherite/namespace-connection-string.png)
131+
132+
### Add connection string as an application setting
133+
134+
You need to add your connection string as an application setting in your function app. To do this through the Azure portal, go to your function app view, select **Configuration**, and then select **New application setting**. This is where you can assign `EventHubsConnection` to map to your connection string. Below are some guiding images.
135+
136+
![In the Function App view, go to "configuration" and select "new application setting."](./media/quickstart-netherite/add-configuration.png)
137+
![Enter `EventHubsConnection` as the name, and the connection string as its value.](./media/quickstart-netherite/enter-configuration.png)
138+
139+
### Enable runtime scaling (Elastic Premium only)
140+
141+
> [!NOTE]
142+
> Skip this section if your app is not in the Elastic Premium plan.
143+
144+
If your app is running on the Elastic Premium Plan, it is recommended that you enable runtime scale monitoring for better scaling. To do this, go to **Configuration**, select **Function runtime settings** and toggle **Runtime Scale Monitoring** to On.
145+
146+
![How to enable Runtime Scale Monitoring in the portal.](./media/quickstart-netherite/runtime-scale-monitoring.png)
147+
148+
### Ensure your app is using a 64-bit architecture (Windows only)
149+
150+
> [!NOTE]
151+
> Skip this section if your app is running on Linux.
152+
153+
Netherite requires a 64-bit architecture to work. Starting on Functions V4, this should be the default. You can usually validate this in the portal: under **Configuration**, select **General Settings** and then ensure the **Platform** field is set to **64 Bit**. If you don't see this option in the portal, then it's possible you're already running on a 64-bit platform. For example, Linux apps won't show this setting because they only support 64-bit.
154+
155+
![Configure runtime to use 64 bit in the portal.](./media/quickstart-netherite/ensure-64bit-architecture.png)
156+
157+
## Deploy
158+
159+
You can now deploy your code to the cloud and run your tests or workload on it. To validate that Netherite is correctly configured, you can review the metrics for Event Hubs in the portal to ensure that there's activity.
160+
161+
> [!NOTE]
162+
> For guidance on deploying your project to Azure, review the deployment instructions in the article for your programming language of choice in the [prerequisites section](#prerequisites).
163+
164+
For more information about the Netherite architecture, configuration, and workload behavior, including performance benchmarks, we recommend you take a look at the [Netherite documentation](https://microsoft.github.io/durabletask-netherite/#/).

0 commit comments

Comments
 (0)