Skip to content

Multi-Threading and Transactions in OrientDB #9436

Discussion options

You must be logged in to vote

Hi Alex,

Welcome to OrientDB Community!

Multi-threading is not a complex topic as long as you stick to a couple of basic rules.

The first one is: never ever share connections and records between threads, always open, use and close a session in the same thread; if you need to share records between threads, pass RIDs and reload the record from inside the other thread.

This is enough to be safe with the API contracts.

The second rule is to consider the strengths and the limits of OrientDB transaction model. Optimistic transactions trade locking (ie. server overhead, less parallelism) with failures (ie. the need to retry transactions in case of collisions).
In OrientDB, each record has a vers…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by bujoralexandru
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants