【问题标题】:Gremlin server stops responding on stress test with a gremlin queryGremlin 服务器停止使用 gremlin 查询响应压力测试
【发布时间】:2017-09-20 16:57:00
【问题描述】:

我对这个 gremlin 查询做错了吗?这不是一个高性能查询吗?我在 AWS 上的 2 个 nodejs 实例使用 gremlin 客户端,该客户端通过 AWS ELB 通过 websockets 与 2 个 Titan 1.0/gremlin 服务器实例进行通信。后端是 DynamoDB。我们现在为 DynamoDB 配置了正确的读/写吞吐量。

日志:

WARN org.apache.tinkerpop.gremlin.server.op.AbstractEvalOpProcessor - 异常处理请求的脚本 [RequestMessage{, requestId=r1, op='eval', processor='', args={gremlin=

def user = gV().has("userId", userId1).has("tenantId", tenantId).hasLabel(userLabel).next();gV(user).outE(eIsOwnedByLabel).inV() .as('path').inE(eHasAccessToLabel).or(.has('shareToType',allType).outV().has('tenantId',tenantId).outE(eHasAccessToLabel), .has('shareToType',groupType).outV().hasLabel(groupLabel).inE(eIsMemberOfLabel,eIsAdminOfLabel).outV().has('userId',userId).outE(eIsMemberOfLabel,eIsAdminOfLabel).inV()。 outE(eHasAccessToLabel),__.has('shareToType',userType).outV().hasLabel(userLabel).has('userId',userId).outE(eHasAccessToLabel)).as('role').inV() .select('role','path').by('role').by('path');,

bindings={tenantId=1, userLabel=User, userId1=2, eIsOwnedByLabel=is_owned_by, eHasAccessToLabel=has_access_to, eIsMemberOfLabel=is_member_of, eIsAdminOfLabel=is_admin_of, userId=a1, groupLabel=Group, groupType=group, userType=user, allType=all},接受=应用程序/json,语言=gremlin-groovy}}]。 org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException

当我们进行压力测试时,gremlin 服务器停止响应并给我们这样的错误:

{"name":"logger","hostname":"a","pid":27881,"level":"ERROR","err":{"message":"null (Error 597)" ,"name":"Error","stack":"Error: null (Error 597)\n at GremlinClient.handleProtocolMessage (/opt/application/sharing-app/node_modules/gremlin/lib/GremlinClient.js:204:39 )\n 在 WebSocketGremlinConnection. (/opt/application/sharing-app/node_modules/gremlin/lib/GremlinClient.js:120:23)\n 在 emitOne (events.js:96:13)\n 在 WebSocketGremlinConnection.emit ( events.js:188:7)\n 在 WebSocketGremlinConnection.handleMessage (/opt/application/sharing-app/node_modules/gremlin/lib/WebSocketGremlinConnection.js:69:12)\n 在 WebSocketGremlinConnection._this.ws.onmessage (/ opt/application/sharing-app/node_modules/gremlin/lib/WebSocketGremlinConnection.js:46:20)\n

我尝试在本地运行 profile() g.V().has("userId", '1').has("tenantId", '2').hasLabel('User').outE('is_owned_by')....: ==>遍历指标

Step                                                               Count  Traversers       Time (ms)    % Dur
=============================================================================================================
TitanGraphStep([userId.eq(51ce1780-1998-47eb-a1...                     0           0         190.524    24.91
  optimization                                                                               176.456
  backend-query                                                        0                       6.074
  backend-query                                                        0                       5.067
TitanVertexStep(OUT,[is_owned_by],vertex)@[path]                       0           0           0.005     0.00
TitanVertexStep(IN,[has_access_to],edge)                               0           0         190.539    24.91
OrStep([[HasStep([shareToType.eq(all)]), Profil...                     0           0           0.012     0.00
  HasStep([shareToType.eq(all)])                                       0           0           0.000
  EdgeVertexStep(OUT)                                                  0           0           0.000
  HasStep([tenantId.eq(ndgThunderDome)])                               0           0           0.000
  TitanVertexStep(OUT,[has_access_to],edge)                            0           0           0.000
  HasStep([shareToType.eq(group)])                                     0           0           0.000
  EdgeVertexStep(OUT)                                                  0           0           0.000
  HasStep([~label.eq(Group)])                                          0           0           0.000
  TitanVertexStep(IN,[is_member_of, is_admin_of...                     0           0           0.000
  HasStep([userId.eq(a257c260-261f-45df-a1e7-92...                     0           0           0.000
  TitanVertexStep(OUT,[is_member_of, is_admin_o...                     0           0           0.000
  TitanVertexStep(OUT,[has_access_to],edge)                            0           0           0.000
  HasStep([shareToType.eq(user)])                                      0           0           0.000
  EdgeVertexStep(OUT)                                                  0           0           0.000
  HasStep([~label.eq(User)])                                           0           0           0.000
  HasStep([userId.eq(a257c260-261f-45df-a1e7-92...                     0           0           0.000
  TitanVertexStep(OUT,[has_access_to],edge)                            0           0           0.000
EdgeVertexStep(IN)                                                     0           0         190.550    24.91
SelectStep([role, path],[value(role), value(pat...                     0           0           0.021     0.00
SideEffectCapStep([~metrics])                                          1           1         193.286    25.27
                                            >TOTAL                     -           -         764.940        -

TIA

【问题讨论】:

  • 您的问题是关于 Gremlin Server 停止还是错误本身?服务器日志中的错误本身就是您在遍历没有返回数据时得到的错误。这一定发生在你的脚本中的某个地方。根据您的描述,很难说该错误是否与服务器未处理进一步请求有关。我的直觉说这两者可能没有关系。我认为您应该尝试调试一下 Gremlin 以消除该错误,从而将其作为与服务器挂起相关的问题删除。

标签: amazon-web-services titan gremlin gremlin-server


【解决方案1】:

脚本不是问题。 Titan Db 因请求而过载,并且脚本超时导致性能下降。更改 dynamodb.properties 以添加

cache.db-cache=true
cache.db-cache-time=...
cache.db-cache-size=0.3
cache.db-cache-clean-wait=50

添加缓存有助于减少 Db 上的负载并有助于增加每秒通过的请求数。

也更改了 gremlin-server.yaml: 线程池工作者 =2 不确定如何在具有 2 个 CPU 内核的 m4.large AWS 实例上根据 CPU 内核更改 threadPoolWorker。 也通过玩弄这些值来改变: 最大累积缓冲区组件:8192 resultIterationBatchSize:2048

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-02-06
    • 2019-07-24
    • 2015-07-28
    • 2016-08-28
    • 1970-01-01
    • 2017-09-05
    • 2016-09-15
    • 1970-01-01
    相关资源
    最近更新 更多