B2 slow pack deletion v0.9.5

Inside a prune, I’m surprised by how long pack deletion takes:

[0:44] 100.00%  57 / 57 packs deleted

Given the index files have already been rewritten, what is going on here other than simply:

rm file1 file2 .. file56 file57

My storage is B2 and speedtest.net says 48ms, 47Mbps, 31Mbps.

Some storage providers can have very slow API access for some operations (such as deletions). I haven’t used B2 myself, so I can’t say for sure but that might be occurring here.

B2 may be slow due to needing to delete several files across many systems and ensuring the necessary synchronization happens to avoid having the file reappear.

@MJDSys I’ve been generally impressed by the speed of B2.

What is your average (per pack) deletion time?

From the above output above, mine is 0.8 seconds per pack file (44 divided by 57)

@Ataraxy With a quick local test (using a repository on a ram filesystem) I was able to delete 346 packs almost instantly. I don’t have any numbers for operations against cloud providers though.

But from my experience using some object storage repositories for other purposes (and other services), 0.8/s for a deletion doesn’t seem too bad. I wouldn’t say it’s a great time, but not unreasonable.

To test if this is a B2 or restic thing, you could try using another B2 client and uploading/deleting a few files and see if you get similar performance. If those complete much faster (even for similar file sizes), then it probably be good to raise a bug report with restic. But I have a feeling B2 is the issue here.

To be fair, other clients might make more deletion requests in parallel than restic does. I’m not sure if any deletions are performed in parallel in restic.

True, maybe a feature request then?

It seems that B2 supports deleting only a single file with each API call:

https://www.backblaze.com/b2/docs/b2_delete_file_version.html

I’d be very happy to be wrong on this!

I’ve also seen that the simultaneous connections to B2 is fixed at 2, so instead of it taking an average of 0.8 sec to delete a file, it probably takes 1.6s per connection :slight_smile:

I just ran into this. I didn’t realize my restic repos on B2 haven’t pruned in a year, and with v0.9.6 and b2 connections set to 20 it is going to take ~48 hours for the prune to delete 195,885 packs. That’s around 0.8 del/sec like you said. Total prune time is going to be 3-4 days on a 10 gbit connection.

The prune command is unfortunately not yet optimized for performance. That is it’s currently deleting files one after the other and can’t even make use of the 2 simultaneous connections. Backblaze taking more than a second to delete a pack is also not that helpful.