Increasing disk usage even after deletion (Orient 2.1.5)
Hi,
We have upgraded orient DB from 1.5.1 to 2.1.5 in our service.
We are using orient DB in embedded mode in our service.
We insert data in orient DB as binary chunks:
final void saveChunks(final ODatabaseDocumentTx db, List<byte[]> binChunks) throws IOException {
List<ORID> chunks = Lists.newArrayList();
for (byte [] chunkBytes : binChunks) {
// WRITE the chunk, BUT NOT MORE THAN MAX_CHUNK_BUF_SIZE
ORecordBytes chunk = new ORecordBytes();
chunk.fromInputStream(
new ByteArrayInputStream(chunkBytes));
// SAVE THE CHUNK TO GET THE REFERENCE (IDENTITY) AND FREE FROM THE MEMORY
db.save(chunk, "Data_Binary");
// SAVE ITS REFERENCE INTO THE COLLECTION
chunks.add(chunk.getIdentity());
}
ODocument record = new ODocument();
record.field( "data", chunks );
db.save(record);
}
We delete document as follows:
final void removeOldStoredChunks(final List <OIdentifiable> chunks) {
for (OIdentifiable chunk : chunks) {
try {
chunk.getRecord().delete();
} catch (Exception ex) {
LOGGER.error("removeOldStoredChunks : ", ex);
LOGGER.error("Failed to remove old chunks from orient DB");
}
}
}
In our use case, we have frequent insertions and deletions with above code snippet and size of each binary chunk is 1 MB.
All of our functional scenarios are running fine and orient DB 2.1.5 seems to be performing much better than orient 1.5.1 :+1:
We have a test scenario wherein we are inserting and then deleting same document multiple times. The size of that document is 246 MB.
With this test scenario, we can see that orient DB storage directory size is increasing on insertion but not reducing on deletion.
It seems orient DB is not reusing space freed after deletion.
In orient 1.5.1, we used to have a parameter "file.defrag.holeMaxDistance" which controls disk space usage. We had this value set to 2MB and this value was helping us to control disk usage growth.
Do we have some equivalent configuration parameter in 2.1.5 to control disk usage for above test scenario?
Please let me know if you need any other information.
Hi, How did you do the test ?
Did you remove records and add new in place and still size was increased on the same amount , or you only deleted records ?
Also page size is about 64 kb, so if you see behaviour when you do not reuse space could you split big binary record on small ones, and repeat the test case ?
Thanks for your quick reply!
Changing binary record size to 64K is working for us.
Disk space is not growing anymore :+1:
I am closing this issue.