Hello
We have been looking at different persistence libraries for YJS.
We have noticed that all of the libraries have atomic transactions in a mutex or similar scoped at the server level.
Is there any reason these are not document scoped? (i.e: Mutex per docName) We are noticing on a busy server that all clients are in the same mutex queue…
Y-Redis
yjs/y-redis
this.updateHandler = update => {
// mux: only store update in redis if this document update does not originate from redis
this.mux(() => {
rp.redis.rpushBuffer(name + ':updates', Buffer.from(update)).then(len => {
if (len === this._clock + 1) {
this._clock++
if (this._fetchingClock < this._clock) {
this._fetchingClock = this._clock
}
}
// @ts-ignore
rp.redis.publish(this.name, len.toString())
})
})
}
Y-MongoDB
fadiquader/y-mongodb
this._transact = f => {
const currTr = this.tr
this.tr = (async () => {
await currTr
let res = /** @type {any} */ (null)
try {
res = await f(db)
} catch (err) {
console.warn('Error during saving transaction', err)
}
return res
})()
return this.tr
}
Y-DynamoDB
hesselbom/y-dynamodb
storeUpdate: (docName, update, outsideTransactionQueue) => {
const callback = (db, config) => storeUpdate(db, config.tableName, docName, update)
return outsideTransactionQueue ? callback(db, config) : transact(callback)
},