gremlin-console 中的计时查询

timing queries in gremlin-console

我正在尝试比较我在 gremlin-console 中查询的响应时间(图形数据库是 janusgraph,后端数据库是 hbase)。为此,有 "clock()" 步骤,可以 运行 多次查询和 return 平均响应时间。

但是正如文档中所述,有一个 "warm up" 阶段:

The warm up simply consists of running the query one time before timing starts. This means that for a single timing iteration, the human perceived time will be roughly double the time returned by the clock analysis.

由于预热阶段,遍历所需的所有图形始终在缓存中,这在现实世界中是不正确的。 例如,我正在处理的查询需要 6 分钟才能完成,因为要从 hbase 后端获取大量数据,但 clock() 步骤显示的执行时间为 10 秒,这只能在最佳情况下才是真实的.

是否有另一种更好的方法来使用 gremlin-console 获得我的查询的正确执行时间?

我认为你仍然可以使用 clock()。只需回滚执行之间的事务:

clock { g.V().iterate();g.tx().rollback() }