Git Product home page Git Product logo

Comments (9)

dominique-vassard avatar dominique-vassard commented on May 26, 2024 2

Hello,
your query and how you execute it is fine.
And unfortunately yes, there is quite a big overhead from BoltSips.
We will investigate to understand where this comes from and fix it. It can take some time as it can deeply impact the internals of bolt sips.

A quick workaround for your problem is to narrow your query to only what you need, i.e instead of
MATCH (p:Place) RETURN p AS place, you can use MATCH (p:Place) RETURN p.name.
This way, instead of retrieving something like this:

Bolt.Sips.Response{
  bookmark: "neo4j:bookmark:v1:tx4",
  fields: ["p"],
  notifications: [],
  plan: nil,
  profile: nil,
  records: [
    [
      %Bolt.Sips.Types.Node{
        id: 0,
        labels: ["Place"],
        properties: %{"name" => "place_1"}
      }
    ],
    [
      %Bolt.Sips.Types.Node{
        id: 1,
        labels: ["Place"],
        properties: %{"name" => "place_2"}
      }
    ]
  ],
  results: [
    %{
      "p" => %Bolt.Sips.Types.Node{
        id: 0,
        labels: ["Place"],
        properties: %{"name" => "place_1"}
      }
    },
    %{
      "p" => %Bolt.Sips.Types.Node{
        id: 1,
        labels: ["Place"],
        properties: %{"name" => "place_2"}
      }
    }
  ],
  stats: [],
  type: "r"
}

you retrieve something like this:

%Bolt.Sips.Response{
  bookmark: "neo4j:bookmark:v1:tx4",
  fields: ["p.name"],
  notifications: [],
  plan: nil,
  profile: nil,
  records: [["place_1"], ["place_2"]],
  results: [%{"p.name" => "place_1"}, %{"p.name" => "place_2"}],
  stats: [],
  type: "r"
}

And query time will be divied by 3...

from bolt_sips.

dominique-vassard avatar dominique-vassard commented on May 26, 2024 2

Ok, found something with Code.ensure_loaded called too many times....

The test runs on 1000 nodes.

First, it was

Name           ips        average  deviation         median         99th %
run          0.152         6.59 s     ±1.41%         6.62 s         6.66 s

After change, it becames:

Name           ips        average  deviation         median         99th %
run           8.53      117.28 ms     ±5.42%      116.77 ms      140.41 ms

And if logs are disabled, it is:

Name           ips        average  deviation         median         99th %
run          32.82       30.47 ms     ±4.95%       30.20 ms       35.21 ms

It's a little bit faster ;)

I've just have to check one other thing and then I'll commit.

from bolt_sips.

florinpatrascu avatar florinpatrascu commented on May 26, 2024 2

W⦿‿⦿t!

We’ll have the 2.0 release this week ❤️

from bolt_sips.

marcosmko avatar marcosmko commented on May 26, 2024 1

Hello all! I was on a trip last week so I didn't have time to answer 😆

I have just tested here, and it's f***** awesome!
Testing with 100 nodes, it became from 1s to 50ms.

Thanks all for your hard work!
I hope that I can contribute in the future, as I am still learning elixir 😍

@dominique-vassard Okay, thank you! I will see and try it 😄

from bolt_sips.

marcosmko avatar marcosmko commented on May 26, 2024

Hmm okay, thanks!

I will try your suggestions, and if I have some time, I will try to investigate where is the bottleneck (although I'm just an amateur in elixir).

Cheers.

from bolt_sips.

dominique-vassard avatar dominique-vassard commented on May 26, 2024

Just a quick ad: @marcosmko if you're using Ecto, https://github.com/dominique-vassard/ecto_neo4j may interest you.
Current available version on hex is crap but as soon as bolt_sips 2.0 is available, the new nice version will be released :)

from bolt_sips.

florinpatrascu avatar florinpatrascu commented on May 26, 2024

(if we have travis fixed and passing, then we'll push 2.0 tonight :) )

from bolt_sips.

florinpatrascu avatar florinpatrascu commented on May 26, 2024

and we're 2.0.2 =)

https://hexdocs.pm/bolt_sips/getting-started.html#content

Thank you all for your patience, feedback and code contributions!

You're awesome!
❤️

from bolt_sips.

florinpatrascu avatar florinpatrascu commented on May 26, 2024

Haha, noiceee 😀 Thank you, for confirming the changes had a positive impact ❤️

from bolt_sips.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.