I am creating a rest api with spring and Neo4j 2.0 as data store. The connection to the server is:
<bean id="graphDatabaseService" class="org.springframework.data.neo4j.rest.SpringRestGraphDatabase">
<constructor-arg value="http://localhost:7474/db/data/" />
</bean>
<neo4j:config graphDatabaseService="graphDatabaseService" />
Queries are fast but the inserts , updates and deletes are very slow . The insertion code is as follows:
Domain model
@ NodeEntity
public class User extends Node {
@ Indexed ( INDEXTYPE = IndexType.FULLTEXT , indexName = " user_name ") private String name ;
@ Relatedto ( type = " knows" ) private Set <User> friends ;
private String password;
private String token;
Profile private profile;
private float affection;
public User () {
}
// getters and setters
}
Service layer
user=new User ();
user.setName(name);
user.setPassword(password);
user.setToken();
profile=new Profile();
profile.setEmail(email);
user.setProfile(profile);
userRepository.save(user);
The log is as follows:
19:38:58,026 INFO AuditLogger : 16 - == > before create org.project.service.UserService
19:38:59,781 INFO AuditLogger : 21 - == > after create org.project.service.UserService
This is repeated with all kinds of insertions and deletions , especially with nodes with multiple relationships although these are not explicitly charged. A deletion sometimes takes several seconds. Queries are fast as expected.
The same operations using embedded database are very fast
Any tips ?
Thanks in advance