Redis
에 1 백만 (1,000,000)을 추가하면 정상입니다.
2 백만 (2,000,000) 레코드를 추가 할 때 Connection reset by peer: socket write error
오류가 발생합니다. 1 요소 (4294967295, 목록 당 요소의 이상 40 억) -Jedis lpush가 Redis에 백만 레코드 추가 - 피어로 연결 재설정 : 소켓 쓰기 오류
,
리스트의 최대 길이는 2 32이다.
/*Creating the json list*/
Gson gson = new GsonBuilder().create();
List<String> employeeList = new ArrayList<String>();
for (int i = 1; i <= 2000000; i++) {
Employee employee = new Employee(i + "", "Jhon", "My Country", "[email protected]", "+777 92157325");
String json = gson.toJson(employee);
employeeList.add(json);
}
/*add json list to Redis*/
Jedis jedis = pool.getResource();
// employeeList size is = 2,000,000
String[] jsonArray = employeeList.toArray(new String[employeeList.size()]);
jedis.lpush("employee_list_1", jsonArray);
로그인
Exception in thread "main" redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketException: Connection reset by peer: socket write error
at redis.clients.jedis.Protocol.sendCommand(Protocol.java:83)
at redis.clients.jedis.Protocol.sendCommand(Protocol.java:63)
at redis.clients.jedis.Connection.sendCommand(Connection.java:84)
at redis.clients.jedis.BinaryClient.lpush(BinaryClient.java:281)
at redis.clients.jedis.Client.lpush(Client.java:205)
at redis.clients.jedis.Jedis.lpush(Jedis.java:869)
at com.mutu.redis.AddJosn.add(AddJosn.java:29)
at com.mutu.redis.AddJosn.main(AddJosn.java:48)
Caused by: java.net.SocketException: Connection reset by peer: socket write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)
at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
at redis.clients.util.RedisOutputStream.flushBuffer(RedisOutputStream.java:31)
at redis.clients.util.RedisOutputStream.write(RedisOutputStream.java:54)
at redis.clients.util.RedisOutputStream.write(RedisOutputStream.java:44)
at redis.clients.jedis.Protocol.sendCommand(Protocol.java:79)
... 7 more
어떻게 하나의 트랜잭션/프로세스에 의해 두 개 이상의 백만 레코드를 추가하려면?
이것은 더 낮은 수준의 문제와 유사 해 보이는데, 이는 redis로 푸시되는 객체의 크기에 의해 생성됩니다. 그것은 jedis 구현에 달려 있습니다. 목록에있는 더 작은 객체로 테스트 할 수 있습니까? – Pixou