Search code examples
javaneo4jheap-size

Increasing Java Heap Size on Neo4j


Does anyone know how to increase Java heap size one Neo4j?

I'm loading a csv file into Neo4j Database and I can't load it because I need to increase Java Heap Size... I checked that I have more than 100GB free... I also have 16Gb of RAM. My Jar file is located in "C:\Program Files\Neo4j CE 3.1.4\bin\neo4j-desktop-3.1.4.jar


Solution

  • You can set the neo4j.conf, which is located in C:\Program Files\Neo4j CE 3.1.4\conf\ by uncommenting and settings these lines:

    # Java Heap Size: by default the Java heap size is dynamically
    # calculated based on available system resources.
    # Uncomment these lines to set specific initial and maximum
    # heap size.
    #dbms.memory.heap.initial_size=512m
    #dbms.memory.heap.max_size=512m
    
    # The amount of memory to use for mapping the store files, in bytes (or
    # kilobytes with the 'k' suffix, megabytes with 'm' and gigabytes with 'g').
    # If Neo4j is running on a dedicated server, then it is generally recommended
    # to leave about 2-4 gigabytes for the operating system, give the JVM enough
    # heap to hold all your transaction state and query context, and then leave the
    # rest for the page cache.
    # The default page cache memory assumes the machine is dedicated to running
    # Neo4j, and is heuristically set to 50% of RAM minus the max Java heap size.
    #dbms.memory.pagecache.size=10g
    

    Know that if you are using LOAD CSV functionality, you can batch your transaction with USING PERIODIC COMMIT prefix. Example from the docs

    USING PERIODIC COMMIT 1000
    LOAD CSV FROM 'https://neo4j.com/docs/developer-manual/3.1/csv/artists.csv' AS line
    CREATE (:Artist { name: line[1], year: toInt(line[2])})