Skip to content

Commit b35033f

Browse files
author
Theo van Kraay
committed
acrolinx
1 parent 57dc92f commit b35033f

File tree

1 file changed

+28
-31
lines changed

1 file changed

+28
-31
lines changed

articles/managed-instance-apache-cassandra/best-practice-performance.md

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,21 @@ keywords: azure performance cassandra
1414
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
1515

1616

17-
## Setting up Cassandra MI for best performance
17+
## Optimal setup and configuration
1818

19-
### Replication factor, number of disks, and number of nodes, SKUs
19+
### Replication factor, number of disks, number of nodes, and SKUs
2020

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.
2222

2323

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.
2525

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.
2727

2828

2929
## Analytical vs. Transactional workloads
3030

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:
3232

3333
* One optimized for low latency
3434
* One optimized for analytical workloads
@@ -62,7 +62,7 @@ We recommend customers apply the following `cassandra.yaml` settings for analyti
6262
| file_cache_size_in_mb            | 2,048                  |6,144 |
6363

6464

65-
#### Additional recommendations
65+
#### More recommendations
6666

6767
|Value                             |Cassandra MI Default    |Recommendation for analytical workload |
6868
|----------------------------------|------------------------|---------------------------------------|
@@ -73,12 +73,12 @@ We recommend customers apply the following `cassandra.yaml` settings for analyti
7373

7474
#### Client settings
7575

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.
7777

7878

7979
### Optimizing for low latency
8080

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).
8282

8383

8484

@@ -93,13 +93,13 @@ Like every database system, Cassandra works best if the CPU utilization is aroun
9393
:::image type="content" source="./media/best-practice-performance/metrics.png" alt-text="Azure Monitor Insights CPU" lightbox="./media/best-practice-performance/metrics.png" border="true":::
9494

9595

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
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:
9797

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).
100100

101101

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.
103103

104104

105105
> [!NOTE]
@@ -123,21 +123,17 @@ The service runs on Azure P30 managed disks, which allow for "burst IOPS". This
123123

124124
:::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":::
125125

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.
127127

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.
131131

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.
133133

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:
134135

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.
141137
* [Scale up the data center(s)](create-cluster-portal.md#scale-a-datacenter) by adding more nodes.
142138

143139

@@ -151,14 +147,13 @@ If your IOPS max out what your SKU supports, you can:
151147

152148
### Network performance
153149

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:
155151

156152

157153
:::image type="content" source="./media/best-practice-performance/metrics-network.png" alt-text="Azure Monitor Insights network" lightbox="./media/best-practice-performance/metrics-network.png" border="true":::
158154

159155

160-
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.
162157

163158
* Vertically scale up to a different SKU supporting more network I/O.
164159
* 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
174169

175170
### Disk space
176171

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.
178173

174+
> [!NOTE]
175+
> In order to ensure available space for compaction, disk utilization should be kept to less than 70%.
179176
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.
181178

182179

183180
* 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
187184

188185
### JVM memory
189186

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.
191188

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.
193190

194191
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.
195192

0 commit comments

Comments
 (0)