I've built a Java application that uses Spring and Neo4J in REST mode. The Neo4j is installed on Linux Red Hat machine and I changed nothing in its default configuration.
Queries / inserts run VERY slow when I use my Java Services to query data, but the same queries run fast when I do the same operations through the remote web admin.
for example, I have a query that runs in few milliseconds when I run it from the web admin, but it takes more than 30 seconds (!!) to return when calling it from my Rest service. Currently, I don't have a lot data on my DB (yet) - few thousands of nodes.
I don't have a clue where the problem might be - I guess that if directly it runs fast, it should be fast too when running from my service, isn't it?
This is an example query (I indented it for easy read):
@Query("start movie=node({0})
match (topic)<-[r:relatesToTopic]-(movie)
where r.orderInTop5? is not null and r.orderInTop5?>0
return topic order by r.orderInTop5 asc;")
public Iterable<Topic> findTopTopics(Content content);
Directly in the web admin, it looks like this:
start movie=node(50537)
match (topic)<-[r:relatesToTopic]-(movie)
where r.orderInTop5? is not null and r.orderInTop5?>0
return topic.name , topic.category, r.orderInTop5
order by r.orderInTop5 asc;
If it matters, the relatesToTopic relationship is declared on an abstract parent class and not on the Movie class itself.
I think I have a general problem because it is slow for any query or create. Services that doesn't use the Neo4J run very fast.
Can it be the REST configuration? something else?
I appreciate any ideas where to look for or what to test.
Thanks Carmel