forked from skozin/node-fdb
-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
We have very small test:
let buffer = Buffer.alloc(0);
await db.doTn(async (tx) => {
for (let i = 0; i < 10000; i++) {
let id = uuid();
tx.set(id, buffer);
}
})
We found that with this code js thread is blocked by FDB for ~160ms (of 180ms overal).
Further investigation shows that the issue is within FDB C library.
We changed code to use versionstampkeys
let buffer = Buffer.alloc(0);
await db.doTn(async (tx) => {
for (let i = 0; i < 10000; i++) {
tx.setVersionstampSuffixedKey(buffer, buffer);
}
})
Blocked time inside of a transaction went down to just 30ms, but commit time was increased by 150ms. I suppose that FDB library is offloading some computation to the end for atomic operations and just blocks thread later.
Isn't we should avoid blocking event loop and have a separate thread and schedule all FDB operations there?
Metadata
Metadata
Assignees
Labels
No labels