Database Reference
In-Depth Information
Note that this is still new functionality and it may be subject to change as clearer usage
patterns emerge and the API evolves. We won't go into too much detail at this time.
To demonstrate the additional improvement in performance gained by using the streaming
API, we executed a Cypher query that returned all the nodes in the example database. We
addedanextra120,000nodestogeneratedataresultinginatotalof120,602nodes,includ-
ing Adam and his friends existing within the database. The streamed results came back in
about 14 seconds for 149 MB compared to 21 seconds for 168 MB.
Note
The payload is smaller because the streamed results are compressed (whitespace removed)
whenbeingsentback.Streamingcanalsoreducethememoryrequiredbytheservertoper-
form this task. This is possible because the data requested is streamed directly back to the
client as it's read from the database, without having to temporarily store it in any nodes or
relationship objects along the way.
10.6. Summary
You've seen how both the embedded and server modes provide the ability to access and
interactwiththeNeo4jdatabase,butthemannerinwhichthisisdoneisfundamentallydif-
ferent.
With the embedded mode, you have quite a cozy relationship with Neo4j, which is only
availabletoJavaandaselectnumberofotherJVM-basedlanguages.Thoughyougetdirect
access to all of Neo4j's low-level APIs and can leverage the performance gains associated
withthis,you'realsorequiredtoshareyourresources(memoryandthelike)withNeo4jas
well. This could potentially introduce additional overhead and complications to the man-
agement of your application, and that needs to be taken into account.
Intheservermode,theNeo4jprocessisisolatedandcanbemanagedcompletelyseparately
from that of the application, which is a big win in large distributed architectures. All the
interactions, however,needtobedonethroughtheRESTabstractionlayer,whichalthough
it casts a wider net in terms of the clients it supports, has some performance implications
that need to be understood and dealt with appropriately.
Search WWH ::




Custom Search