Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-1488

Make LazyBarrierStrategy part of the default TraversalStrategies

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.2.2
    • Fix Version/s: 3.2.3
    • Component/s: process
    • Labels:

      Description

      We have had LazyBarrierStrategy in TinkerPop since perhaps the 3.0 release. However, it was not part of the default strategies. Moreover, its a finalization strategy when it should be an OptimizationStrategy.

        Issue Links

          Activity

          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user asfgit closed the pull request at:

          https://github.com/apache/tinkerpop/pull/449

          Show
          githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/tinkerpop/pull/449
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user spmallette commented on the issue:

          https://github.com/apache/tinkerpop/pull/449

          All tests pass with `docker/build.sh -t -i`

          VOTE +1

          Show
          githubbot ASF GitHub Bot added a comment - Github user spmallette commented on the issue: https://github.com/apache/tinkerpop/pull/449 All tests pass with `docker/build.sh -t -i` VOTE +1
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user okram commented on the issue:

          https://github.com/apache/tinkerpop/pull/449

          @spmallette – good call. I added back `finalization.LazyBarrierStrategy` and @Deprecated it.

          Show
          githubbot ASF GitHub Bot added a comment - Github user okram commented on the issue: https://github.com/apache/tinkerpop/pull/449 @spmallette – good call. I added back `finalization.LazyBarrierStrategy` and @Deprecated it.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user twilmes commented on the issue:

          https://github.com/apache/tinkerpop/pull/449

          The code and tests look good to me. `mvn clean install` also ran without issue.

          VOTE: +1

          Show
          githubbot ASF GitHub Bot added a comment - Github user twilmes commented on the issue: https://github.com/apache/tinkerpop/pull/449 The code and tests look good to me. `mvn clean install` also ran without issue. VOTE: +1
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user spmallette commented on the issue:

          https://github.com/apache/tinkerpop/pull/449

          This is a breaking change in the sense as the package name changed. I doubt it should break most users, but a breaking change nonetheless. I think it would have been better to deprecate it where it was and copy/paste to the new package There would be two classes that did the same thing, but it would all happen without a break. Then we just delete the deprecated one for 3.3.0.

          Show
          githubbot ASF GitHub Bot added a comment - Github user spmallette commented on the issue: https://github.com/apache/tinkerpop/pull/449 This is a breaking change in the sense as the package name changed. I doubt it should break most users, but a breaking change nonetheless. I think it would have been better to deprecate it where it was and copy/paste to the new package There would be two classes that did the same thing, but it would all happen without a break. Then we just delete the deprecated one for 3.3.0.
          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user okram opened a pull request:

          https://github.com/apache/tinkerpop/pull/449

          TINKERPOP-1488: Make LazyBarrierStrategy part of the default TraversalStrategies

          https://issues.apache.org/jira/browse/TINKERPOP-1488

          `LazyBarrierStrategy` is now a default `OptimizationStrategy`. Rewrote `LazyBarrierStrategy` and with @dkuppitz's help, we were able to make all tested traversals either equal or faster than without `LazyBarrierStrategy`. This is a really cool optimization.

          ```
          gremlin> graph = TinkerGraph.open()
          ==>tinkergraph[vertices:0 edges:0]
          gremlin> graph.io(gryo()).readGraph('data/grateful-dead.kryo')
          ==>null
          gremlin>
          gremlin> g1 = graph.traversal().withoutStrategies(LazyBarrierStrategy.class)
          ==>graphtraversalsource[tinkergraph[vertices:808 edges:8049], standard]
          gremlin> g2 = graph.traversal()
          ==>graphtraversalsource[tinkergraph[vertices:808 edges:8049], standard]
          gremlin>
          gremlin> clock(10)

          {g1.V().out().in().out().count().iterate()}

          ==>1073.5150449999999
          gremlin> clock(10)

          {g2.V().out().in().out().count().iterate()}

          ==>8.8109061
          gremlin>
          gremlin> clock(100)

          {g1.V().out().out().count().iterate()}

          ==>18.75418462
          gremlin> clock(100)

          {g2.V().out().out().count().iterate()}

          ==>2.04183101
          gremlin>
          gremlin> clock(100)

          {g1.V().out().values('performances').count().iterate()}

          ==>1.67867484
          gremlin> clock(100)

          {g2.V().out().values('performances').count().iterate()}

          ==>1.4292696999999999
          gremlin>
          gremlin> clock(100)

          {g1.V().out().values('performances').is(gt(10)).iterate()}

          ==>1.76701077
          gremlin> clock(100)

          {g2.V().out().values('performances').is(gt(10)).iterate()}

          ==>1.47417542
          gremlin>
          gremlin> clock(100)

          {g1.V().has('name','Garcia').out().out().iterate()}

          ==>0.23742839999999998
          gremlin> clock(100)

          {g2.V().has('name','Garcia').out().out().iterate()}

          ==>0.24021971999999997
          gremlin>
          gremlin> clock(100)

          {g1.V().as('a').out('sungBy').in('sungBy').where(neq('a')).iterate()}

          ==>26.31896202
          gremlin> clock(100)

          {g2.V().as('a').out('sungBy').in('sungBy').where(neq('a')).iterate()}

          ==>21.811683509999998
          gremlin>
          gremlin> clock(100)

          {g1.V().has('name','DARK STAR').out('followedBy').aggregate('a').out('followedBy').in('followedBy').where(not(within('a'))).groupCount().by('name').iterate()}

          ==>24.6694559
          gremlin> clock(100)

          {g2.V().has('name','DARK STAR').out('followedBy').aggregate('a').out('followedBy').in('followedBy').where(not(within('a'))).groupCount().by('name').iterate()}

          ==>1.9376707899999999
          ```
          If this is VOTE'd in then, I will merge it after TINKERPOP-1455 is merged so we can do parameterization via `Configuration`.

          VOTE +1.

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/apache/tinkerpop TINKERPOP-1488

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/tinkerpop/pull/449.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #449


          commit 5f0e8438c92555b79e7387c10a9ce915b29c8840
          Author: Marko A. Rodriguez <okrammarko@gmail.com>
          Date: 2016-10-04T22:50:48Z

          LazyBarrierStrategy is now a default strategy and is smart about labels, retractions, flatMaps, barriers, etc. In short, all the queries that were given to it are either equal in speed or faster.

          commit 658630a9785952cada916377bb06283e9e85c6c4
          Author: Marko A. Rodriguez <okrammarko@gmail.com>
          Date: 2016-10-04T23:11:51Z

          ProfileTests and LazyBArrierStrategy don't play well with each other because ProfileTests expect certain bulks/counts/etc. Thus, if testing and there is ProfileStep, then the strategy is not applied.


          Show
          githubbot ASF GitHub Bot added a comment - GitHub user okram opened a pull request: https://github.com/apache/tinkerpop/pull/449 TINKERPOP-1488 : Make LazyBarrierStrategy part of the default TraversalStrategies https://issues.apache.org/jira/browse/TINKERPOP-1488 `LazyBarrierStrategy` is now a default `OptimizationStrategy`. Rewrote `LazyBarrierStrategy` and with @dkuppitz's help, we were able to make all tested traversals either equal or faster than without `LazyBarrierStrategy`. This is a really cool optimization. ``` gremlin> graph = TinkerGraph.open() ==>tinkergraph [vertices:0 edges:0] gremlin> graph.io(gryo()).readGraph('data/grateful-dead.kryo') ==>null gremlin> gremlin> g1 = graph.traversal().withoutStrategies(LazyBarrierStrategy.class) ==>graphtraversalsource[tinkergraph [vertices:808 edges:8049] , standard] gremlin> g2 = graph.traversal() ==>graphtraversalsource[tinkergraph [vertices:808 edges:8049] , standard] gremlin> gremlin> clock(10) {g1.V().out().in().out().count().iterate()} ==>1073.5150449999999 gremlin> clock(10) {g2.V().out().in().out().count().iterate()} ==>8.8109061 gremlin> gremlin> clock(100) {g1.V().out().out().count().iterate()} ==>18.75418462 gremlin> clock(100) {g2.V().out().out().count().iterate()} ==>2.04183101 gremlin> gremlin> clock(100) {g1.V().out().values('performances').count().iterate()} ==>1.67867484 gremlin> clock(100) {g2.V().out().values('performances').count().iterate()} ==>1.4292696999999999 gremlin> gremlin> clock(100) {g1.V().out().values('performances').is(gt(10)).iterate()} ==>1.76701077 gremlin> clock(100) {g2.V().out().values('performances').is(gt(10)).iterate()} ==>1.47417542 gremlin> gremlin> clock(100) {g1.V().has('name','Garcia').out().out().iterate()} ==>0.23742839999999998 gremlin> clock(100) {g2.V().has('name','Garcia').out().out().iterate()} ==>0.24021971999999997 gremlin> gremlin> clock(100) {g1.V().as('a').out('sungBy').in('sungBy').where(neq('a')).iterate()} ==>26.31896202 gremlin> clock(100) {g2.V().as('a').out('sungBy').in('sungBy').where(neq('a')).iterate()} ==>21.811683509999998 gremlin> gremlin> clock(100) {g1.V().has('name','DARK STAR').out('followedBy').aggregate('a').out('followedBy').in('followedBy').where(not(within('a'))).groupCount().by('name').iterate()} ==>24.6694559 gremlin> clock(100) {g2.V().has('name','DARK STAR').out('followedBy').aggregate('a').out('followedBy').in('followedBy').where(not(within('a'))).groupCount().by('name').iterate()} ==>1.9376707899999999 ``` If this is VOTE'd in then, I will merge it after TINKERPOP-1455 is merged so we can do parameterization via `Configuration`. VOTE +1. You can merge this pull request into a Git repository by running: $ git pull https://github.com/apache/tinkerpop TINKERPOP-1488 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/tinkerpop/pull/449.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #449 commit 5f0e8438c92555b79e7387c10a9ce915b29c8840 Author: Marko A. Rodriguez <okrammarko@gmail.com> Date: 2016-10-04T22:50:48Z LazyBarrierStrategy is now a default strategy and is smart about labels, retractions, flatMaps, barriers, etc. In short, all the queries that were given to it are either equal in speed or faster. commit 658630a9785952cada916377bb06283e9e85c6c4 Author: Marko A. Rodriguez <okrammarko@gmail.com> Date: 2016-10-04T23:11:51Z ProfileTests and LazyBArrierStrategy don't play well with each other because ProfileTests expect certain bulks/counts/etc. Thus, if testing and there is ProfileStep, then the strategy is not applied.

            People

            • Assignee:
              okram Marko A. Rodriguez
              Reporter:
              okram Marko A. Rodriguez
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development