Aerospike:写入单节点 Aerospike 时出现无效节点异常。
Aerospike: Invalid node exception when writing to single node Aerospike.
我正在使用 Aerospike 3.12.1.1 和 Java 4 客户端。
Aerospike 命名空间配置为在内存中。我的意图是使用 20 个并行线程将 1 亿个整数写入内存中的 single-bin 命名空间,其中每个线程写入 500 万个。
在写入大约 7500 万条记录后,我在客户端收到以下异常。下面给出了冷片段。请帮忙。
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));
}
}
为此命名空间定义的内存大小是多少?
您是否为此命名空间使用默认的 hwm (60%) 和默认的停止写入 (90%)?
此节点上可用的 RAM 是多少?
我正在使用 Aerospike 3.12.1.1 和 Java 4 客户端。
Aerospike 命名空间配置为在内存中。我的意图是使用 20 个并行线程将 1 亿个整数写入内存中的 single-bin 命名空间,其中每个线程写入 500 万个。
在写入大约 7500 万条记录后,我在客户端收到以下异常。下面给出了冷片段。请帮忙。
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));
}
}
为此命名空间定义的内存大小是多少? 您是否为此命名空间使用默认的 hwm (60%) 和默认的停止写入 (90%)? 此节点上可用的 RAM 是多少?