-
When using a local BonsaiDb, what happens when multiple processes open the same |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
No, it is not safe to open a single bonsaidb file from multiple processes simultaneously. There is file locking in place that should prevent it from happening, but I've only personally tested it on Linux. I don't have plans on allowing multiple processes to access the same database. There is a fair amount of state that is kept in memory and assumed to be consistent with disk, and by allowing multiple processes, I need to either switch all of that to memory mapped data (not very safe to implement) or detect when to recache that state, which would potentially reduce performance. I'm much more interested in adding IPC socket support to the server (#165) so that a local-only server could be run without any external networking and allow multiple processes to access it with less overhead than involving a full network stack. |
Beta Was this translation helpful? Give feedback.
No, it is not safe to open a single bonsaidb file from multiple processes simultaneously. There is file locking in place that should prevent it from happening, but I've only personally tested it on Linux.
I don't have plans on allowing multiple processes to access the same database. There is a fair amount of state that is kept in memory and assumed to be consistent with disk, and by allowing multiple processes, I need to either switch all of that to memory mapped data (not very safe to implement) or detect when to recache that state, which would potentially reduce performance.
I'm much more interested in adding IPC socket support to the server (#165) so that a local-only server could be r…