You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In HaloDBInternal class, the boolean put(byte[] key, byte[] value) function is added a lock, so that it may result in low performance when multi-threads writing.
booleanput(byte[] key, byte[] value) throwsIOException, HaloDBException {
if (key.length > Byte.MAX_VALUE) {
thrownewHaloDBException("key length cannot exceed " + Byte.MAX_VALUE);
}
//TODO: more fine-grained locking is possible. writeLock.lock();
try {
Recordrecord = newRecord(key, value);
record.setSequenceNumber(getNextSequenceNumber());
record.setVersion(Versions.CURRENT_DATA_FILE_VERSION);
RecordMetaDataForCacheentry = writeRecordToFile(record);
markPreviousVersionAsStale(key);
//TODO: implement getAndSet and use the return value for//TODO: markPreviousVersionAsStale method.returninMemoryIndex.put(key, entry);
} finally {
writeLock.unlock();
}
}
The text was updated successfully, but these errors were encountered:
CMiIW for HaloDB itself should never and have no need to have multi thread writer. IMHO if i would have implemented a multithread writer db based on HaloDB i would embed multi instances of HaloDBs to a server which manage those instances with some sort of writer queue for connection pool that load balances all writes. Read is no problem though. HaloDB is perfect for some sort of "Volume" storage Multi Volume Store Server is what your after mate.
HaloDB is currently being used in a distributed database that only does single threaded writes to HaloDB. Each database box also has multiple instances of HaloDB running.
Clients do concurrent writes to the database, but those writes go to Kafka, which act as a distributed WAL for the database and each box in the cluster reads from Kafka and then writes to a particular HaloDB instance.
Since all writes to HaloDB are single threaded I haven't spent any time optimizing the performance of concurrent writes. As I have mentioned in the TODO comment in the put method we can optimize concurrent writes by using more fine grained locking.
@ShuaiJunlan Do you currently have a use case which requires multi-threaded writes, for which and the performance is poor?
In HaloDBInternal class, the
boolean put(byte[] key, byte[] value)
function is added a lock, so that it may result in low performance when multi-threads writing.The text was updated successfully, but these errors were encountered: