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

100并发时,耗时与每秒事务数表现较差

Open qingchengliu opened this issue 6 years ago • 3 comments

期望表现

  • 一度关联节点个数,在100+并发时times < 50ms, tps > 2000
  • 二度关联节点个数,在100+并发时times < 80ms, tps > 1000

数据量

  • loaded vertices amount: 5亿
  • loaded edges amount: 8亿

修改的配置项:

  • 服务端
    • rest-server.properties 新增 restserver.max_worker_threads=200
    • hugegraph-server.sh 修改 MAX_MEM=$((118 * 1024))
  • Java Client客户端
    • HugeClient client = new HugeClient(ip, "hugegraph", 40, 50, 25);

执行的Gremlin语句

  • 一度关联: g.V('User-%s').local(outE().hasLabel('DEV_REG','DEV_CREDIT', 'DEV_LOGON', 'DEV_REPAY', 'DEV_TRADE').has('modify_time', gt(%s)).limit(200)) .inV().dedup().count() 其中 %s 为参数,会使用String.format(tmp, uid, System.currentTimeMillis() - 31536000000L)填充 每次执行的结果 <= 10

  • 二度关联: g.V('User-%s').outE().hasLabel('DEV_REG', 'DEV_CREDIT', 'DEV_LOGON', 'DEV_REPAY', 'DEV_TRADE').has('modify_time', gt(%s)).inV().dedup().local(inE().has('modify_time', gt(%s)).limit(200)).outV().dedup().count()

  • 执行方式: 使用Java Client中的.gremlin().gremlin(sql).execute()

环境信息

  • hugegraph version: v0.10.4
  • operating system: 40 CPUs, 128G RAM 2台
  • hugegraph backend: hbase 12节点 8*960G SSD
  • hugegraph client: 2CPUs 4G RAM 10台

压测时各端负载

Hbase CPU负载: Hbase-CPU负载 Hbase IO负载: Hbase-IO负载 Hugegraph-Server 负载: Hugegraph-Server Hugegraph-Clinet 负载: Hugegraph-Clinet 负载 压测时Hugegraph-Server部分log: 压测时Hugegraph-Server部分log 100并发时压测结论: 压测结论数据

qingchengliu avatar Jul 30 '20 03:07 qingchengliu

@qingchengliu 如果使用gremlin进行高并发访问时,可以考虑预编译语句,通过bindings来绑定变量。

javeme avatar Aug 01 '20 17:08 javeme

@qingchengliu 如果使用gremlin进行高并发访问时,可以考虑预编译语句,通过bindings来绑定变量。

我使用bindings进行绑定变量后,发现单次查询仍不能降到50ms以内。 我在studio上通过profile()对gremlin语句进行分析后,发现耗时主要集中获取节点的边&对边进行筛选上。 我使用Kneighbour接口对节点进行一度查询时,时间可以在50ms以内,但该接口没办法传多个 label 以及没办法对边的属性进行筛选。 我发现Kneighbour接口调用的edgesOfVertex是直接生成Query对象,而edgesOfVertex若传入properties,则会去使用GraphTraversal,再转换为HugegraphStep来生成Query对象(未确定),不知耗时的差异是否与这有关。 请问是否有接口,支持我查询类似”A节点一年内关联的B节点个数”的功能,且该接口能达到1000tps以上、50ms以内,在我当前的数据量下(5亿节点、8亿关系)

gremlin profile

该Hbase集群对rowKey的一次读写平均耗时为1.8ms,但不知为何HugeGraphStep获取节点的耗时需要17ms+。

盼您解答!

qingchengliu avatar Aug 02 '20 05:08 qingchengliu

使用预编译语句后,似乎解决了大部分问题。

qingchengliu avatar Aug 07 '20 06:08 qingchengliu