Skip to content

Commit 8d80735

Browse files
committed
applied suggested revisions
1 parent 0c184ef commit 8d80735

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

articles/cosmos-db/nosql/bulk-executor-dotnet.md

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ms.custom: devx-track-csharp, ignite-2022
1717
[!INCLUDE[NoSQL](../includes/appliesto-nosql.md)]
1818

1919
> [!NOTE]
20-
> The bulk executor library described in this article is maintained for applications using the .NET SDK 2.x version. For new applications, you can use the **bulk support** that's directly available with the [.NET SDK version 3.x](tutorial-dotnet-bulk-import.md), and it doesn't require any external library.
20+
> The bulk executor library described in this article is maintained for applications that use the .NET SDK 2.x version. For new applications, you can use the **bulk support** that's directly available with the [.NET SDK version 3.x](tutorial-dotnet-bulk-import.md), and it doesn't require any external library.
2121
2222
> If you currently use the bulk executor library and plan to migrate to bulk support on the newer SDK, use the steps in the [Migration guide](how-to-migrate-from-bulk-executor-library.md) to migrate your application.
2323
@@ -43,13 +43,13 @@ Now let's switch to working with code by downloading a sample .NET application f
4343
git clone https://github.com/Azure/azure-cosmosdb-bulkexecutor-dotnet-getting-started.git
4444
```
4545

46-
The cloned repository contains two samples, `BulkImportSample` and `BulkUpdateSample`. You can open either of the sample applications, update the connection strings in App.config file with your Azure Cosmos DB account's connection strings, build the solution, and run it.
46+
The cloned repository contains two samples, *BulkImportSample* and *BulkUpdateSample*. You can open either of the sample applications, update the connection strings in *App.config* file with your Azure Cosmos DB account's connection strings, build the solution, and run it.
4747

48-
The `BulkImportSample` application generates random documents and bulk imports them to your Azure Cosmos DB account. The `BulkUpdateSample` application bulk updates the imported documents by specifying patches as operations to perform on specific document fields. In the next sections, you'll review the code in each of these sample apps.
48+
The *BulkImportSample* application generates random documents and bulk imports them to your Azure Cosmos DB account. The *BulkUpdateSample* application bulk updates the imported documents by specifying patches as operations to perform on specific document fields. In the next sections, you'll review the code in each of these sample apps.
4949

5050
## <a id="bulk-import-data-to-an-azure-cosmos-account"></a>Bulk import data to an Azure Cosmos DB account
5151

52-
1. Navigate to the `BulkImportSample` folder and open the "BulkImportSample.sln" file.
52+
1. Navigate to the *BulkImportSample* folder and open the *BulkImportSample.sln* file.
5353

5454
1. The Azure Cosmos DB's connection strings are retrieved from the App.config file as shown in the following code:
5555

@@ -63,7 +63,7 @@ The `BulkImportSample` application generates random documents and bulk imports t
6363

6464
The bulk importer creates a new database and a container with the database name, container name, and the throughput values specified in the App.config file.
6565

66-
1. Next, the `DocumentClient` object is initialized with Direct TCP connection mode:
66+
1. Next, the *DocumentClient* object is initialized with Direct TCP connection mode:
6767

6868
```csharp
6969
ConnectionPolicy connectionPolicy = new ConnectionPolicy
@@ -75,7 +75,7 @@ The `BulkImportSample` application generates random documents and bulk imports t
7575
connectionPolicy)
7676
```
7777

78-
1. The `BulkExecutor` object is initialized with a high retry value for wait time and throttled requests. Then they're set to 0 to pass congestion control to `BulkExecutor` for its lifetime.
78+
1. The *BulkExecutor* object is initialized with a high retry value for wait time and throttled requests. Then they're set to 0 to pass congestion control to *BulkExecutor* for its lifetime.
7979

8080
```csharp
8181
// Set retry options high during initialization (default values).
@@ -90,7 +90,7 @@ The `BulkImportSample` application generates random documents and bulk imports t
9090
client.ConnectionPolicy.RetryOptions.MaxRetryAttemptsOnThrottledRequests = 0;
9191
```
9292

93-
1. The application invokes the `BulkImportAsync` API. The .NET library provides two overloads of the bulk import API&mdash;one that accepts a list of serialized JSON documents and the other that accepts a list of deserialized POCO documents. To learn more about the definitions of each of these overloaded methods, refer to the [API documentation](/dotnet/api/microsoft.azure.cosmosdb.bulkexecutor.bulkexecutor.bulkimportasync).
93+
1. The application invokes the *BulkImportAsync* API. The .NET library provides two overloads of the bulk import API&mdash;one that accepts a list of serialized JSON documents and the other that accepts a list of deserialized POCO documents. To learn more about the definitions of each of these overloaded methods, refer to the [API documentation](/dotnet/api/microsoft.azure.cosmosdb.bulkexecutor.bulkexecutor.bulkimportasync).
9494

9595
```csharp
9696
BulkImportResponse bulkImportResponse = await bulkExecutor.BulkImportAsync(
@@ -105,29 +105,29 @@ The `BulkImportSample` application generates random documents and bulk imports t
105105

106106
|**Parameter** |**Description** |
107107
|---------|---------|
108-
|enableUpsert | A flag to enable upsert operations on the documents. If a document with the given ID already exists, it's updated. By default, it's set to false. |
109-
|disableAutomaticIdGeneration | A flag to disable automatic generation of ID. By default, it's set to true. |
110-
|maxConcurrencyPerPartitionKeyRange | The maximum degree of concurrency per partition key range. Setting to null causes the library to use a default value of 20. |
111-
|maxInMemorySortingBatchSize | The maximum number of documents that are pulled from the document enumerator, which is passed to the API call in each stage. For the in-memory sorting phase that happens before bulk importing. Setting this parameter to null causes the library to use default minimum value (documents.count, 1000000). |
112-
|cancellationToken | The cancellation token to gracefully exit the bulk import operation. |
108+
|*enableUpsert* | A flag to enable upsert operations on the documents. If a document with the given ID already exists, it's updated. By default, it's set to false. |
109+
|*disableAutomaticIdGeneration* | A flag to disable automatic generation of ID. By default, it's set to true. |
110+
|*maxConcurrencyPerPartitionKeyRange* | The maximum degree of concurrency per partition key range. Setting to null causes the library to use a default value of 20. |
111+
|*maxInMemorySortingBatchSize* | The maximum number of documents that are pulled from the document enumerator, which is passed to the API call in each stage. For the in-memory sorting phase that happens before bulk importing. Setting this parameter to null causes the library to use default minimum value (documents.count, 1000000). |
112+
|*cancellationToken* | The cancellation token to gracefully exit the bulk import operation. |
113113

114-
**Bulk import response object definition**
115-
The result of the bulk import API call contains the following attributes:
114+
**Bulk import response object definition**<br>
115+
The result of the bulk import API call contains the following attributes:
116116

117117
|**Parameter** |**Description** |
118118
|---------|---------|
119-
|NumberOfDocumentsImported (long) | The total number of documents that were successfully imported out of the total documents supplied to the bulk import API call. |
120-
|TotalRequestUnitsConsumed (double) | The total request units (RU) consumed by the bulk import API call. |
121-
|TotalTimeTaken (TimeSpan) | The total time taken by the bulk import API call to complete the execution. |
122-
|BadInputDocuments (List\<object>) | The list of bad-format documents that weren't successfully imported in the bulk import API call. Fix the documents returned and retry import. Bad-formatted documents include documents whose ID value isn't a string (null or any other datatype is considered invalid). |
119+
|*NumberOfDocumentsImported* (long) | The total number of documents that were successfully imported out of the total documents supplied to the bulk import API call. |
120+
|*TotalRequestUnitsConsumed* (double) | The total request units (RU) consumed by the bulk import API call. |
121+
|*TotalTimeTaken* (TimeSpan) | The total time taken by the bulk import API call to complete the execution. |
122+
|*BadInputDocuments* (List\<object>) | The list of bad-format documents that weren't successfully imported in the bulk import API call. Fix the documents returned and retry import. Bad-formatted documents include documents whose ID value isn't a string (null or any other datatype is considered invalid). |
123123

124124
## Bulk update data in your Azure Cosmos DB account
125125

126-
You can update existing documents by using the `BulkUpdateAsync` API. In this example, you set the `Name` field to a new value and remove the `Description` field from the existing documents. For the full set of supported update operations, refer to the [API documentation](/dotnet/api/microsoft.azure.cosmosdb.bulkexecutor.bulkupdate).
126+
You can update existing documents by using the *BulkUpdateAsync* API. In this example, you set the `Name` field to a new value and remove the `Description` field from the existing documents. For the full set of supported update operations, refer to the [API documentation](/dotnet/api/microsoft.azure.cosmosdb.bulkexecutor.bulkupdate).
127127

128-
1. Navigate to the `BulkUpdateSample` folder and open the "BulkUpdateSample.sln" file.
128+
1. Navigate to the *BulkUpdateSample* folder and open the *BulkUpdateSample.sln* file.
129129

130-
1. Define the update items along with the corresponding field update operations. In this example, you use `SetUpdateOperation` to update the `Name` field and `UnsetUpdateOperation` to remove the `Description` field from all the documents. You can also perform other operations like incrementing a document field by a specific value, pushing specific values into an array field, or removing a specific value from an array field. To learn about different methods provided by the bulk update API, refer to the [API documentation](/dotnet/api/microsoft.azure.cosmosdb.bulkexecutor.bulkupdate).
130+
1. Define the update items along with the corresponding field update operations. In this example, you use *SetUpdateOperation* to update the `Name` field and *UnsetUpdateOperation* to remove the `Description` field from all the documents. You can also perform other operations like incrementing a document field by a specific value, pushing specific values into an array field, or removing a specific value from an array field. To learn about different methods provided by the bulk update API, refer to the [API documentation](/dotnet/api/microsoft.azure.cosmosdb.bulkexecutor.bulkupdate).
131131

132132
```csharp
133133
SetUpdateOperation<string> nameUpdate = new SetUpdateOperation<string>("Name", "UpdatedDoc");
@@ -144,7 +144,7 @@ You can update existing documents by using the `BulkUpdateAsync` API. In this ex
144144
}
145145
```
146146

147-
1. The application invokes the `BulkUpdateAsync` API. To learn about the definition of the `BulkUpdateAsync` method, refer to the [API documentation](/dotnet/api/microsoft.azure.cosmosdb.bulkexecutor.ibulkexecutor.bulkupdateasync).
147+
1. The application invokes the *BulkUpdateAsync* API. To learn about the definition of the *BulkUpdateAsync* method, refer to the [API documentation](/dotnet/api/microsoft.azure.cosmosdb.bulkexecutor.ibulkexecutor.bulkupdateasync).
148148

149149
```csharp
150150
BulkUpdateResponse bulkUpdateResponse = await bulkExecutor.BulkUpdateAsync(
@@ -157,26 +157,26 @@ You can update existing documents by using the `BulkUpdateAsync` API. In this ex
157157

158158
|**Parameter** |**Description** |
159159
|---------|---------|
160-
|maxConcurrencyPerPartitionKeyRange | The maximum degree of concurrency per partition key range. Setting this parameter to null makes the library use the default value(20). |
161-
|maxInMemorySortingBatchSize | The maximum number of update items pulled from the update items enumerator passed to the API call in each stage. For the in-memory sorting phase that happens before bulk updating. Setting this parameter to null causes the library use the default minimum value(updateItems.count, 1000000). |
162-
| cancellationToken|The cancellation token to gracefully exit the bulk update operation. |
160+
|*maxConcurrencyPerPartitionKeyRange* | The maximum degree of concurrency per partition key range. Setting this parameter to null makes the library use the default value(20). |
161+
|*maxInMemorySortingBatchSize* | The maximum number of update items pulled from the update items enumerator passed to the API call in each stage. For the in-memory sorting phase that happens before bulk updating. Setting this parameter to null causes the library use the default minimum value(updateItems.count, 1000000). |
162+
|*cancellationToken*|The cancellation token to gracefully exit the bulk update operation. |
163163

164-
**Bulk update response object definition**
165-
The result of the bulk update API call contains the following attributes:
164+
**Bulk update response object definition**<br>
165+
The result of the bulk update API call contains the following attributes:
166166

167167
|**Parameter** |**Description** |
168168
|---------|---------|
169-
|NumberOfDocumentsUpdated (long) | The number of documents that were successfully updated out of the total documents supplied to the bulk update API call. |
170-
|TotalRequestUnitsConsumed (double) | The total request units (RUs) consumed by the bulk update API call. |
171-
|TotalTimeTaken (TimeSpan) | The total time taken by the bulk update API call to complete the execution. |
169+
|*NumberOfDocumentsUpdated* (long) | The number of documents that were successfully updated out of the total documents supplied to the bulk update API call. |
170+
|*TotalRequestUnitsConsumed* (double) | The total request units (RUs) consumed by the bulk update API call. |
171+
|*TotalTimeTaken* (TimeSpan) | The total time taken by the bulk update API call to complete the execution. |
172172

173173
## Performance tips
174174

175175
Consider the following points for better performance when you use the bulk executor library:
176176

177177
* For best performance, run your application from an Azure virtual machine that's in the same region as your Azure Cosmos DB account's write region.
178178

179-
* It's recommended that you instantiate a single `BulkExecutor` object for the whole application within a single virtual machine that corresponds to a specific Azure Cosmos DB container.
179+
* It's recommended that you instantiate a single *BulkExecutor* object for the whole application within a single virtual machine that corresponds to a specific Azure Cosmos DB container.
180180

181181
* A single bulk operation API execution consumes a large chunk of the client machine's CPU and network IO when spawning multiple tasks internally. Avoid spawning multiple concurrent tasks within your application process that execute bulk operation API calls. If a single bulk operation API call that's running on a single virtual machine is unable to consume the entire container's throughput (if your container's throughput > 1 million RU/s), it's preferred to create separate virtual machines to concurrently execute the bulk operation API calls.
182182

@@ -188,7 +188,7 @@ Consider the following points for better performance when you use the bulk execu
188188
<gcServer enabled="true" />
189189
</runtime>
190190
```
191-
* The library emits traces that can be collected either into a log file or on the console. To enable both, add the following code to your application's App.Config file:
191+
* The library emits traces that can be collected either into a log file or on the console. To enable both, add the following code to your application's *App.Config* file:
192192

193193
```xml
194194
<system.diagnostics>

0 commit comments

Comments
 (0)