Hi Mattias

I guess I can answer to your question (I'm working with Antonio on the same 
project)
We are using neo4j embedded and we defined, in out application properties 
file, the following neo4j configuration:

nodestore_mapped_memory_size=100M
relationshipstore_mapped_memory_size=3G
nodestore_propertystore_mapped_memory_size=100M
strings_mapped_memory_size=200M
arrays_mapped_memory_size=50M


Then, in the class where we create the neo4j DB we read the properties file 
and then we create the DB by using this code:

GraphDatabaseFactory gdbf = new GraphDatabaseFactory();
 GraphDatabaseBuilder gdbb = gdbf.newEmbeddedDatabaseBuilder(neo4jPath);
 
gdbb.setConfig(GraphDatabaseSettings.nodestore_mapped_memory_size,nodestoreMappedMemorySize
);
 
gdbb.setConfig(GraphDatabaseSettings.relationshipstore_mapped_memory_size,relationshipstoreMappedMemorySize
);
 gdbb.setConfig(GraphDatabaseSettings.
nodestore_propertystore_mapped_memory_size,nodestorePropertystoreMappedMemorySize
);
 
gdbb.setConfig(GraphDatabaseSettings.strings_mapped_memory_size,stringsMappedMemorySize
);
 
gdbb.setConfig(GraphDatabaseSettings.arrays_mapped_memory_size,arraysMappedMemorySize
);
 if (StringUtils.hasText(allowStoreUpgrade) && !allowStoreUpgrade.startsWith
("${")) {


 gdbb.setConfig(GraphDatabaseSettings.allow_store_upgrade, allowStoreUpgrade
);
 }
 if (StringUtils.hasText(cypherParserVersion) && !cypherParserVersion.
startsWith("${")) {


 gdbb.setConfig(GraphDatabaseSettings.cypher_parser_version,cypherParserVersion
);
 }
 if (StringUtils.hasText(keepLogicalLogs) && !keepLogicalLogs.startsWith(
"${")) {


 gdbb.setConfig(GraphDatabaseSettings.keep_logical_logs, keepLogicalLogs);
 }
 if (StringUtils.hasText(nodeAutoIndexing) && !nodeAutoIndexing.startsWith(
"${")) {


 gdbb.setConfig(GraphDatabaseSettings.node_auto_indexing, nodeAutoIndexing);
 }
 if (StringUtils.hasText(nodeKeysIndexable) && !nodeKeysIndexable.startsWith
("${")) {


 gdbb.setConfig(GraphDatabaseSettings.node_keys_indexable, nodeKeysIndexable
);
 }
 if (StringUtils.hasText(relationshipAutoIndexing) && !
relationshipAutoIndexing.startsWith("${")) {


 
gdbb.setConfig(GraphDatabaseSettings.relationship_auto_indexing,relationshipAutoIndexing
);
 }
 if (StringUtils.hasText(relationshipKeysIndexable) && !
relationshipKeysIndexable.startsWith("${")) {


 
gdbb.setConfig(GraphDatabaseSettings.relationship_keys_indexable,relationshipKeysIndexable
);
 }
 graphDbService = gdbb.newGraphDatabase();
 ggo = GlobalGraphOperations.at(graphDbService);
 executionEngine = new ExecutionEngine(graphDbService);
                ................


So basically we read the properties file and we set the properties values 
in neo4j configuration by using the GraphDatabaseBuilder utility; so I 
guess it should respect the properties name you told us

We tried to execute the algorithm several time. On the same route we have 
the following result:

   - first time: 125339 millis
   - second time: 1142 millis
   - third time: 531 millis
   - fourth time: 462 millis
   
The point is that, since we are building a routing system (something 
similar to gmaps where you can drag and drop points on the map and then 
calculate the best route), users can drag and drop points from a web 
application; as we change points on the map, the dijkstra execution becomes 
slow; we accept and understand that the first execution of the algorithm 
can be slower then the next executions, but we are wondering is and how we 
can avoid that it's slow every time an user change the start point and end 
point from a web map; is it possible?

Thank you
Angelo and Antonio





Il giorno martedì 13 maggio 2014 17:56:07 UTC+2, Antonio Grimaldi ha 
scritto:
>
> Hi,
>
> i'm using neo4j 2.0.3 with embedded DB,in order to build a route system.
>
> I created my graph (with around 1 Million of Nodes, and 50 Million of 
> relationships; ) in this way:
>
>    - 
>    
>    create nodes : 
>    
> Label mainNodeLabel = DynamicLabel.label("nodoPrincipale");
> // initialize batchInserter
> BatchInserter inserter = BatchInserters.inserter(neo4jDbPath, config);
> BatchInserterIndexProvider indexProvider = new 
> LuceneBatchInserterIndexProvider(inserter);
> inserter.createDeferredSchemaIndex(mainNodeLabel).on("y").create();
> inserter.createDeferredSchemaIndex(mainNodeLabel).on("x").create();
> BatchInserterIndex osmWayIdPropertyIndex = 
> indexProvider.relationshipIndex("osmWayIdProperties", 
> MapUtil.stringMap("type", "exact"));
> osmWayIdPropertyIndex.setCacheCapacity(OSMAttribute.OSM_WAY_ID_PROPERTY, 
> 100000);
>
>  
>
> Map<String, Object> nodeProps = new HashMap<String, Object>();
> double x = ...;
> double y = ...;
> nodeProps.put("y", y);
> nodeProps.put("x", x);
>
> long graphNodeId = inserter.createNode(nodeProps, mainNodeLabel); 
>   
>
>
>
>    - 
>    
>    create relationships between created nodes :
>    
> Map<String, Object> relationProps = new HashMap<String, Object>();
> relationProps.put(OSMAttribute.EDGE_LENGTH_PROPERTY, lunghezzaArco);
> long relId = inserter.createRelationship(startNode, endNode, 
> "CAR_MAIN_NODES_RELATION", relationProps);
>
> osmWayIdPropertyIndex.add(relId, relationProps)
>
>
>    - Neo4j Configuration : 
>
> nodestore_mapped_memory_size=100M
> relationshipstore_mapped_memory_size=3G
> nodestore_propertystore_mapped_memory_size=100M
> strings_mapped_memory_size=200M
> arrays_mapped_memory_size=50M
>
> When I Calculate shortest path between startNode and endNode with Dijkstra: 
> PathFinder<WeightedPath> finder = 
> GraphAlgoFactory.dijkstra(PathExpanders.forTypeAndDirection(relationType, 
> Direction.OUTGOING), "edgeLength");
> WeightedPath path = finder.findSinglePath(startNode, endNode);
>
> I have very slow performance... about 68194 millis for a distance of 42km.
> Is there something wrong? 
> Maybe i should index relationship cost property too? (edgeLength)
>
> Thanks
> Antonio
>
>
>

-- 
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/d/optout.

Reply via email to