Neo4j 1.9.4 (REST Server,CYPHER) performance issue

Posted by user2968943 on Stack Overflow See other posts from Stack Overflow or by user2968943
Published on 2013-11-08T15:51:37Z Indexed on 2013/11/08 15:53 UTC
Read the original article Hit count: 271

Filed under:
|
|

I have Neo4j 1.9.4 installed on 24 core 24Gb ram (centos) machine and for most queries CPU usage spikes goes to 200% with only few concurrent requests.

Domain:

some sort of social application where few types of nodes(profiles) with 3-30 text/array properties and 36 relationship types with at least 3 properties. Most of nodes currently has ~300-500 relationships.

Current data set footprint(from console):

LogicalLogSize=4294907 (32MB)
ArrayStoreSize=1675520 (12MB)
NodeStoreSize=1342170 (10MB)
PropertyStoreSize=1739548 (13MB)
RelationshipStoreSize=6395202 (48MB)
StringStoreSize=1478400 (11MB)

which is IMHO really small. most queries looks like this one(with more or less WITH .. MATCH .. statements and few queries with variable length relations but the often fast):

START
    targetUser=node({id}),
    currentUser=node({current})
MATCH
    targetUser-[contact:InContactsRelation]->n,
    n-[:InLocationRelation]->l,
    n-[:InCategoryRelation]->c
WITH
    currentUser, targetUser,n, l,c, contact.fav is not null as inFavorites
MATCH
    n<-[followers?:InContactsRelation]-()
WITH
    currentUser, targetUser,n, l,c,inFavorites, COUNT(followers) as numFollowers
RETURN
    id(n) as id,
    n.name? as name,
    n.title? as title,
    n._class as _class,
    n.avatar? as avatar,
    n.avatar_type? as avatar_type,
    l.name as location__name,
    c.name as category__name,
    true as isInContacts,
    inFavorites as isInFavorites,
    numFollowers

it runs in ~1s-3s(for first run) and ~1s-70ms (for consecutive and it depends on query) and there is about 5-10 queries runs for each impression. Another interesting behavior is when i try run query from console(neo4j) on my local machine many consecutive times(just press ctrl+enter for few seconds) it has almost constant execution time but when i do it on server it goes slower exponentially and i guess it somehow related with my problem.

Problem:

So my problem is that neo4j is very CPU greedy(for 24 core machine its may be not an issue but its obviously overkill for small project). First time i used AWS EC2 m1.large instance but over all performance was bad, during testing, CPU always was over 100%.

Some relevant parts of configuration:

neostore.nodestore.db.mapped_memory=1280M
wrapper.java.maxmemory=8192

note: I already tried configuration where all memory related parameters where HIGH and it didn't worked(no change at all).

Question:

Where to digg? configuration? scheme? queries? what i'm doing wrong?

if need more info(logs, configs) just ask ;)

© Stack Overflow or respective owner

Related posts about Performance

Related posts about neo4j