Database Reference
In-Depth Information
cache type, which is controlled by setting the cache_type parameter in the
neo4j.properties file.
We'lltackletheJVMconfigurationfirst,asthiscanhaveamassiveimpactontheperform-
ance of your application and database. The general rule of thumb is that the larger the heap
size the better, because this means a larger cache for holding and processing more objects,
and thus better performance from the application. This statement holds true for the most
part, but it's not always that simple.
One of the attractive features of JVM-based development is that, as a developer, you don't
need to worry about allocating and deallocating memory for your objects (as you'd need
to in other languages like C++). This is instead handled dynamically by the JVM, which
takes responsibility for allocating storage for your objects as appropriate, as well as clean-
ing up unreferenced objects via the use of a garbage collector. Garbage collectors can be
tuned and configured, but in general, heap sizes larger than 8 GB seem to cause problems
for quite a few JVMs.
Large heap sizes can result in long GC pauses and thrashing—these are exactly the types
of wasteful scenarios you want to avoid. Long GC pauses and thrashing are horrendously
detrimental to performance, because the JVM ends up spending more time trying to per-
formthemaintenance activities ofcleaning upandfreeingobjects thanitdoesenablingthe
application to perform any useful work.
SohowmuchmemoryshouldbeallocatedtotheJVMforNeo4jtooperateoptimally?This
is one of those areas where you may need to play around a bit until you can find a sweet
spot that makes use of as much of the JVM heap space as possible without causing too
many GC-related problems. Configuring the JVM with the following startup parameters
and values provides a good starting point:
• Allocate as much memory as possible to the JVM heap (taking into account your
machine and JVM-specific limits—6 GB or less for most people). Pass this in via
the -Xmx???m parameter.
• Start the JVM with the -server flag.
• Configure the JVM to use the Concurrent Mark and Sweep Compactor garbage
collector instead of the default one, using the -XX:+UseConcMarkSweepGC
argument.
Search WWH ::




Custom Search