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 <
michael.hun...@neopersistence.com> 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 <
> navrattan.craterz...@gmail.com>:
>
> 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 neo4j+unsubscr...@googlegroups.com.
>
> 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
> neo4j+unsubscr...@googlegroups.com.
> 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 neo4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to