2017-04-24 88 views
0

我在這個gremlin查詢做錯了什麼?這不是一個高性能的查詢? AWS上的我的2個nodejs實例使用gremlin客戶端,該客戶端通過AWS ELB到2個Titan 1.0/gremlin服務器實例通過websockets進行通信。後端是DynamoDB。我們現在爲DynamoDB配置了正確的讀/寫吞吐量。Gremlin服務器停止響應壓力測試與gremlin查詢

日誌:

WARN org.apache.tinkerpop.gremlin.server.op.AbstractEvalOpProcessor - 異常上請求處理腳本[RequestMessage {,的requestId = R1,OP = '的eval',處理器= '', args = {gremlin =

def user = gV()。has(「userId」,userId1).has(「tenantId」,tenantId).hasLabel(userLabel).next(); gV(user).outE (eHasAccessToLabel)。或(.has('shareToType',allType).outV()。has('tenantId',tenantId).outE(eHasAccessToLabel), ('userId',userId).outE(eIs()).has('shareId',groupType).outV()。hasLabel(groupLabel).inE(eIsMemberOfLabel,eIsAdminOfLabel).outV MemberOfLabel,eIsAdminOfLabel).inV()。OUTE(eHasAccessToLabel),__。具有( 'shareToType',用戶類型).outV()。hasLabel(編號userLabel)。先後( '用戶id',用戶id).outE(eHasAccessToLabel))。如('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},accept = application/json,language =的gremlin-常規}}]。 org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException

當我們壓力測試時,小鬼服務器剛剛停止響應,併爲我們提供了這樣的錯誤:

{"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 at WebSocketGremlinConnection. (/opt/application/sharing-app/node_modules/gremlin/lib/GremlinClient.js:120:23)\n at emitOne (events.js:96:13)\n at WebSocketGremlinConnection.emit (events.js:188:7)\n at WebSocketGremlinConnection.handleMessage (/opt/application/sharing-app/node_modules/gremlin/lib/WebSocketGremlinConnection.js:69:12)\n at WebSocketGremlinConnection._this.ws.onmessage (/opt/application/sharing-app/node_modules/gremlin/lib/WebSocketGremlinConnection.js:46:20)\n

我試着運行()「hasIabel('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

+1

是您的問題關於Gremlin服務器停止或錯誤本身?來自服務器日誌的錯誤本身就是遍歷不返回數據時得到的錯誤。這一定發生在腳本的某處。根據你的描述,很難說這個錯誤是否與服務器沒有處理進一步的請求有關。我的直覺說這兩個可能沒有關係。我認爲你應該嘗試去調試你的Gremlin以擺脫那個錯誤,從而將它作爲一個與服務器掛起相關的問題去除。 –

回答

0

腳本不是問題。泰坦Db超負荷請求和性能退化腳本超時。更改dynamodb.properties添加

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

添加緩存有助於減少Db的負載,並有助於增加請求/秒流過。

更改小鬼-server.yaml太: threadPoolWorker = 2 不知道如何根據CPU內核上改變threadPoolWorker雖然我們與2個CPU核心m4.large AWS實例。 也改變玩弄值: maxAccumulationBufferComponents:8192 resultIterationBatchSize:2048