0

I ran around 3k write queries in around 1 minutes, the CPU hits 100%. Here is the jstack log: jstack when CPU at 100%.

Can anyone tell me what is going on from the jstack logs,so that I can optimize my writes?

I am using Node.js Neo4J client(runs on m3.xlarge AWS instance) to write my changes.

Thank you.

Krishna Shetty
  • 1,361
  • 4
  • 18
  • 39
  • 2
    depending on your memory settings this might get caused by garbage collections. Uncomment the relevant settings for gc logging in `neo4j-wrapper.conf` and check logs. – Stefan Armbruster Nov 13 '14 at 08:15
  • Thank you, still trying to fix this. I am sharing the GC logs: https://onedrive.live.com/redir?resid=879CBF0D0A286E6D%21109 I am yet to point out anything from this logs – Krishna Shetty Nov 16 '14 at 19:25

1 Answers1

1

Your trace looks ok, it is just a few threads busy reading things.

It could be garbage collection induced CPU spikes or something else that's not visible in the stacks.

Can you share the (type of) statements you run?

For your queries:

  1. only merge on one label
  2. make sure to have an index / constraint for each :Label(property) that you merge or match on
  3. if you match on a property always have a :Label and an index for it:

you might also want to add a generic :Node label if you are working with generic guids all the time

create index on :Node(guid);
create index on :Book(id); 


'MERGE (u:Node{guid:{guid}})',
            'SET u.name={name}, u:Book'

'MERGE (u:Node {guid:{guid}})',
'SET u.name={name}, u.sub_type={sub_type}, u:Home:Area'

// are you sure you mean :Book(id) not :Book(guid) ?
'MATCH ( e:Node {guid:{guid}} ), (m:Book{id:{id}})',
'MERGE (e)<-[r:MEMBER]-(m)',
'return r'
Michael Hunger
  • 41,339
  • 3
  • 57
  • 80
  • Sorry, I was busy with other things. I am trying to fix this now. Here are the details. My queries look like this: https://onedrive.live.com/redir?resid=879CBF0D0A286E6D%21111 – Krishna Shetty Nov 16 '14 at 19:19
  • Other details of the server: https://onedrive.live.com/redir?resid=879CBF0D0A286E6D%21110 – Krishna Shetty Nov 16 '14 at 19:23
  • Thank you. I already have constraint on node properties that I merge. That is I have called these queries: create constraint on (b:Book) assert b.id is unique – Krishna Shetty Nov 25 '14 at 10:46
  • I always use nodes with labels, I have created constraint like: create constraint on (a:Area) assert a.guid is unique . I always read/write a node with a label. So, is it still better to have a generic label called :Node? – Krishna Shetty Nov 25 '14 at 10:49
  • But sometimes, I merge on multiple labels like: MERGE (u:Home:Area{guid:{guid}}) I think I will avoid this and check the performanace. – Krishna Shetty Nov 25 '14 at 10:51
  • Thank you so much. Bulk write with proper indexing helped a lot. – Krishna Shetty Dec 02 '14 at 15:29