Closed LiJie20190102 closed 2 months ago
🤖
The Out Of Memory (OOM) exception you're experiencing when executing OLTP with a large amount of data using a String vertex ID type, but not with a Number vertex ID type, is likely due to the way String IDs are handled compared to Number IDs in Apache HugeGraph.
The SplicingIdGenerator
class in the HugeGraph codebase generates String IDs by concatenating various parts with specific separators and possibly escaping certain characters. This process can significantly increase the memory footprint when dealing with a large number of vertices, as each String ID consumes more memory than its numeric counterpart.
String IDs, especially when concatenated and escaped, are inherently larger and more complex than numeric IDs. They require more memory for storage and processing, which can lead to OOM exceptions under heavy load or with large datasets. The memory overhead comes from:
char[]
) used by String, which consumes more space than a simple numeric value.To resolve this issue, consider the following approaches:
-Xmx
and -Xms
parameters in the JVM startup arguments to allocate more heap space.It's important to profile and monitor the application to identify the exact cause of the OOM exception and to verify the effectiveness of the applied solutions.
For more details, you can refer to the SplicingIdGenerator
class in the HugeGraph codebase here.
After my testing, I found that there are indeed more map objects created. That is to say, when I use the String type, I create more map objects; But when I switched to the Number type, there were fewer map objects.
I encountered the above issue while executing 'AllShortestPath' (org.apache.hugegraph.api.traverser.AllShortestPathsAPI#get), params: capacity:1000000 degree:10000 skipDegree:0 direction:BOTH maxDepth:3
@imbajin
我的顶点id类型时string,但是顶点全是数值,当做string入库了,此时我执行oltp操作时,出现了oom,但是若顶点id类型改为Number时,此时不会出现oom。我看了之前的相应代码修改记录,之前是不是出现过类似问题,所以对数值类型单独处理:
不是很清楚你的具体诉求是什么? 考虑几个:
UUID
这种字符串, 也应该指定为专属的 UUID 类型, 会有专属的优化和定长计算也可以召唤 dosu-bot
获取一些更多的信息和上下文, @dosu-bot 请结合新的回复更新一下建议
Due to the lack of activity, the current issue is marked as stale and will be closed after 20 days, any update will remove the stale label
Bug Type (问题类型)
other exception / error (其他异常报错)
Before submit
Environment (环境信息)
Expected & Actual behavior (期望与实际表现)
我的顶点id类型时string,但是顶点全是数值,当做string入库了,此时我执行oltp操作时,出现了oom,但是若顶点id类型改为Number时,此时不会出现oom。我看了之前的相应代码修改记录,之前是不是出现过类似问题,所以对数值类型单独处理:https://github.com/apache/incubator-hugegraph/pull/1623#issuecomment-1971180435
Vertex/Edge example (问题点 / 边数据举例)
No response
Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)
No response