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
Copy file name to clipboardExpand all lines: articles/cosmos-db/create-cassandra-nodejs.md
+70-36Lines changed: 70 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,9 +22,11 @@ In this quickstart, you create an Azure Cosmos DB Cassandra API account, and use
22
22
23
23
## Prerequisites
24
24
25
-
- An Azure account with an active subscription. [Create one for free](https://azure.microsoft.com/free/?ref=microsoft.com&utm_source=microsoft.com&utm_medium=docs&utm_campaign=visualstudio). Or [try Azure Cosmos DB for free](https://azure.microsoft.com/try/cosmosdb/) without an Azure subscription.
26
-
-[Node.js 0.10.29+](https://nodejs.org/).
27
-
-[Git](https://www.git-scm.com/downloads).
25
+
[!INCLUDE [quickstarts-free-trial-note](../../includes/quickstarts-free-trial-note.md)] Alternatively, you can [Try Azure Cosmos DB for free](https://azure.microsoft.com/try/cosmosdb/) without an Azure subscription, free of charge and commitments.
26
+
27
+
In addition, you need:
28
+
*[Node.js](https://nodejs.org/dist/v0.10.29/x64/node-v0.10.29-x64.msi) version v0.10.29 or higher
29
+
*[Git](https://git-scm.com/)
28
30
29
31
## Create a database account
30
32
@@ -104,42 +106,54 @@ This step is optional. If you're interested to learn how the code creates the da
104
106
* Key/value entities are inserted.
105
107
106
108
```javascript
107
-
...
108
-
{
109
-
query: 'INSERT INTO uprofile.user (user_id, user_name , user_bcity) VALUES (?,?,?)',
@@ -184,19 +198,41 @@ Now go back to the Azure portal to get your connection string information and co
184
198
185
199
3. Save `uprofile.js`.
186
200
201
+
> [!NOTE]
202
+
> If you experience a certificate related error in the later steps and are running on a Windows machine, ensure that you have followed the process for properly converting a .crt file into the Microsoft .cer format below.
203
+
>
204
+
> Double-click on the .crt file to open it into the certificate display.
205
+
>
206
+
>
207
+
>
208
+
> Press Next on the Certificate Wizard. Select Base-64 encoded X.509 (.CER), then Next.
209
+
>
210
+
>
211
+
>
212
+
> Select Browse (to locate a destination) and typein a filename.
213
+
> Select Next then Finished.
214
+
>
215
+
> You should now have a properly formatted .cer file. Ensure that the path in`uprofile.js` points to this file.
216
+
187
217
## Run the Node.js app
188
218
189
-
1. In the git terminal window, run `npm install` to install the required npm modules.
219
+
1. In the git terminal window, ensure you are in the sample directory you cloned earlier:
220
+
221
+
```bash
222
+
cd azure-cosmos-db-cassandra-nodejs-getting-started
223
+
```
224
+
225
+
2. Run `npm install` to install the required npm modules.
190
226
191
-
2. Run `node uprofile.js` to start your node application.
227
+
3. Run `node uprofile.js` to start your node application.
192
228
193
-
3. Verify the results as expected from the command line.
229
+
4. Verify the results as expected from the command line.
194
230
195
231

196
232
197
233
Press CTRL+C to stop execution of the program and close the console window.
198
234
199
-
4. In the Azure portal, open **Data Explorer** to query, modify, and work with this new data.
235
+
5. In the Azure portal, open **Data Explorer** to query, modify, and work with this new data.
200
236
201
237

202
238
@@ -213,6 +249,4 @@ Now go back to the Azure portal to get your connection string information and co
213
249
In this quickstart, you learned how to create an Azure Cosmos DB account with Cassandra API, and run a Cassandra Node.js app that creates a Cassandra database and container. You can now import additional data into your Azure Cosmos DB account.
214
250
215
251
> [!div class="nextstepaction"]
216
-
> [Import Cassandra data into Azure Cosmos DB](cassandra-import-data.md)
217
-
218
-
252
+
> [Import Cassandra data into Azure Cosmos DB](cassandra-import-data.md)
title: Elastically scale with Cassandra API in Azure Cosmos DB
3
+
description: Learn about the options available to scale an Azure Cosmos DB Cassandra API account and their advantages/disadvantages
4
+
author: TheovanKraay
5
+
ms.service: cosmos-db
6
+
ms.topic: conceptual
7
+
ms.date: 01/13/2020
8
+
ms.author: thvankra
9
+
---
10
+
11
+
# Elastically scale an Azure Cosmos DB Cassandra API account
12
+
13
+
There are a variety of options to explore the elastic nature of the Azure Cosmos DB's API for Cassandra. To understand how to scale effectively in Azure Cosmos DB, it is important to understand how to provision the right amount of request units (RU/s) to account for the performance demands in your system. To learn more about request units, see the [request units](request-units.md) article.
Azure Cosmos DB will return rate-limited (429) errors if clients consume more resources (RU/s) than the amount that you have provisioned. The Cassandra API in Azure Cosmos DB translates these exceptions to overloaded errors on the Cassandra native protocol.
20
+
21
+
If your system is not sensitive to latency, it may be sufficient to handle the throughput rate-limiting by using retries. See the [Java code sample](https://github.com/Azure-Samples/azure-cosmos-cassandra-java-retry-sample) for how to handle rate limiting transparently by using the [Azure Cosmos DB extension](https://github.com/Azure/azure-cosmos-cassandra-extensions) for [Cassandra retry policy](https://docs.datastax.com/drivers/java/2.0/com/datastax/driver/core/policies/RetryPolicy.html) in Java. You can also use the [Spark extension](https://mvnrepository.com/artifact/com.microsoft.azure.cosmosdb/azure-cosmos-cassandra-spark-helper) to handle rate-limiting.
22
+
23
+
## Manage scaling
24
+
25
+
If you need to minimize latency, there is a spectrum of options for managing scale and provisioning throughput (RUs) in the Cassandra API:
26
+
27
+
*[Manually by using the Azure portal](#use-azure-portal)
28
+
*[Programmatically by using the control plane features](#use-control-plane)
29
+
*[Programmatically by using CQL commands with a specific SDK](#use-cql-queries)
30
+
*[Dynamically by using Autopilot](#use-autopilot)
31
+
32
+
The following sections explain the advantages and disadvantages of each approach. You can then decide on the best strategy to balance the scaling needs of your system, the overall cost, and efficiency needs for your solution.
33
+
34
+
## <aid="use-azure-portal"></a>Use the Azure portal
35
+
36
+
You can scale the resources in Azure Cosmos DB Cassandra API account by using Azure portal. To learn more, see the article on [Provision throughput on containers and databases](set-throughput.md). This article explains the relative benefits of setting throughput at either [database](set-throughput.md#set-throughput-on-a-database) or [container](set-throughput.md#set-throughput-on-a-container) level in the Azure portal. The terms "database" and "container" mentioned in these articles map to "keyspace" and "table" respectively for the Cassandra API.
37
+
38
+
The advantage of this method is that it is a straightforward turnkey way to manage throughput capacity on the database. However, the disadvantage is that in many cases, your approach to scaling may require certain levels of automation to be both cost-effective and high performing. The next sections explain the relevant scenarios and methods.
39
+
40
+
## <aid="use-control-plane"></a>Use the control plane
41
+
42
+
The Azure Cosmos DB's API for Cassandra provides the capability to adjust throughput programmatically by using our various control-plane features. See the [Azure Resource Manager](manage-cassandra-with-resource-manager.md), [Powershell](powershell-samples-cassandra.md), and [Azure CLI](cli-samples-cassandra.md) articles for guidance and samples.
43
+
44
+
The advantage of this method is that you can automate the scaling up or down of resources based on a timer to account for peak activity, or periods of low activity. Take a look at our sample [here](https://github.com/Azure-Samples/azure-cosmos-throughput-scheduler) for how to accomplish this using Azure Functions and Powershell.
45
+
46
+
A disadvantage with this approach may be that you cannot respond to unpredictable changing scale needs in real-time. Instead, you may need to leverage the application context in your system, at the client/SDK level, or using [Autopilot](provision-throughput-autopilot.md).
47
+
48
+
## <aid="use-cql-queries"></a>Use CQL queries with a specific SDK
49
+
50
+
You can scale the system dynamically with code by executing the [CQL ALTER commands](cassandra-support.md#keyspace-and-table-options) for the given database or container.
51
+
52
+
The advantage of this approach is that it allows you to respond to scale needs dynamically and in a custom way that suits your application. With this approach, you can still leverage the standard RU/s charges and rates. If your system's scale needs are mostly predictable (around 70% or more), using SDK with CQL may be a more cost-effective method of auto-scaling than using Autopilot. The disadvantage of this approach is that it can be quite complex to implement retries while rate limiting may increase latency.
53
+
54
+
## <aid="use-autopilot"></a>Use Autopilot
55
+
56
+
In addition to manual or programmatic way of provisioning throughput, you can also configure Azure cosmos containers in Autopilot mode. Autopilot mode will automatically and instantly scale to your consumption needs within specified RU ranges without compromising SLAs. To learn more, see the [Create Azure Cosmos containers and databases in autopilot mode](provision-throughput-autopilot.md) article.
57
+
58
+
The advantage of this approach is that it is the easiest way to manage the scaling needs in your system. It guarantees not to apply rate-limiting **within the configured RU ranges**. The disadvantage is that, if the scaling needs in your system are predictable, Autopilot may be a less cost-effective way of handling your scaling needs than using the bespoke control plane or SDK level approaches mentioned above.
59
+
60
+
## Next steps
61
+
62
+
- Get started with [creating a Cassandra API account, database, and a table](create-cassandra-api-account-java.md) by using a Java application
0 commit comments