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
Azure Managed Instance for Apache Cassandra provides automated deployment and scaling operations for managed open-source Apache Cassandra datacenters. This article provides tips on how to optimise performance
15
15
16
16
17
-
## Setting up Cassandra MI for best performance
17
+
## Optimal setup and configuration
18
18
19
-
### Replication factor, number of disks, and number of nodes, SKUs
19
+
### Replication factor, number of disks, number of nodes, and SKUs
20
20
21
-
Because Azure supports *three* availability zones in most regions, and Cassandra Managed Instance maps availability zones to racks, we recommend choosing a partition key with high cardinality to avoid hot partitions. For the best level of reliability and fault tolerance, we highly recommend configuring a replication factor of 3, and specifying a multiple of the replication factor as the number of nodes, e.g. 3, 6, 9, etc.
21
+
Because Azure supports *three* availability zones in most regions, and Cassandra Managed Instance maps availability zones to racks, we recommend choosing a partition key with high cardinality to avoid hot partitions. For the best level of reliability and fault tolerance, we highly recommend configuring a replication factor of 3. We also recommend specifying a multiple of the replication factor as the number of nodes, for example 3, 6, 9, etc.
22
22
23
23
24
-
We use a RAID 0 over the number of disks you provision. So to get the optimal IOPS you need to check for the maximum IOPS on the SKU you have chosen together with the IOPS of a P30 disk. For example a`Standard_DS14_v2` supports 51,200 uncached IOPS whereas a single P30 disk has a base performance of 5,000 IOPS. So, 4 disks would lead to 20,000 IOPS, which is well below the limits of the machine.
24
+
We use a RAID 0 over the number of disks you provision. So to get the optimal IOPS you need to check for the maximum IOPS on the SKU you have chosen together with the IOPS of a P30 disk. For example, the`Standard_DS14_v2`SKU supports 51,200 uncached IOPS, whereas a single P30 disk has a base performance of 5,000 IOPS. So, 4 disks would lead to 20,000 IOPS, which is well below the limits of the machine.
25
25
26
-
We strongly recommend extensive benchmarking of your worklaod against the SKU and number of disks, but this is especially important in the case of SKUs with only 8 cores. Our research shows that 8 core CPUs only work for the least demanding workloads, and most workloads need a minimum of 16 cores to be performant.
26
+
We strongly recommend extensive benchmarking of your worklaod against the SKU and number of disks. Benchmarking is especially important in the case of SKUs with only 8 cores. Our research shows that 8 core CPUs only work for the least demanding workloads, and most workloads need a minimum of 16 cores to be performant.
27
27
28
28
29
29
## Analytical vs. Transactional workloads
30
30
31
-
Transactional workloads typically need a data center optimized for low latency, while analytical workloads often use more complex queries which take longer to execute. In most cases you would want separate data centers:
31
+
Transactional workloads typically need a data center optimized for low latency, while analytical workloads often use more complex queries, which take longer to execute. In most cases you would want separate data centers:
32
32
33
33
* One optimized for low latency
34
34
* One optimized for analytical workloads
@@ -62,7 +62,7 @@ We recommend customers apply the following `cassandra.yaml` settings for analyti
62
62
| file_cache_size_in_mb | 2,048 |6,144 |
63
63
64
64
65
-
#### Additional recommendations
65
+
#### More recommendations
66
66
67
67
|Value |Cassandra MI Default |Recommendation for analytical workload |
@@ -73,12 +73,12 @@ We recommend customers apply the following `cassandra.yaml` settings for analyti
73
73
74
74
#### Client settings
75
75
76
-
We recommend to boost Cassandra client driver timeouts in accordance with the timeouts applied on the server in the Timeout section above.
76
+
We recommend boosting Cassandra client driver timeouts in accordance with the timeouts applied on the server.
77
77
78
78
79
79
### Optimizing for low latency
80
80
81
-
Our default settings are already suitable for low latency workloads. To ensure best performance for tail latencies we highly recommend using a client driver which supports [speculative execution](https://docs.datastax.com/en/developer/java-driver/4.10/manual/core/speculative_execution/) and configuring your client accordingly. For Java V4 driver, you can find a demo illustrating how this works and how to enable the policy [here](https://github.com/Azure-Samples/azure-cassandra-mi-java-v4-speculative-execution).
81
+
Our default settings are already suitable for low latency workloads. To ensure best performance for tail latencies we highly recommend using a client driver that supports [speculative execution](https://docs.datastax.com/en/developer/java-driver/4.10/manual/core/speculative_execution/) and configuring your client accordingly. For Java V4 driver, you can find a demo illustrating how this works and how to enable the policy [here](https://github.com/Azure-Samples/azure-cassandra-mi-java-v4-speculative-execution).
82
82
83
83
84
84
@@ -93,13 +93,13 @@ Like every database system, Cassandra works best if the CPU utilization is aroun
If the CPU is permanently above 80% for most nodes the database will become overloaded manifesting in multiple client timeouts. In this scenario, we recommend taking the following actions
96
+
If the CPU is permanently above 80% for most nodes the database will become overloaded manifesting in multiple client timeouts. In this scenario, we recommend taking the following actions:
97
97
98
-
* vertically scale up to a SKU with more CPU cores (especially if the cores are only 8 or less)
99
-
* horizontally scale by adding more nodes (*NOTE*: as above, this should be multiple of the replication factor)
98
+
* vertically scale up to a SKU with more CPU cores (especially if the cores are only 8 or less).
99
+
* horizontally scale by adding more nodes (as mentioned earlier, the number of nodes should be multiple of the replication factor).
100
100
101
101
102
-
If the CPU is only high for a small number of nodes but low for the others this indicates a hot partition and needs further investigation, e.g. by comparing the "load" in the datacenter screen of the Web UI to see if this node has more data then others.
102
+
If the CPU is only high for a small number of nodes, but low for the others, this indicates a hot partition and needs further investigation.
103
103
104
104
105
105
> [!NOTE]
@@ -123,21 +123,17 @@ The service runs on Azure P30 managed disks, which allow for "burst IOPS". This
123
123
124
124
:::image type="content" source="./media/best-practice-performance/metrics-disk.png" alt-text="Azure Monitor Insights disk I/O" lightbox="./media/best-practice-performance/metrics-disk.png" border="true":::
125
125
126
-
If metrics show one or all of the following:
126
+
If metrics show one or all of the following characteristics, it can indicate that you need to scale up.
127
127
128
-
- Consistently above or around the base IOPS (remember to multiply 5,000 IOPS by the number of disks per node to get the number).
129
-
- Consistently above or around the maximun IOPS allowed for the SKU for writes.
130
-
- Your SKU supports cached storage the number for reads in that column.
128
+
- Consistently higher than or equal to the base IOPS (remember to multiply 5,000 IOPS by the number of disks per node to get the number).
129
+
- Consistently higher than or equal to the maximum IOPS allowed for the SKU for writes.
130
+
- Your SKU supports cached storage for the number for reads in that column.
131
131
132
-
This can indicate that you need to scale up.
132
+
If you only see the IOPS elevated for a small number of nodes, you might have a hot partition and need to review your data for a potential skew.
133
133
134
+
If your IOPS are lower than what is supported by the chosen SKU, but above or around the disk IOPS, you can take the following actions:
134
135
135
-
If you only see the IOPS elevated for a small number of nodes you might have a hot partition and need to review your data for a potential skew.
136
-
137
-
138
-
If your IOPS are below what the chosen SKU supports but above or around the disk IOPS, you can
139
-
140
-
* Add more disks to increase performance. This requires a support case to be raised.
136
+
* Add more disks to increase performance. Increasing disks requires a support case to be raised.
141
137
*[Scale up the data center(s)](create-cluster-portal.md#scale-a-datacenter) by adding more nodes.
142
138
143
139
@@ -151,14 +147,13 @@ If your IOPS max out what your SKU supports, you can:
151
147
152
148
### Network performance
153
149
154
-
In most cases network performance is sufficient but if you are frequently streaming data (e.g. through frequent horizontal scale-up/scale down) or huge ingress/egress data movements this can become a problem and you need to evaluate the network performance of your SKU, e.g. a `Standard_DS14_v2` supports 12,000 Mb/s and compare it to the byte-in/out in the metrics:
150
+
In most cases network performance is sufficient, but if you are frequently streaming data (e.g. through frequent horizontal scale-up/scale down) or there are huge ingress/egress data movements, this can become a problem and you need to evaluate the network performance of your SKU. For example, the `Standard_DS14_v2`SKU supports 12,000 Mb/s, compare this to the byte-in/out in the metrics:
If you only see the network elevated for a small number of nodes you might have a hot partition and need to review your data for a potential skew.
161
-
156
+
If you only see the network elevated for a small number of nodes, you might have a hot partition and need to review your data distribution and/or access patterns for a potential skew.
162
157
163
158
* Vertically scale up to a different SKU supporting more network I/O.
164
159
* Horizontially scale up the cluster by adding more nodes.
@@ -174,10 +169,12 @@ Deployments should be planned and provisioned to support the maximum number of p
174
169
175
170
### Disk space
176
171
177
-
In most cases there is sufficient disk space as default deployments are optimized for IOPS. This often leads to low utilization of the disk. Nevertheless, we advise occasionally reviewing disk space metrics. Cassandra will accumulate a lot of disk and then reduce it when compaction is triggered. Hence it is important to review disk usage over longer periods to establish trends - e.g. compaction unable to recoup space.
172
+
In most cases, there is sufficient disk space as default deployments are optimized for IOPS, which leads to low utilization of the disk. Nevertheless, we advise occasionally reviewing disk space metrics. Cassandra accumulates a lot of disk and then reduces it when compaction is triggered. Hence it is important to review disk usage over longer periods to establish trends - like compaction unable to recoup space.
178
173
174
+
> [!NOTE]
175
+
> In order to ensure available space for compaction, disk utilization should be kept to less than 70%.
179
176
180
-
If you only see this behavior for a small number of nodes you might have a hot partition and need to review your data for a potential skew.
177
+
If you only see this behavior for a small number of nodes, you might have a hot partition and need to review your data distribution and/or access patterns for a potential skew.
181
178
182
179
183
180
* add more disks but be mindful of IOPS limits imposed by your SKU
@@ -187,9 +184,9 @@ If you only see this behavior for a small number of nodes you might have a hot p
187
184
188
185
### JVM memory
189
186
190
-
Our default formula assigns half the VM's memory to the JVM with an upper limit of 32 GB - which in most cases is a good balance between performance and memory. Some workloads, especially ones which have frequent cross-partition reads or range scans might be memory challenged.
187
+
Our default formula assigns half the VM's memory to the JVM with an upper limit of 31 GB - which in most cases is a good balance between performance and memory. Some workloads, especially ones which have frequent cross-partition reads or range scans might be memory challenged.
191
188
192
-
In most cases memory gets reclaimed very effectively by the Java garbage collector but especially if the CPU is often above 80% there aren't enough CPU cycles for the garbage collector left. So any CPU performance problems should be addresses before memory problems.
189
+
In most cases memory gets reclaimed very effectively by the Java garbage collector, but especially if the CPU is often above 80% there aren't enough CPU cycles for the garbage collector left. So any CPU performance problems should be addresses before memory problems.
193
190
194
191
If the CPU hovers below 70% and the garbage collection isn't able to reclaim memory, you might need more JVM memory, especially if you are on a SKU with very little memory. In most cases you will need to review your queries and client settings and reduce `fetch_size` along what is chosen in `limit` with your CQL query.
0 commit comments