GremlinServer-gremlin语句提交时的异常

本文介绍了在使用JanusGraph与Gremlin过程中遇到的几种常见异常情况及其解决办法,包括调整maxContentLength和maxParameters配置以避免数据量过大导致的问题,以及如何处理gremlin脚本编译时的大小限制。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.  JanusGraph的client提交gremlin语句到tinkerpop server,如果数据量过大,会提示超过maxContentLength的异常

    异常信息:io.netty.handler.codec.CorruptedFrameException: Max frame length of 6553 has been exceeded.

    1.1) 注意:查询结果也受此配置大小的限制,如果配置的过小,查询数据也会报该异常 配置项位置:conf/gremlin-server/gremlin-server.yaml

    1.2) 注意:如果是在自己的gremlin客户端(直接执行bin/gremlin.sh)也报这个错误,需要配置remote.yml,也增加这个配置项:

connectionPool: { maxSize: 20, maxContentLength: 6553500 }

hosts: [127.0.0.1]
port: 8182
serializer: { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: false, custom: [org.janusgraph.graphdb.relations.RelationIdentifier,org.janusgraph.graphdb.database.management.JanusGraphIndexWrapper] }}
connectionPool: { maxSize: 20, maxContentLength: 6553500 }

2.  如果是参数化gremlin语句,参数过多,会提示超过maxParameters:的异常(参数默认为16个)

    异常信息:ResponseException : The [eval] message contains 41 bindings which is more than is allowed by the server 16 configuration

3. 把maxContentLength 和 maxParameters设置的很大,再次提交gremlin,会提示gremlin script class文件过大异常,原因是gremlin脚本会被编译成.class文件,而.class文件有大小限制

    3.1)注意:属性长度大小会影响maxContentLength,但不会影响gremlin script class文件大小,因为参数化gremlin以后,属性会以变量形式传入而不是直接把值传入class文件

     3.2)但是:属性的多少会影响gremlin script class的大小,所以,需要控制属性的多少

4. gremlin的语句再缩小(通过减少属性的数量来控制),会报java.util.concurrent.ExecutionException: org.apache.tinkerpop.gremlin.driver.exception.ResponseException: The Gremlin statement that was submitted exceed the maximum compilation size allowed by the JVM, please split it into multiple smaller statements 异常,原因是参数化gremlin语句在编译时有长度限制(但这个长度具体是多少,还没有用测试出来),再次缩小gremlin,就会提交成功了

总结:提交gremlin参数化语句时,参数map.size()有大小限制;提交的语句的大小有限制;gremlin编译为.class有限制

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值