neo4j-graphql / neo4j-graphql-js

NOTE: This project is no longer actively maintained. Please consider using the official Neo4j GraphQL Library (linked in README).
Other
609 stars 147 forks source link

Auto-commit transactions vs transaction functions #29

Closed meddyrainzo closed 5 years ago

meddyrainzo commented 6 years ago

This is more of a question than an issue/bug

Reading the documentation of the neo4j javascript driver, it warns against using auto-commit transactions in production. It advices to use transactional-functions wherever possible.

Is there any reason why auto-commit transactions were chosen over transaction functions for this project?

johnymontana commented 6 years ago

The reasons for not using auto-commit transactions with the Neo4j drivers are that these transactions cannot participate in a causal consistency chain and network inefficiencies (auto-commit transactions are sent immediately, without sharing network packets).

The causal chain issue is not (yet) relevant here, as we don't (currently) expose the bookmarks returned by the drivers necessary for a causal chain. However, the network efficiency issue is enough reason for switching to the use of Neo4j driver transaction functions.

Also, because GraphQL separates queries (reads) and mutations (writes) we can leverage the WriteTransaction and ReadTransaction functions in neo4j-driver.

I'll make this change. Thanks for bringing up the issue @meddyrainzo!

johnymontana commented 5 years ago

Fixed in 1fbc747ec090e538f61f192f77749eb7f1aa878a