How many knows relationships do you have per person?
I think you should also check your configuration, 4GB of RAM is a bit on the
low side, you might end up using swap all the time.
You should have enough non-heap RAM for some decent memory mapping of your
store-files
And enough heap for sensible high level caches (e.g. 4G-8G HEAP)
So in total a machine with 16-32G heap would make more sense.
Also Upgrade to Neo4j 2.0 to have a stable baseline.
And if you add many friends at once I would do all those rel-checks at once
too, so instead of iterating over all rels 100 times and checking them against
a single person.
You iterate over them once and remove already existing friends from a hashset.
something like:
Set<Node> filterNewFriends(Set<Node> potentialFriends, Node underlyingNode) {
> for (Relationship rel :
> underlyingNode.getRelationships(Direction.OUTGOING,KNOW)) {
> potentialFriends.remove(rel.getEndNode());
> }
> return potentialFriends;
}
and then only create relationships to all those friends that have been returned.
Am 03.01.2014 um 14:45 schrieb Navrattan Yadav <[email protected]>:
> Neo4j version : 2.0.0-M06 .
> Operating System : linux
> Ram : 4GB
>
> sir we get slow when we get 2nd degree friends for a user.Then most of People
> Suggest to create more relation :
> So we are creating more relation to make it faster.
>
> Code for creating relation : Using Java API :
>
> public void addFriend(Person otherPerson) {
> if (!this.equals(otherPerson)) {
>
> //check if already created
>
> Relationship friendRel =
> getFriendRelationshipTo(otherPerson);
>
> if (friendRel == null) {
>
> underlyingNode.createRelationshipTo(
> otherPerson.getUnderlyingNode(), KNOW);
> }
> }
> }
>
>
> private Relationship getFriendRelationshipTo(Person otherPerson) {
> Node otherNode = otherPerson.getUnderlyingNode();
> for (Relationship rel :
> underlyingNode.getRelationships(Direction.OUTGOING,KNOW)) {
> if (rel.getOtherNode(underlyingNode).equals(otherNode))
> {
> return rel;
> }
> }
> return null;
> }
>
>
>
>
> On Fri, Jan 3, 2014 at 6:57 PM, Michael Hunger
> <[email protected]> wrote:
> You have to share more details.
>
> what versions do you use
> what is your stack
> what APIs do you use
> share the code to create the relationships
> what is getting slow
> how many concurrent users do you have
>
> etc.
>
> Sometimes a slowdown is related to doing just one single update per
> transaction and having millions of those tiny transactions.
> So it makes sense to aggregate those changes into larger chunks, e.g. all
> create your knows relationships in one TX (and the other ones too).
>
> Perhaps something that might help you:
> http://maxdemarzi.com/2013/09/05/scaling-writes/
>
> Michael
> Am 03.01.2014 um 14:09 schrieb Navrattan Yadav
> <[email protected]>:
>
>> Hi ...
>> Currently we have 1.5 million node and one relation : KNOW between
>> them.
>>
>> Basic Model is : when a user register we add KNOW relation to all his
>> friends. (friends are :phone book friends)
>>
>> Now its getting slow as user increase. so we want to add more relation
>> based on : COUNTRY, SOCIAL NETWORK, CITY, COLLEGE ETC.
>>
>> so we need to add these relation in existing node without blocking
>> database by running a separate thread.
>>
>> Please suggest some way,some query . how we can do this....
>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Neo4j" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>>
>> For more options, visit https://groups.google.com/groups/opt_out.
>
>
> --
> You received this message because you are subscribed to a topic in the Google
> Groups "Neo4j" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/neo4j/Q_RkuWN_biw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
> --
> Thanks and Regards
>
> Navrattan Yadav
>
> --
> You received this message because you are subscribed to the Google Groups
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.