incubator-hugegraph icon indicating copy to clipboard operation
incubator-hugegraph copied to clipboard

图用久了速度变慢

Open 306495389li opened this issue 6 years ago • 11 comments

Expected behavior 期望表现

希望可以查询速度一直快

Actual behavior 实际表现

变慢

Steps to reproduce the problem 复现步骤

jinfo {PID} sun.java.command = com.baidu.hugegraph.dist.HugeGraphServer /opt/hugegraph/hugegraph-0.10.2/conf/gremlin-server.yaml /opt/hugegraph/hugegraph-0.10.2/conf/rest-server.properties java.home = /opt/jdk8/jre user.language = en java.specification.vendor = Oracle Corporation awt.toolkit = sun.awt.X11.XToolkit java.vm.info = mixed mode java.version = 1.8.0_111 java.ext.dirs = /opt/jdk8/jre/lib/ext:/usr/java/packages/lib/ext sun.boot.class.path = /opt/jdk8/jre/lib/resources.jar:/opt/jdk8/jre/lib/rt.jar:/opt/jdk8/jre/lib/sunrsasign.jar:/opt/jdk8/jre/lib/jsse.jar:/opt/jdk8/jre/lib/jce.jar:/opt/jdk8/jre/lib/charsets.jar:/opt/jdk8/jre/lib/jfr.jar:/opt/jdk8/jre/classes java.vendor = Oracle Corporation file.separator = / java.vendor.url.bug = http://bugreport.sun.com/bugreport/ sun.io.unicode.encoding = UnicodeLittle sun.cpu.endian = little sun.cpu.isalist =

VM Flags: Non-default VM flags: -XX:CICompilerCount=4 -XX:InitialHeapSize=536870912 -XX:MaxHeapSize=11649679360 -XX:MaxNewSize=3882876928 -XX:MinHeapDeltaBytes=524288 -XX:NewSize=178782208 -XX:OldSize=358088704 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseFastUnorderedTimeStamps -XX:+UseParallelGC Command line: -Dname=HugeGraphServer -Dlog4j.configurationFile=/opt/hugegraph/hugegraph-0.10.2/conf/log4j2.xml -Djava.security.manager=com.baidu.hugegraph.security.HugeSecurityManager -Xms512m -Xmx11109m -javaagent:/opt/hugegraph/hugegraph-0.10.2/lib/jamm-0.3.0.jar

jmap -heap {PID} 11953 HugeGraphServer 22114 synctracking-0.0.1-SNAPSHOT.jar 30584 Jps 12446 HugeGraphStudio [root@QCSHVKMAD01 kcsy0001]# jmap -heap 11953 Attaching to process ID 11953, please wait... Debugger attached successfully. Server compiler detected. JVM version is 25.111-b14

using thread-local object allocation. Parallel GC with 8 thread(s)

Heap Configuration: MinHeapFreeRatio = 0 MaxHeapFreeRatio = 100 MaxHeapSize = 11649679360 (11110.0MB) NewSize = 178782208 (170.5MB) MaxNewSize = 3882876928 (3703.0MB) OldSize = 358088704 (341.5MB) NewRatio = 2 SurvivorRatio = 8 MetaspaceSize = 21807104 (20.796875MB) CompressedClassSpaceSize = 1073741824 (1024.0MB) MaxMetaspaceSize = 17592186044415 MB G1HeapRegionSize = 0 (0.0MB)

Heap Usage: PS Young Generation Eden Space: capacity = 487063552 (464.5MB) used = 473875128 (451.9225387573242MB) free = 13188424 (12.577461242675781MB) 97.29225807477378% used From Space: capacity = 70254592 (67.0MB) used = 0 (0.0MB) free = 70254592 (67.0MB) 0.0% used To Space: capacity = 84934656 (81.0MB) used = 0 (0.0MB) free = 84934656 (81.0MB) 0.0% used PS Old Generation capacity = 7766802432 (7407.0MB) used = 7766744984 (7406.945213317871MB) free = 57448 (0.05478668212890625MB) 99.99926033910991% used

jstat -gcutil 11953 1000 10 S0 S1 E O M CCS YGC YGCT FGC FGCT GCT
0.00 0.00 97.34 100.00 25.98 5.26 23878 1340.112 14031 65272.629 66612.742 0.00 0.00 97.34 100.00 25.98 5.26 23878 1340.112 14031 65272.629 66612.742 0.00 0.00 97.34 100.00 25.98 5.26 23878 1340.112 14031 65272.629 66612.742 0.00 0.00 97.34 100.00 25.98 5.26 23878 1340.112 14031 65272.629 66612.742 0.00 0.00 97.34 100.00 25.98 5.26 23878 1340.112 14031 65272.629 66612.742 0.00 0.00 97.34 100.00 25.98 5.26 23878 1340.112 14031 65272.629 66612.742 0.00 0.00 97.34 100.00 25.98 5.26 23878 1340.112 14031 65272.629 66612.742 0.00 0.00 100.00 100.00 25.98 5.26 23878 1340.112 14032 65272.629 66612.742

Status of loaded data 数据状态

Vertex/Edge summary 数据量

160W

Vertex/Edge example 数据示例

{type something here...}

Schema(VertexLabel, EdgeLabel, IndexLabel) 元数据结构

{type something here...}

Specifications of environment 环境信息

hugegraph version: 0.10.0 operating system: 32G内存 hugegraph backend: mysql

306495389li avatar Feb 20 '20 07:02 306495389li

@306495389li 看了下JVM大概有11G内存可用,FullGC压力很大,一次约5s时间。建议调整一下cache容量,比如设置到1w:

vertex.cache_capacity: 10000
edge.cache_capacity: 1000

另外,如果查询中有占用大量内存的语句,也可以优化一下。

javeme avatar Feb 20 '20 09:02 javeme

@javeme 这个配置是在hugegraph.properties里配的吗?目前文件里没这个属性,默认是多少

306495389li avatar Feb 21 '20 01:02 306495389li

@javeme 这个配置是在hugegraph.properties里配的吗?目前文件里没这个属性,默认是多少

你用的是0.10的版本么, 这个参数应该已经默认放配置文件了, 参考此

另外, 关于你full区满的问题, 除了把缓存配合调低之外, 你也可以考虑启动server时使用G1GC, 这样fullGC的次数通常也会少很多.

bin/start-hugegraph.sh -g g1

最后如果jvm内存没有异常, gc也正常, 但是仍然读写慢, 就需要进一步定位了

imbajin avatar Feb 21 '20 03:02 imbajin

@imbajin 我目前用的你们之前发给我的0.10.2,目前你们正是发布的是0.10.4,0.10.2是否可以使用这些配置,我们后台用的mysql,是否能升级到0.10.4

306495389li avatar Feb 21 '20 03:02 306495389li

@imbajin 我目前用的你们之前发给我的0.10.2,目前你们正是发布的是0.10.4,0.10.2是否可以使用这些配置,我们后台用的mysql,是否能升级到0.10.4

hugegraph.properties 的配置是可以直接用的, 只是之前的模板没有更新 然后G1GC你确定自己版本的脚本里如果没有的话, 你参考这两行手动添加到你自己的jvm参数中就行了, 也不用升级

imbajin avatar Feb 21 '20 06:02 imbajin

@javeme @imbajin 上周按照这么重启了,今天日志中很多The server available memory 98(MB) is below than threshold 100(MB) and can't process the request, you can config restserver.min_free_memory to adjust it or try again later

306495389li avatar Mar 05 '20 08:03 306495389li

@javeme @imbajin 上周按照这么重启了,今天日志中很多The server available memory 98(MB) is below than threshold 100(MB) and can't process the request, you can config restserver.min_free_memory to adjust it or try again later

首先你堆内存配的多少, 是合理值的么 其次如果你已经把点边的缓存值设置很小了, 你gcutil和jmap看看当前堆内存被谁用了呗, 或者old区是不是又快满了. gc时间是否正常之类的.

然后定位下, 或者贴一下结果. 如果这个问题容易复现, 你也可以重启观察一下, 看看什么操作会导致内存使用明显攀升且不能释放

imbajin avatar Mar 05 '20 15:03 imbajin

@javeme @imbajin 图的堆内存在哪里配置,现在是服务器还剩10G左右,就会爆出The server available memory 98(MB) is below than threshold 100(MB) and can't process the request, you can config restserver.min_free_memory to adjust it or try again later

306495389li avatar Mar 07 '20 06:03 306495389li

@306495389li 如果你确定服务器内存可用,可以多分配一些给JVM,具体方法是设置XMX为固定的值,单位是MB:

# 在文件 bin/hugegraph-server.sh 的第92行左右
XMX=20000

javeme avatar Mar 08 '20 07:03 javeme

mysql作为存储引擎的话会有性能问题吗?mysql支持的最大数据量能有多少?

captain-guo avatar Sep 04 '20 11:09 captain-guo

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

github-actions[bot] avatar Sep 04 '21 21:09 github-actions[bot]