title: Neo4j LOAD CSV Application Threads Blocked
body: <p>I am trying to import about 500,000 lines of data from a CSV file using the <code>LOAD CSV</code> command in neo4j. </p>
  
  <p>The data in the csv is organized like this:</p>
  
  <pre><code>Artists    |    Feature1    |    Feature2    |    Feature3
  </code></pre>
  
  <p>Each of the columns is filled with  names of music artists, most of who show up more than once in a column. If an artist name shows up in any column, I want there to be a node for that artist. If that artists' name shows up more than once in a column an/or in more than one column, I would  like for there to be one and only one node for that artist.</p>
  
  <p>For each artist, I want to keep track of who they feature and who they feature for. Each row of the csv represents a song. For each song an artist makes (each row of the csv), I'd like to add a <code>FEATURES</code> relationship from the artist in the <code>Artist</code> column to the artist in the <code>Features1/2/3</code> columns.</p>
  
  <p>Here is the code I am using:</p>
  
  <pre><code>CREATE CONSTRAINT ON (a:Artist) ASSERT a.artistName IS UNIQUE;
  
  USING PERIODIC COMMIT 50
  LOAD CSV WITH HEADERS from 'https://aws.bigfile.csv' as line
  MERGE (artist:Artist {artistName: line.Artist})
  MERGE (feature1:Artist {artistName: line.Feature1})
  MERGE (feature2:Artist {artistName: line.Feature2})
  MERGE (feature3:Artist {artistName: line.Feature3})
  
  MERGE (artist)-[f1:FEATURES]-&gt;(feature1) 
  ON CREATE SET f1.strength = 1
  ON MATCH SET f1.strength = f1.strength + 1
  
  MERGE (artist)-[f2:FEATURES]-&gt;(feature2) 
  ON CREATE SET f2.strength = 1
  ON MATCH SET f2.strength = f2.strength + 1
  
  MERGE (artist)-[f3:FEATURES]-&gt;(feature3) 
  ON CREATE SET f3.strength = 1
  ON MATCH SET f3.strength = f3.strength + 1
  </code></pre>
  
  <p>Desired behavior: the first occurrence of someone featuring another artist creates the <code>FEATURES</code> relationship and should set the <code>strength</code> property of the <code>FEATURES</code> relationship equal to 1. For every subsequent occurrence, the strength property goes up by 1. Therefore, an artist A who frequently features an artist B should have a relationship like <code>(a)-[:FEATURES {strength: AHighNumber]-&gt;(b)</code></p>
  
  <p>Relationships are directional and direction matters in this case (A featuring B is different than B featuring A).</p>
  
  <p>There should be over 10,000 distinct artists and therefore nodes, but around 2,000 nodes I start getting issues with system timeout.</p>
  
  <p>I am getting a bunch of the following message in the logs:</p>
  
  <pre><code>2017-12-30 10:54:04.268+0000 WARN [o.n.k.i.c.MonitorGc] GC Monitor: Application threads blocked for 467ms.
  </code></pre>
  
  <p>Is there any other information that may be useful in determining the issue? Any idea how I could restructure my code to avoid this issue? All help is greatly appreciated. Thanks!</p>