Reading your previous messages I see a comment that "A* from node 1 to node 2: 1416 millis". Are you saying that A* from a node to a directly connected node is taking 1416ms? That does seem insanely long. I could only imagine two possible reasons:
- Your JVM is using OS swap space (ie. heap is too big, due to the strong cache. Java performance really sucks if it uses OS swap space, consider not caching so much, or add more RAM). - Serious bug in A* or use of it. I'm not familiar with the implementation of A* in neo4j, so I cannot comment further, but I assume running a profiler on the code might highlight something useful. Regarding contraction hierarchies. I thought they would only need to be recalculated if the road network changed. What kind of events are you getting that would change the road network and require this recalculation? On Mon, May 26, 2014 at 6:10 PM, Angelo Immediata <angelo...@gmail.com>wrote: > Any idea about these low performances? > > > Il giorno lunedì 19 maggio 2014 19:41:05 UTC+2, Angelo Immediata ha > scritto: > >> Hi there >> >> We are using Neo4j 2.0.3 in order to build a routing system. We are using >> the classical A Start implementation, tough we saw that there is a >> TraversalAstar implementation but it seems to be in experimental status yet. >> >> By the way, we read an OSM file and create our graph; actually we have >> around 1 million of points. around 2 million of relationships and around 5 >> million of properites on relationships; by reading neo4j documentation it >> seems to me that this DB dimension is really small and it's really well >> handled by neo4j but in my case this doesn't seem to be real (maybe I'm >> missing something) >> >> Actually our node creation code is the following one: >> >> private long createGraphNode(OsmNodeWrapper osmNodeWrapper) >> { >> try >> { >> Map<String, Object> nodeProps = new HashMap<String, Object>(); >> double x = osmNodeWrapper.getLongitude(); >> double y = osmNodeWrapper.getLatitude(); >> nodeProps.put(OSMAttribute.LATITUDE_PROPERTY, y); >> nodeProps.put(OSMAttribute.LONGITUDE_PROPERTY, x); >> nodeProps.put(OSMAttribute.OSM_NODE_ID_PROPERTY, osmNodeWrapper. >> getOsmNodeId()); >> if (osmNodeWrapper.isTrafficSignal()) >> nodeProps.put(OSMAttribute.TRAFFIC_SIGNAL, true); >> // Creo il nodo >> long graphNodeId = inserter.createNode(nodeProps, mainNodeLabel); >> // aggiungo l'identificativo del nodo sul grafo >> osmNodeWrapper.setGraphNodeId(graphNodeId); >> return graphNodeId; >> } >> >> In our graph, we have only 2 types of relationships: >> >> - *CAR_ONE_WAY_RELATION* for one way road with Direction OUTCOMING >> - *CAR_BIDIRECTIONAL_WAY_RELATION* for bidirectional road with >> Direction BOTH >> >> This is the relationship creation code: >> //Create RelationShip >> Map<String, Object> relationProps = new HashMap<String, Object>(); >> relationProps.put(OSMAttribute.EDGE_LENGTH_PROPERTY, lunghezzaArco); >> ....//other properties >> long relId = inserter.createRelationship(startNode, endNode, >> "CAR_ONE_WAY_RELATION", relationProps); >> >> osmWayIdPropertyIndex.add(relId, relationProps) >> >> We configured the neo4j embedded by using the following parameters: >> >> neostore.nodestore.db.mapped_memory=100M >> neostore.relationshipstore.db.mapped_memory=3G >> neostore.propertystore.db.mapped_memory=100M >> neostore.propertystore.db.strings.mapped_memory=200M >> neostore.propertystore.db.arrays.mapped_memory=50M >> cache_type=strong >> >> As you can see we use a strong cache type; this means we cache all data >> in memory. Moreover when out application starts we load all nodes and >> properties in memory; n order to do this we use this code: >> >> >> private void loadWholeGraphInMemory() throws PinfGraphServiceException{ >> StopWatch sw = new StopWatch(); >> sw.start(); >> Node start; >> for ( Node n : ggo.getAllNodes() ) { >> n.getPropertyKeys(); >> for ( Relationship relationship : n.getRelationships() ) { >> start = relationship.getStartNode(); >> } >> } >> for ( Relationship r : ggo.getAllRelationships() ) { >> start = r.getStartNode(); >> r.getPropertyKeys(); >> } >> sw.stop(); >> logger.info("Grafo caricato in "+sw.getLastTaskTimeMillis()+" millis"); >> >> >> } >> >> We tried to execute the AStar algorithm between 2 points. The distance >> between points is around 130 kilometers. In order to execute the algorithm >> Neo4j takes around 4 seconds for returning a path and it seems to me really >> too much; if i compare it to other software on the same OSM I have really >> really really really different performance. >> Is there any way to improve the Algorithm performance? Where can we act >> to have better performance? would be better to use the Traversal AStar? >> Moreover is there any plan to implement bi-directional AStar and/or >> Dijkstra? >> >> I guess that with this kind of perfomance, Neo4j is not suitable for my >> scenario >> >> Thank you >> Angelo >> >> >> >> >> -- > 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/d/optout. > -- 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/d/optout.