Problem:

The client encountered a Cassandra exception: “WriteTimeoutException: Cassandra timeout during SIMPLE write query at consistency QUORUM.” The issue had started recently and involved an INSERT INTO query. They sought troubleshooting assistance, as this exception had not occurred before.

Process:

Step 1 – Initial Investigation and Troubleshooting:

The expert team initiated the investigation by requesting technical details about the Cassandra cluster and the exception. The collected information included:

Infrastructure:

  • Memory-optimized cloud VMs
  • Premium SSD disks for the data and commit log directories

Compactions:

  • Pending tasks: none on all nodes
  • System load average: low on all nodes (around 1 on production nodes and close to 0 on DR nodes)

Metric:

  • Data disk IOPS consumed percentage

Cluster Nodes:

  • Two data centers (production and DR) with three nodes each
  • Status: all nodes UP, 100% ownership

Replication:

  • {‘DC1’: ‘3’, ‘DC2’: ‘3’}

Solution:

After investigating the issue, the expert team concluded that a replication factor of 3 was excessive for the 3-node cluster. They recommended adjusting the keyspace attributes to use 2x replicas for each location.

The issue pertained solely to WRITE timeouts. It was determined that some queries attempted to read data from the affected tables while data was being inserted into them. An internal search tool loaded data when users performed searches in the UI, and this load combined with the inserts caused the problem. The queries did not utilize primary keys or indexed columns.

As a preventive measure, the application team was advised to use the tool with filter criteria based on key fields and a date range.

Conclusion:

After investigating, the experts found that the WriteTimeoutException in Cassandra was caused by excessive replication settings for a 3-node cluster. They recommended adjusting the keyspace to use 2x replicas per location. The issue arose from inefficient queries without primary keys or indexed columns on the affected tables. To prevent future incidents, the application team was advised to use the search tool with specific filter criteria based on key fields and date ranges.