Getting apollo.model.save.dberror using Express Cassandra

319 views Asked by At

I am currently using Cassandra 3.11 having 3 node cluster & consistency of one, along with NodeJS express cassandra client 2.3.0. I am using the method saveAsync for storing the model data. But I am getting an error : apollo.model.save.dberror

Error during save query on DB -> NoHostAvailableError: All host(s) tried for query failed. \
  First host tried, <ip>:<port>: OperationTimedOutError: The host <ip>:<port> \
  did not reply before timeout 12000 ms.

I am unable to verify what is causing this error. This happens for most of the records & only few of them are getting through. I am inserting this data reading from a kafka topic & pushing it to cassandra after few validations. The data rate is around 200 per second.

Tried googling & searching in stack-overflow but unable to get any details around it. Sample code.

SomeData.insert = function (data) {
  data = transformData(data); // Basically cleans & normalizes the data to suit the model
  let any_data = new ExpressCassandra.instance.data_store(data);
  return any_data.saveAsync()
    .catch(function(err){
      return Promise.reject(err);
    });
};
1

There are 1 answers

0
Erick Ramirez On

The Node.js driver returns NoHostAvailableError after it has tried all hosts and none of them were available.

The OperationTimedOutError means that driver attempted to contact a node but never got a reply. This is a different error to a read or write timeout which is a response returned by the coordinator node.

OperationTimedOutError indicates that the nodes are unresponsive, usually because they are overloaded. You will need to review the logs and if you're seeing lots of GC activity and/or lots of dropped mutations/reads/messages then the nodes cannot keep up with the load and you need to consider increasing the capacity of your cluster by adding more nodes. Cheers!