Somnath Muluk
Somnath Muluk

Reputation: 57816

Neo4j Match / Retrieving Query taking too much time 25 sec

My System is 8 core and 16 GB RAM. But still traversing :User nodes takes too much time around 25 seconds.

I am set 2 properties as in neo4j-wrapper.conf :

wrapper.java.initmemory = 6144
wrapper.java.maxmemory = 12288
MATCH (u:User)
RETURN id(u) as id, u.username, u.email, (..15 More fields..), u.created_at as created_at
ORDER BY created_at desc 
SKIP 0 LIMIT 10

How can I reduce response time from Neo4j server? What neo4j.properties can be set to reduce execution time?

Upvotes: 7

Views: 254

Answers (2)

adam
adam

Reputation: 978

I've had some luck by setting both the init memory and max memory to the same value (so the jvm doesn't have to do any resizing) and also setting the garbage collection. give these values a shot in your conf file:

-Xmx4g #max
-Xms4g #init
-XX:+UseConcMarkSweepG #garbage collector

Upvotes: 2

Stefan Armbruster
Stefan Armbruster

Reputation: 39925

Indexes in Neo4j are used for lookup of nodes and not for sorting. If you want to paginate a sorted list of 4M nodes it will take some time.

The way to solve that is by proper data modelling. When adding a new User consider having a :PREV_USER relationship to the one being created before the current one, the users in your system will form a linked list holding the users in timely order.

This linked list is fast and easy to traverse.

Upvotes: 3

Related Questions