hangc0276 commented on issue #3734:
URL: https://github.com/apache/bookkeeper/issues/3734#issuecomment-1407541786

   I tested the deletion performance, and the `deleteRange` has **a huge 
performance improvement** in key deletion.
   
   
   The number of deletion keys is 1/2 of the Total keys.
   Total Keys (million) | 0.1 | 1 | 10 | 50 | 100
   -- | -- | -- | -- | -- | --
   deleteRange | 0.02s | 0.021s | 0.024s | 0.03s | 0.033s
   deleteBatch | 0.089s | 0.514s | 6.985s | 38.896s | 98.511s
   
   This is the test code. You can put the code in `EntryLocationIndexTest.java` 
to reproduce the results.
   ```java
   @Test
   public void deleteBatchLedgersTest() throws Exception {
       File tmpDir = File.createTempFile("bkTest", ".dir");
       tmpDir.delete();
       tmpDir.mkdir();
       tmpDir.deleteOnExit();
   
       EntryLocationIndex idx = new EntryLocationIndex(serverConfiguration, 
KeyValueStorageRocksDB.factory,
           tmpDir.getAbsolutePath(), NullStatsLogger.INSTANCE);
   
       int numLedgers = 10000;
       int numEntriesPerLedger = 10000;
   
       int location = 0;
       KeyValueStorage.Batch batch = idx.newBatch();
       for (int entryId = 0; entryId < numEntriesPerLedger; ++entryId) {
           for (int ledgerId = 0; ledgerId < numLedgers; ++ledgerId) {
               idx.addLocation(batch, ledgerId, entryId, location);
               location++;
           }
       }
       batch.flush();
       batch.close();
   
       for (int ledgerId = 0; ledgerId < numLedgers; ++ledgerId) {
           if (ledgerId % 2 == 0) {
               idx.delete(ledgerId);
           }
       }
   
       idx.removeOffsetFromDeletedLedgers();
       idx.close();
   }
   ```
   
   
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to