You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> This is *not* the latest Java SDK for Azure Cosmos DB! Consider using __[Java SDK v4](sql-api-sdk-java-v4-sql.md)__ for your project. Guidance on upgrading can be found __[here](https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/master/migration-guide.md)__ and __[here](https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/master/reactor-rxjava-guide.md)__.
23
+
> This is *not* the latest Java SDK for Azure Cosmos DB! Consider using [Java SDK v4](sql-api-sdk-java-v4-sql.md) for your project. Guidance on upgrading can be found [here](https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/master/migration-guide.md) and [here](https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/master/reactor-rxjava-guide.md).
24
24
>
25
25
> These performance tips are for Async Java SDK v2 only. Please view the Async Java SDK v2 __[Release notes](https://docs.microsoft.com/azure/cosmos-db/sql-api-sdk-async-java)__, __[Maven repository](https://mvnrepository.com/artifact/com.microsoft.azure/azure-cosmosdb)__ and __[troubleshooting guide](troubleshoot-java-async-sdk.md)__ for more information.
> These performance tips are for Java SDK v4 only. Please view the Java SDK v4 __[Release notes](sql-api-sdk-java-v4-sql.md)__, __[Maven repository](https://mvnrepository.com/artifact/com.azure/azure-cosmos)__ and __[troubleshooting guide](troubleshoot-java-sdk-v4-sql.md)__ for more information.
23
+
> These performance tips are for Azure Cosmos DB Java SDK v4 only. Please view the Azure Cosmos DB Java SDK v4 [Release notes](sql-api-sdk-java-v4-sql.md), [Maven repository](https://mvnrepository.com/artifact/com.azure/azure-cosmos) and [troubleshooting guide](troubleshoot-java-sdk-v4-sql.md) for more information.
24
24
>
25
25
26
-
Azure Cosmos DB is a fast and flexible distributed database that scales seamlessly with guaranteed latency and throughput. You do not have to make major architecture changes or write complex code to scale your database with Azure Cosmos DB. Scaling up and down is as easy as making a single API call or SDK method call. However, because Azure Cosmos DB is accessed via network calls there are client-side optimizations you can make to achieve peak performance when using the [SQL Java SDK v4](sql-api-sdk-async-java.md).
26
+
Azure Cosmos DB is a fast and flexible distributed database that scales seamlessly with guaranteed latency and throughput. You do not have to make major architecture changes or write complex code to scale your database with Azure Cosmos DB. Scaling up and down is as easy as making a single API call or SDK method call. However, because Azure Cosmos DB is accessed via network calls there are client-side optimizations you can make to achieve peak performance when using [Azure Cosmos DB Java SDK v4](sql-api-sdk-async-java.md).
27
27
28
28
So if you're asking "How can I improve my database performance?" consider the following options:
29
29
@@ -32,7 +32,7 @@ So if you're asking "How can I improve my database performance?" consider the fo
32
32
***Connection mode: Use Direct mode**
33
33
<aid="direct-connection"></a>
34
34
35
-
How a client connects to Azure Cosmos DB has important implications on performance, especially in terms of client-side latency. The *ConnectionMode* is a key configuration setting available for configuring the client *ConnectionPolicy*. For Java SDK v4, the two available *ConnectionMode*s are:
35
+
How a client connects to Azure Cosmos DB has important implications on performance, especially in terms of client-side latency. The *ConnectionMode* is a key configuration setting available for configuring the client *ConnectionPolicy*. For Azure Cosmos DB Java SDK v4, the two available *ConnectionMode*s are:
@@ -118,7 +118,7 @@ Please see the [Windows](https://docs.microsoft.com/azure/virtual-network/create
118
118
119
119
***Use Async API to max out provisioned throughput**
120
120
121
-
Java SDK v4 bundles two APIs, Sync and Async. Roughly speaking, the Async API implements SDK functionality, whereas the Sync API is a thin wrapper that makes blocking calls to the Async API. This stands in contrast to the older Async Java SDK v2, which was Async-only, and to the older Legacy Sync Java SDK v2, which was Sync-only and had a completely separate implementation.
121
+
Azure Cosmos DB Java SDK v4 bundles two APIs, Sync and Async. Roughly speaking, the Async API implements SDK functionality, whereas the Sync API is a thin wrapper that makes blocking calls to the Async API. This stands in contrast to the older Azure Cosmos DB Async Java SDK v2, which was Async-only, and to the older Azure Cosmos DB Sync Java SDK v2, which was Sync-only and had a completely separate implementation.
122
122
123
123
The choice of API is determined during client initialization; a *CosmosAsyncClient* supports Async API while a *CosmosClient* supports Sync API.
124
124
@@ -130,7 +130,7 @@ Please see the [Windows](https://docs.microsoft.com/azure/virtual-network/create
130
130
131
131
Geographic collocation can give you higher and more consistent throughput when using Sync API (see [Collocate clients in same Azure region for performance](#collocate-clients)) but still is not expected to exceed Async API attainable throughput.
132
132
133
-
Some users may also be unfamiliar with [Project Reactor](https://projectreactor.io/), the Reactive Streams framework used to implement Java SDK v4 Async API. If this is a concern, we recommend you read our introductory [Reactor Pattern Guide](https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/master/reactor-pattern-guide.md) and then take a look at this [Introduction to Reactive Programming](https://tech.io/playgrounds/929/reactive-programming-with-reactor-3/Intro) in order to familiarize yourself. If you have already used Azure Cosmos DB with an Async interface, and the SDK you used was Async Java SDK v2, then you may be familiar with [ReactiveX](http://reactivex.io/)/[RxJava](https://github.com/ReactiveX/RxJava) but be unsure what has changed in Project Reactor. In that case, please take a look at our [Reactor vs. RxJava Guide](https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/master/reactor-rxjava-guide.md) to become familiarized.
133
+
Some users may also be unfamiliar with [Project Reactor](https://projectreactor.io/), the Reactive Streams framework used to implement Azure Cosmos DB Java SDK v4 Async API. If this is a concern, we recommend you read our introductory [Reactor Pattern Guide](https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/master/reactor-pattern-guide.md) and then take a look at this [Introduction to Reactive Programming](https://tech.io/playgrounds/929/reactive-programming-with-reactor-3/Intro) in order to familiarize yourself. If you have already used Azure Cosmos DB with an Async interface, and the SDK you used was Azure Cosmos DB Async Java SDK v2, then you may be familiar with [ReactiveX](http://reactivex.io/)/[RxJava](https://github.com/ReactiveX/RxJava) but be unsure what has changed in Project Reactor. In that case, please take a look at our [Reactor vs. RxJava Guide](https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/master/reactor-rxjava-guide.md) to become familiarized.
134
134
135
135
The following code snippets show how to initialize your Azure Cosmos DB client for Async API or Sync API operation, respectively:
136
136
@@ -164,9 +164,9 @@ Please see the [Windows](https://docs.microsoft.com/azure/virtual-network/create
164
164
165
165
***TuningConnectionPolicy**
166
166
167
-
Bydefault, Direct mode CosmosDB requests are made over TCP when using JavaSDK v4. Internally the SDK uses a special Direct mode architecture to dynamically manage network resources and get the best performance.
167
+
Bydefault, Direct mode CosmosDB requests are made over TCP when using AzureCosmosDBJavaSDK v4. Internally the SDK uses a special Direct mode architecture to dynamically manage network resources and get the best performance.
168
168
169
-
InJavaSDK v4, Direct mode is the best choice to improve database performance with most workloads.
169
+
InAzureCosmosDBJavaSDK v4, Direct mode is the best choice to improve database performance with most workloads.
170
170
171
171
****Overview of Direct mode***
172
172
@@ -201,7 +201,7 @@ Please see the [Windows](https://docs.microsoft.com/azure/virtual-network/create
201
201
202
202
* **Tuning parallel queries for partitioned collections**
203
203
204
-
Azure Cosmos DB SQL Java SDK v4 supports parallel queries, which enable you to query a partitioned collection in parallel. For more information, see [code samples](https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples) related to working with Java SDK v4. Parallel queries are designed to improve query latency and throughput over their serial counterpart.
204
+
Azure Cosmos DB Java SDK v4 supports parallel queries, which enable you to query a partitioned collection in parallel. For more information, see [code samples](https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples) related to working with Azure Cosmos DB Java SDK v4. Parallel queries are designed to improve query latency and throughput over their serial counterpart.
205
205
206
206
* ***Tuning setMaxDegreeOfParallelism\:***
207
207
@@ -239,7 +239,7 @@ Please see the [Windows](https://docs.microsoft.com/azure/virtual-network/create
The asynchronous functionality of Java SDK is based on [netty](https://netty.io/) non-blocking IO. The SDK uses a fixed number of IO netty event loop threads (as many CPU cores your machine has) for executing IO operations. The Flux returned by API emits the result on one of the shared IO event loop netty threads. So it is important to not block the shared IO event loop netty threads. Doing CPU intensive work or blocking operation on the IO event loop netty thread may cause deadlock or significantly reduce SDK throughput.
242
+
The asynchronous functionality of Azure Cosmos DB Java SDK is based on [netty](https://netty.io/) non-blocking IO. The SDK uses a fixed number of IO netty event loop threads (as many CPU cores your machine has) for executing IO operations. The Flux returned by API emits the result on one of the shared IO event loop netty threads. So it is important to not block the shared IO event loop netty threads. Doing CPU intensive work or blocking operation on the IO event loop netty thread may cause deadlock or significantly reduce SDK throughput.
243
243
244
244
For example the following code executes a cpu intensive work on the event loop IO netty thread:
245
245
### <a id="java4-noscheduler"></a>Java SDK V4 (Maven com.azure::azure-cosmos) Async API
@@ -278,7 +278,7 @@ Please see the [Windows](https://docs.microsoft.com/azure/virtual-network/create
278
278
Based on the type of your work you should use the appropriate existing ReactorSchedulerfor your work. Read here
For more information on JavaSDK v4, please look at the [CosmosDB directory of the AzureSDKforJava monorepo on GitHub](https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/cosmos/azure-cosmos).
281
+
For more information on AzureCosmosDBJavaSDK v4, please look at the [CosmosDB directory of the AzureSDKforJava monorepo on GitHub](https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/cosmos/azure-cosmos).
282
282
283
283
***Optimize logging settings in your application**
0 commit comments