Howard Chu wrote:
The primary issue with using LMDB over NFS is with performance. All reads are performed thru accesses of mapped memory, and in general, NFS implementations don't cache mmap'd pages. I believe this is a consequence of the fact that they also can't guarantee cache coherence, so the only way for an NFS client to see a write from another NFS client is by always refetching pages whenever they're accessed.
LMDB's read lock management also wouldn't perform well over NFS; it also uses an mmap'd file. On a local filesystem LMDB read locks are zero cost since they just atomically update a word in the mmap. Over NFS, each update to the mmap would also require an msync() to propagate the change back to the server. This would seriously limit the speed with which read transactions may be opened and closed. (Ordinarily opening and closing a read txn can be done with zero system calls.)
All that aside, we could simply add an EXCLUSIVE open-flag to LMDB, and prevent multiple processes from using the DB concurrently. In that case, maintaining coherence with other NFS clients is a non-issue. It strikes me that git doesn't require concurrent multi-process access anyway, and any particular process would only use the DB for a short time before closing it and going away.
-- -- Howard Chu CTO, Symas Corp. http://www.symas.com Director, Highland Sun http://highlandsun.com/hyc/ Chief Architect, OpenLDAP http://www.openldap.org/project/