Badger become slower and slower after bulkwrite and Iterator 1000 key again and again

Thanks for your help, I found a solution:

  • Call DB.DropPrefix() on an not-exist prefix(like 0xff) can solve this problem.

  • The iteration delay will drop to less then 1ms, after I call DB.DropPrefix().

  • ps: I found that when I seen log like “badger 2020/07/25 04:59:27 DEBUG: LOG Compact. Added 1001 keys. Skipped 6538005 keys. Iteration took: 3.507171461s” ,the iteration delay will drop, then I search it in the source code, I found that i can only trigger it with DB.DropPrefix() call.

2 Likes