[Neo] Java outof 64 GB ram
Mattias Persson
mattias at neotechnology.com
Tue Feb 23 13:12:30 CET 2010
One more thing... how much heap have you given the JVM? You control
how much RAM your JVM gets with the -Xmx option to the java command.
F.ex:
java -Xmx10G -cp .....
Please see more information regarding performance and tweaking at
http://wiki.neo4j.org/content/Neo4j_Performance_Guide
2010/2/23 Mattias Persson <mattias at neotechnology.com>:
> I see that you're using an older version of Neo4j. Have you tried using 1.0?
>
> http://components.neo4j.org/neo4j-kernel
> http://neo4j.org/download
>
> Maven
> groupId: org.neo4j
> artifactId: neo4j-kernel
> version: 1.0
>
> ...and at first glance I don't see any direct problem with your code.
>
> 2010/2/23 Miguel Ángel Águila <maguila at ac.upc.edu>:
>> Hello,
>>
>> I'm doing a code to walk around all the nodes and get the node with the
>> maximum out degree. The main problem is that there are around 57 million
>> of nodes and 322 million of edges in the neo database, and using a 64 GB
>> RAM is insufficient to execute the program. It is the code:
>> Can anyone see what I'm doing wrong? I don't understand.
>>
>> Thanks.
>> Mike
>>
>>
>>
>> public static void getNodeMaxOutDegreeNeo(final NeoService neo,
>> final IndexService indexService) {
>> Node idNode;
>> long degree;
>> long maxDegree = 0;
>> IndexHits<Node> nodes;
>> long idDegree;
>> long idMaxDegree;
>> Transaction tx = neo.beginTx();
>> try {
>> nodes = indexService.getNodes("TYPE", "titles");
>> Iterator<Node> it = nodes.iterator();
>> Node idNodeMaxDegree=it.next();
>> Iterator<Relationship> relIterator =
>> idNodeMaxDegree.getRelationships(
>> NeoDataBase.MyRelationshipTypes.REF,
>> Direction.OUTGOING).iterator();
>>
>> while (relIterator.hasNext()) {
>> relIterator.next();
>> maxDegree++;
>> }
>> long counter = 0;
>> while (it.hasNext()) {
>> if ( ++counter % 50000 == 0 ) {
>> tx.success();
>> tx.finish();
>> tx = neo.beginTx();
>> }
>> idNode = it.next();
>> relIterator =
>> idNode.getRelationships(NeoDataBase.MyRelationshipTypes.REF,
>> Direction.OUTGOING).iterator();
>> degree = 0;
>> while (relIterator.hasNext()) {
>> relIterator.next();
>> degree++;
>> }
>> if (degree >= maxDegree) {
>> if(degree==maxDegree) {
>> idDegree=
>> Long.getLong((String)idNode.getProperty("ID_TITLE"));
>> idMaxDegree=
>> Long.getLong((String)idNodeMaxDegree.getProperty("ID_TITLE"));
>> if(idDegree>idMaxDegree) {
>> idNodeMaxDegree = idNode;
>> }
>> }
>> else {
>> maxDegree = degree;
>> idNodeMaxDegree = idNode;
>> }
>> }
>> }
>>
>> System.out.println("OId =
>> "+(String)idNodeMaxDegree.getProperty("ID_TITLE"));
>> System.out.println("Title =
>> "+(String)idNodeMaxDegree.getProperty("NAME"));
>> System.out.println("#refs = "+maxDegree);
>> tx.success();
>> }
>> finally
>> {
>> tx.finish();
>> }
>> }
>>
>> _______________________________________________
>> Neo mailing list
>> User at lists.neo4j.org
>> https://lists.neo4j.org/mailman/listinfo/user
>>
>
>
>
> --
> Mattias Persson, [mattias at neotechnology.com]
> Neo Technology, www.neotechnology.com
>
--
Mattias Persson, [mattias at neotechnology.com]
Neo Technology, www.neotechnology.com
More information about the User
mailing list