Hi Ike,

First of all, iterating through all the relationships from a node takes
time. It is therefore better if you can structure your graph in a way such
that you do not need to traverse a large number of relationships from one
single node.

That said I understand from your description that this is not the problem
you are experiencing. What you are experiencing is a delay from when you
invoke getRelationships() until the first next() call on the iterator can
return a result (on which of these method calls the delay actually shows up
is irrelevant in this case).

The reason for this is that Neo4j naively loads all relationships when you
request them. When you request the first relationship Neo4j will load all
the 100K relationships for you. Why? Because iterating through all the
relationships from a node takes time anyway, and you have probably
structured your graph in such a way that you don't have to traverse a large
number of relationships from a single node. See? The assumption is that you
are going to want to structure your graph so that you don't need to load the
relationships from a node that has a large number of them, therefore it is
ok to load them all at once. There are not likely to be a huge number of
them, and you are probably going to want to go through most of them. Hence
loading them all right away is the fastest approach.

We do however realize that this is not true for all graphs and all
applications. Therefore we have planned to load relationships lazily in
chunks at some point. But that is not how things are implemented yet.

Hopefully you can work around this in your application for now. Or live with
these delays until we have completed a release that load relationships
lazily.

Cheers,
Tobias

On Wed, Jul 29, 2009 at 11:39 PM, Ikechukwu Eshiokwu <
[email protected]> wrote:

> Hey Guys,
>
>
>
> So I'm working on a proof-of-concept that uses Neo4j as data store and I'm
> experiencing some performance issues with the
>
> Node.getRelationships() method.
>
>
>
> I've noticed that when trying to obtain neighbours for any node with very
> many relationships(over 100K) using the getRelationships()
>
> function(or any of its overloaded forms), the delay is often several
> seconds long on a single call. The worst case I've seen is a
>
> node with ~800K relationships where the call takes 25 seconds. Even for
> nodes with 10K-100K relationships, calling any form of
>
> getRelationships() is noticeably slow.
>
>
>
> One thing to note about this, is that I've only really observed such
> behaviour with our largest graph(~30M nodes, ~80M relationships).
>
> Smaller graphs that I've tested can make the same call on nodes with 100K+
> relationships in significantly less time.
>
>
>
> I've also played around with the cache/memory mapped i/o settings in the
> neo4j configuration file, but haven't been able to improve
>
> the performance. I'm also using a JVM heap size of 5GB.
>
>
>
> It may be the case that I'm doing something horribly wrong in my
> implementation, or that the slowness is due to some limitation of
>
> Neo4j on neighbour set size (doubtful, since I don't think performance
> should be THIS slow), but it would be great if someone could
>
> help shed some light on this issue.
>
>
>
> Thanks,
>
>
>
> Ike Eshiokwu
>
> _______________________________________________
> Neo mailing list
> [email protected]
> https://lists.neo4j.org/mailman/listinfo/user
>



-- 
Tobias Ivarsson <[email protected]>
Hacker, Neo Technology
www.neotechnology.com
Cellphone: +46 706 534857
_______________________________________________
Neo mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to