title: How to resolve write timeout exception in cassandra?
body: <p>I'm trying to insert 50000 records into a five node cassandra cluster. I'm using <strong>executeAsync</strong> so as to increase the performance(reduce insertion time from Application side). I tried Batchstatement with several batch sizes, but everytime I got the following exception.</p>
  
  <pre><code>Exception in thread "main" com.datastax.driver.core.exceptions.WriteTimeoutException: Cassandra timeout during write query at consistency ONE (1 replica were required but only 0 acknowledged the write)
  at com.datastax.driver.core.exceptions.WriteTimeoutException.copy(WriteTimeoutException.java:54)
  at com.datastax.driver.core.DefaultResultSetFuture.extractCauseFromExecutionException(DefaultResultSetFuture.java:259)
  at com.datastax.driver.core.DefaultResultSetFuture.getUninterruptibly(DefaultResultSetFuture.java:175)
  at 
  </code></pre>
  
  <p>I inserted data i.e. 10000,20000 upto 40000 records without any issue. The following is the java code I wrote.</p>
  
  <pre><code>for (batchNumber = 1; batchNumber &lt;= batches; batchNumber++) {
      BatchStatement batch = new BatchStatement();
      for (record = 1; record &lt;= batchSize; record++) {
          batch.add(ps.bind(query));
      }
      futures.add(session.executeAsync(batch));           
  }
  for (ResultSetFuture future : futures) {
      resultSet = future.getUninterruptibly();
  }
  </code></pre>
  
  <p>where ps is the prepared statement, batches is number of batches, and batchSize is the number of records in a batch. </p>
  
  <p>I'm unable to understand the root cause of the issue. I thought that some of the nodes were down and when I checked all are running normally. </p>
  
  <p>How should I debug the exception?</p>