导入数据过程中会出现Read timed out
在导入几百亿边的情况下,时不时会出现插入失败,出现read time out 想问下:
- 导入数据过程中,hugegraph是否会在某些情况下出现服务不可用,或者延迟突然变长这种情况
- 出现这种会不会导致这次导数据会漏掉数据
测试环境: server/loader:0.8.0 backend: rocksdb
报错调用栈
2019-04-02 04:14:11 239026174 [pool-3-thread-1] [ERROR] com.baidu.hugegraph.loader.task.TaskManager [] - Edge insert error
com.baidu.hugegraph.rest.ClientException: Failed to do request
at com.baidu.hugegraph.rest.RestClient.request(RestClient.java:69) ~[hugegraph-common-1.5.3.jar:1.5.3.0]
at com.baidu.hugegraph.rest.RestClient.post(RestClient.java:115) ~[hugegraph-common-1.5.3.jar:1.5.3.0]
at com.baidu.hugegraph.rest.RestClient.post(RestClient.java:79) ~[hugegraph-common-1.5.3.jar:1.5.3.0]
at com.baidu.hugegraph.rest.RestClient.post(RestClient.java:74) ~[hugegraph-common-1.5.3.jar:1.5.3.0]
at com.baidu.hugegraph.api.graph.EdgeAPI.create(EdgeAPI.java:49) ~[hugegraph-client-1.6.4.jar:1.6.4.0]
at com.baidu.hugegraph.driver.GraphManager.addEdge(GraphManager.java:167) ~[hugegraph-client-1.6.4.jar:1.6.4.0]
at com.baidu.hugegraph.loader.task.TaskManager.lambda$submitEdgesInSingleMode$1(TaskManager.java:236) ~[hugegraph-loader-0.8.0.jar:?]
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:108) [guava-19.0.jar:?]
at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:41) [guava-19.0.jar:?]
at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:77) [guava-19.0.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_151]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_151]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_151]
Caused by: javax.ws.rs.ProcessingException: java.net.SocketTimeoutException: Read timed out
at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:287) ~[jersey-client-2.25.1.jar:?]
at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:252) ~[jersey-client-2.25.1.jar:?]
at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:684) ~[jersey-client-2.25.1.jar:?]
at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:681) ~[jersey-client-2.25.1.jar:?]
at org.glassfish.jersey.internal.Errors.process(Errors.java:315) ~[jersey-common-2.25.1.jar:?]
at org.glassfish.jersey.internal.Errors.process(Errors.java:297) ~[jersey-common-2.25.1.jar:?]
at org.glassfish.jersey.internal.Errors.process(Errors.java:228) ~[jersey-common-2.25.1.jar:?]
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:444) ~[jersey-common-2.25.1.jar:?]
at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:681) ~[jersey-client-2.25.1.jar:?]
at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:437) ~[jersey-client-2.25.1.jar:?]
at org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:343) ~[jersey-client-2.25.1.jar:?]
at com.baidu.hugegraph.rest.RestClient.lambda$post$0(RestClient.java:116) ~[hugegraph-common-1.5.3.jar:1.5.3.0]
at com.baidu.hugegraph.rest.RestClient.request(RestClient.java:67) ~[hugegraph-common-1.5.3.jar:1.5.3.0]
... 12 more
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method) ~[?:1.8.0_151]
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) ~[?:1.8.0_151]
at java.net.SocketInputStream.read(SocketInputStream.java:171) ~[?:1.8.0_151]
at java.net.SocketInputStream.read(SocketInputStream.java:141) ~[?:1.8.0_151]
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246) ~[?:1.8.0_151]
at java.io.BufferedInputStream.read1(BufferedInputStream.java:286) ~[?:1.8.0_151]
at java.io.BufferedInputStream.read(BufferedInputStream.java:345) ~[?:1.8.0_151]
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:735) ~[?:1.8.0_151]
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678) ~[?:1.8.0_151]
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1587) ~[?:1.8.0_151]
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492) ~[?:1.8.0_151]
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480) ~[?:1.8.0_151]
at org.glassfish.jersey.client.internal.HttpUrlConnector._apply(HttpUrlConnector.java:399) ~[jersey-client-2.25.1.jar:?]
at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:285) ~[jersey-client-2.25.1.jar:?]
at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:252) ~[jersey-client-2.25.1.jar:?]
at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:684) ~[jersey-client-2.25.1.jar:?]
at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:681) ~[jersey-client-2.25.1.jar:?]
at org.glassfish.jersey.internal.Errors.process(Errors.java:315) ~[jersey-common-2.25.1.jar:?]
at org.glassfish.jersey.internal.Errors.process(Errors.java:297) ~[jersey-common-2.25.1.jar:?]
at org.glassfish.jersey.internal.Errors.process(Errors.java:228) ~[jersey-common-2.25.1.jar:?]
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:444) ~[jersey-common-2.25.1.jar:?]
at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:681) ~[jersey-client-2.25.1.jar:?]
at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:437) ~[jersey-client-2.25.1.jar:?]
at org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:343) ~[jersey-client-2.25.1.jar:?]
at com.baidu.hugegraph.rest.RestClient.lambda$post$0(RestClient.java:116) ~[hugegraph-common-1.5.3.jar:1.5.3.0]
at com.baidu.hugegraph.rest.RestClient.request(RestClient.java:67) ~[hugegraph-common-1.5.3.jar:1.5.3.0]
... 12 more
@llf2017
- 导入数据过程中,hugegraph是否会在某些情况下出现服务不可用,或者延迟突然变长这种情况
导入过程中,确实可能出现hugegraph的批量写入压力过大,出现插入缓慢、超时,甚至失败的情况,但是server应该还是可以响应读请求的。server端有一个配置项 batch.max_write_ratio=50 用于控制最大批量写线程占比,调大该值(推荐80或90)能够有更多的线程用于导入数据。
- 出现这种会不会导致这次导数据会漏掉数据
hugegraph-loader会将插入失败的数据记录到日志文件中,你可以查看日志重新导入该部分数据。
明白,谢谢了
server端有一个配置项 batch.max_write_ratio=50 ?? 配置在哪里。 server入边时,graph = HugeFactory.open('hugegraph.properties'),当 graph.close().再次打开graph时, 当执行: srcVertex.addEdge('label',dstVertex) 报错: Exception in thread "main" java.lang.IllegalStateException: Graph 'hugegraph[hugegraph_test_2019_04_11]' has been closed at com.google.common.base.Preconditions.checkState(Preconditions.java:199) at com.baidu.hugegraph.util.E.checkState(E.java:68) at com.baidu.hugegraph.HugeGraph.checkGraphNotClosed(HugeGraph.java:274) at com.baidu.hugegraph.HugeGraph.schemaTransaction(HugeGraph.java:293) at com.baidu.hugegraph.HugeGraph.edgeLabel(HugeGraph.java:429) at com.baidu.hugegraph.structure.HugeVertex.addEdge(HugeVertex.java:251) at com.baidu.hugegraph.structure.HugeVertex.addEdge(HugeVertex.java:60)
但是: grpah 处于打开状态 graph.schemaTransaction() 也是可以使用的
server端有一个配置项 batch.max_write_ratio=50 ?? 配置在哪里。
配置在rest-server.properties里面,代码在ServerOptions类里面。
server入边时,graph = HugeFactory.open('hugegraph.properties'),当 graph.close().再次打开graph时, 当执行: srcVertex.addEdge('label',dstVertex) 报错: Exception in thread "main" java.lang.IllegalStateException: Graph 'hugegraph[hugegraph_test_2019_04_11]' has been closed at com.google.common.base.Preconditions.checkState(Preconditions.java:199) at com.baidu.hugegraph.util.E.checkState(E.java:68) at com.baidu.hugegraph.HugeGraph.checkGraphNotClosed(HugeGraph.java:274) at com.baidu.hugegraph.HugeGraph.schemaTransaction(HugeGraph.java:293) at com.baidu.hugegraph.HugeGraph.edgeLabel(HugeGraph.java:429) at com.baidu.hugegraph.structure.HugeVertex.addEdge(HugeVertex.java:251) at com.baidu.hugegraph.structure.HugeVertex.addEdge(HugeVertex.java:60)
但是: grpah 处于打开状态 graph.schemaTransaction() 也是可以使用的
建议创建一个新的Issue,并且将问题以及复现步骤描述地清楚一点,谢谢。
@Linary 新版本rest-server.properties中没有 batch.max_write_ratio配置项呢
新版本rest-server.properties中没有 batch.max_write_ratio配置项呢
默认没有的话可以新增加一行配置即可,如:
batch.max_write_ratio=80
好的