Skip to content

Commit b743c32

Browse files
author
Matias Quaranta
committed
Addressing comments
1 parent f792688 commit b743c32

File tree

3 files changed

+55
-50
lines changed

3 files changed

+55
-50
lines changed

articles/cosmos-db/TOC.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,8 +533,8 @@
533533
items:
534534
- name: Azure Cosmos DB Trigger logs
535535
href: how-to-configure-cosmos-db-trigger-logs.md
536-
name: Azure Cosmos DB Trigger connection mode
537-
href: how-to-configure-cosmos-db-trigger-connectionmode.md
536+
name: Azure Cosmos DB Trigger connection policy
537+
href: how-to-configure-cosmos-db-trigger-connectionpolicy.md
538538
- name: Multiple Azure Cosmos DB Triggers
539539
href: how-to-create-multiple-cosmos-db-triggers.md
540540
- name: Troubleshoot Azure Cosmos DB Triggers

articles/cosmos-db/how-to-configure-cosmos-db-trigger-connectionmode.md

Lines changed: 0 additions & 48 deletions
This file was deleted.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
title: Azure Cosmos DB Trigger connection policy
3+
description: Learn how to configure the connection policy used by Azure Cosmos DB Trigger
4+
author: ealsur
5+
ms.service: cosmos-db
6+
ms.topic: sample
7+
ms.date: 06/05/2019
8+
ms.author: maquaran
9+
---
10+
11+
# How to configure the connection policy used by Azure Cosmos DB Trigger
12+
13+
This article describes how you can configure the connection policy when using the Azure Cosmos DB Trigger to connect to your Azure Cosmos account.
14+
15+
## Why is the connection policy important?
16+
17+
There are two connection modes - Direct mode and Gateway mode. To learn more about these connection modes, see the [performance tips](./performance-tips.md#networking) article. By default, **Gateway** is used to establish all connections on the Azure Cosmos DB Trigger. However, it might not be the best option for performance-driven scenarios.
18+
19+
## Changing the connection mode and protocol
20+
21+
There are two key configuration settings available to configure the client connection policy – the **connection mode** and the **connection protocol**. You can change the default connection mode and protocol used by the Azure Cosmos DB Trigger and all the [Azure Cosmos DB bindings](../azure-functions/functions-bindings-cosmosdb-v2.md#output)). To change the default settings, you need to locate the `host.json` file in your Azure Functions project or Azure Functions App and add the following [extra setting](../azure-functions/functions-bindings-cosmosdb-v2.md#hostjson-settings):
22+
23+
```js
24+
{
25+
"cosmosDB": {
26+
"connectionMode": "Direct",
27+
"protocol": "Tcp"
28+
}
29+
}
30+
```
31+
32+
Where `connectionMode` must have the desired connection mode (Direct or Gateway) and `protocol` the desired connection protocol (Tcp or Https).
33+
34+
If your Azure Functions project is working with Azure Functions V1 runtime, the configuration has a slight name difference, you should use `documentDB` instead of `cosmosDB`:
35+
36+
```js
37+
{
38+
"documentDB": {
39+
"connectionMode": "Direct",
40+
"protocol": "Tcp"
41+
}
42+
}
43+
```
44+
45+
## A note on Consumption Plan
46+
47+
> Consumption Plan instances have a limit in the amount of Socket Connections that they can maintain. When working with Direct / TCP mode, by design more connections are created and can hit the [Consumption Plan limit](../azure-functions/manage-connections.md#connection-limit), in which case you can either use Gateway mode or run your Azure Functions in [App Service Mode](../azure-functions/functions-scale.md#app-service-plan).
48+
49+
## Next steps
50+
51+
* [Connection limits in Azure Functions](../azure-functions/manage-connections.md#connection-limit)
52+
* [Azure Cosmos DB performance tips](./performance-tips.md)
53+
* [Code samples](https://github.com/ealsur/serverless-recipes/tree/master/connectionmode)

0 commit comments

Comments
 (0)