我对这个gremlin查询做错了吗?这不是一个高性能的查询吗?我在AWS上的2个nodejs实例使用gremlin客户端,它通过AWS ELB与2个Titan 1.0 / gremlin服务器实例进行会话。后端是DynamoDB。我们现在为DynamoDB配置了正确的读/写吞吐量。
日志:
WARN org.apache.tinkerpop.gremlin.server.op.AbstractEvalOpProcessor - 根据请求处理脚本的异常[RequestMessage {,requestId = r1,op =' eval',processor ='& #39;,args = {gremlin =
def user = gV()。has(" userId",userId1).has(" tenantId",tenantId).hasLabel(userLabel).next(); gV(用户) ).outE(eIsOwnedByLabel).inV()作为('路径'。)INE(eHasAccessToLabel)。或者(的。先后(' shareToType',ALLTYPE).outV( )。先后(' tenantId',tenantId).outE(eHasAccessToLabel),。先后(' shareToType',groupType).outV()hasLabel(GROUPLABEL).inE (eIsMemberOfLabel,eIsAdminOfLabel).outV()具有('用户id',用户id).outE(eIsMemberOfLabel,eIsAdminOfLabel).inV()OUTE(eHasAccessToLabel),__具有(' shareToType&# 39;,用户类型).outV()hasLabel(编号userLabel)。先后('用户id',用户id).outE(eHasAccessToLabel))作为('作用'。)INV() 。选择('角色','路径')。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},accept = application / json,language = gremlin-groovy}}]。 org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException
当我们进行压力测试时,gremlin服务器只是停止响应并给出了这样的错误:
{"名称":"记录器""主机名":""" PID":27881 ,"等级":"错误","错误":{"消息":" null(错误597)&#34 ;,"名称":"错误","堆栈":"错误:null(错误597)\ n在GremlinClient.handleProtocolMessage(/ opt /在WebSocketGremlinConnection上的application / sharing-app / node_modules / gremlin / lib / GremlinClient.js:204:39)\ n。 (/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)中,在WebSocketGremlinConnection._this.ws.onmessage(/ opt / application / sharing-)应用程序/ node_modules /的gremlin / LIB / WebSocketGremlinConnection.js:46:20)\ n
我尝试在本地运行profile() gV()。有(" userId",' 1')。有(" tenantId",' 2')。hasLabel(&# 39;用户')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
答案 0 :(得分:0)
脚本不是问题。 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: threadPoolWorker = 2 不知道如何在具有2个CPU内核的m4.large AWS实例上更改基于CPU内核的threadPoolWorker。 也可以通过玩弄值来改变: maxAccumulationBufferComponents:8192 resultIterationBatchSize:2048