虽然我了解Bulking的原理,但我很想知道机器如何从您的编程角度实现这一目标。如何检测多个Traverser在同一节点上,以决定合并和批量处理它们。是否有描述用于检测特定情况需要批量处理的算法。
此外,触发批量的显式步骤是什么。是否可以在遍历中添加任何指令,以使大量操作显式地发生?
答案 0 :(得分:3)
膨胀通常与barrier()
步骤有关,在TinkerPop的参考文档here中进行了一些讨论。大多数人不会(尽管可以)在Gremlin写作中直接使用barrier()
,因为TinkerPop中内置了各种遍历策略(例如LazyBarrierStrategy
),试图将它们自动注入遍历的位置他们可能会有所作为。
通过遍历执行barrier()
,可以看到在哪里/何时插入explain()
步骤:
gremlin> g.V().out().both().explain()
==>Traversal Explanation
=======================================================================================================================================
Original Traversal [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(BOTH,vertex)]
ConnectiveStrategy [D] [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(BOTH,vertex)]
IncidentToAdjacentStrategy [O] [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(BOTH,vertex)]
MatchPredicateStrategy [O] [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(BOTH,vertex)]
RepeatUnrollStrategy [O] [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(BOTH,vertex)]
PathRetractionStrategy [O] [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(BOTH,vertex)]
FilterRankingStrategy [O] [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(BOTH,vertex)]
InlineFilterStrategy [O] [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(BOTH,vertex)]
AdjacentToIncidentStrategy [O] [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(BOTH,vertex)]
CountStrategy [O] [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(BOTH,vertex)]
LazyBarrierStrategy [O] [GraphStep(vertex,[]), VertexStep(OUT,vertex), NoOpBarrierStep(2500), VertexStep(BOTH,vertex)]
TinkerGraphCountStrategy [P] [GraphStep(vertex,[]), VertexStep(OUT,vertex), NoOpBarrierStep(2500), VertexStep(BOTH,vertex)]
TinkerGraphStepStrategy [P] [TinkerGraphStep(vertex,[]), VertexStep(OUT,vertex), NoOpBarrierStep(2500), VertexStep(BOTH,vertex)]
ProfileStrategy [F] [TinkerGraphStep(vertex,[]), VertexStep(OUT,vertex), NoOpBarrierStep(2500), VertexStep(BOTH,vertex)]
StandardVerificationStrategy [V] [TinkerGraphStep(vertex,[]), VertexStep(OUT,vertex), NoOpBarrierStep(2500), VertexStep(BOTH,vertex)]
Final Traversal [TinkerGraphStep(vertex,[]), VertexStep(OUT,vertex), NoOpBarrierStep(2500), VertexStep(BOTH,vertex)]
答案 1 :(得分:0)
在此,在上面@stephen评论之后,我只想分享一个博客的链接,其中一个博客深入解释了著名的LazyBarrierStrategy