I am using Aerospike 3.12.1.1 and Java 4 client.
Aerospike namespace is configured as in memory. My intention is to write 100 million integers to in memory single-bin namespace using 20 threads parallely, where each thread writes 5 million.
After writing around 75 million records, I am getting following exception at client side. The cold snippet is given below. Please help.
Exception in thread "pool-1-thread-15" com.aerospike.client.AerospikeException$InvalidNode: Error Code -3: Invalid node
at com.aerospike.client.cluster.Cluster.getRandomNode(Cluster.java:717)
at com.aerospike.client.command.Command.getSequenceNode(Command.java:1050)
at com.aerospike.client.command.Command.getNode(Command.java:1020)
at com.aerospike.client.command.SyncCommand.execute(SyncCommand.java:61)
at com.aerospike.client.AerospikeClient.put(AerospikeClient.java:360)
at Write.run(Write.java:50)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
import com.aerospike.client.AerospikeClient;
import com.aerospike.client.Host;
import com.aerospike.client.policy.ClientPolicy;
import com.aerospike.client.Bin;
import com.aerospike.client.Key;
import com.aerospike.client.Record;
import java.io.*;
public class Write implements Runnable{
int start;
int count;
int end;
private long unixTime;
private long timeTaken;
private long totalTimeTaken;
private long totalRequests;
private long minLatency;
private long maxLatency;
private double avgLatency;
private FileOutputStream out;
public Write(int s, int c){
this.start = s;
this.count = c;
this.end = this.count;
this.totalTimeTaken = 0;
this.totalRequests = 0;
this.minLatency = 1000000;
this.maxLatency = 0;
//try{
// this.out = new FileOutputStream("output.txt");
//}catch(Exception e){
//}
}
public void run(){
Host[] hosts = new Host[] {
new Host("127.0.0.1", 3000),
};
AerospikeClient client = new AerospikeClient(new ClientPolicy(), hosts);
for(int k=this.start; k<=(this.end); k++){
Key key = new Key("mem", null, k);
Bin bin1 = new Bin("m", k+count);
Bin bin2 = new Bin("n", k+count);
Bin bin3 = new Bin("b", k+count);
//Bin bin = Bin.asNull("b");
unixTime = System.nanoTime();
client.put(null, key, bin1, bin2, bin3);
timeTaken = System.nanoTime() - unixTime;
totalTimeTaken += timeTaken;
if(timeTaken < minLatency){
minLatency = timeTaken;
}
if(timeTaken > maxLatency){
maxLatency = timeTaken;
}
totalRequests ++;
}
avgLatency = totalTimeTaken / totalRequests;
System.out.println("TotalReqs:" + totalRequests + " TotalTime:" + totalTimeTaken + " MinLatency:" + ((float)minLatency/1000000.0) + " MaxLatency:" + ((float)maxLatency/1000000.0) + " AvgLatency:" + ((float)avgLatency/1000000.0));
}
}
What is the size of the memory defined for this namespace? Are you using the default hwm (60%) and default stop-write (90%) for this namespace? What is the RAM available on this node?