mutagen icon indicating copy to clipboard operation
mutagen copied to clipboard

Extreme slow rewriting of files on NFS drive

Open crankedguy opened this issue 3 years ago • 7 comments
trafficstars

Hello,

I noticed that there are extremely slow speeds when files have to be rewritten. The drive is an NFS mount and a 200MB FLAC needs over 30 seconds to be rewritten. Network transfer speeds are capped at 30MB/s shown during the operation. Normal speeds are shown around 125/110 read/write Any idea why this is the case with Mutagen, I have to rewrite several TB and this cannot be done so.

Thanks

crankedguy avatar Feb 28 '22 16:02 crankedguy

Likely because the rewrite is done in blocks: https://github.com/quodlibet/mutagen/blob/399513b167ed00c4b7a9ef98dfe591a276efb701/mutagen/_util.py#L722

You could try increasing _DEFAULT_BUFFER_SIZE (in the code)

lazka avatar Feb 28 '22 16:02 lazka

Thanks for your quick response. Any idea how to circumvent this except copying the files to tag to a local disk and back? Which is painful in its own with these sizes

crankedguy avatar Feb 28 '22 16:02 crankedguy

I've seen you just answered this :) Will try it out giving it some more buffer, thanks

crankedguy avatar Feb 28 '22 16:02 crankedguy

Otherwise you can use the following from https://mutagen.readthedocs.io/en/latest/user/padding.html

def no_new_padding(info):
    # this will use existing padding but never add new one
    return max(info.padding, 0)

f.save(padding=no_new_padding)

This means it will only rewrite the file if absolutely needed. By default it will add more padding the first time to make future changes are faster.

If the files don't have any tags at all, or no padding, or you add cover art, then this wont help though.

lazka avatar Feb 28 '22 16:02 lazka

Yes this is the case, most of the files have no cover art at all and if, it has to be updated, also they are not padded well enough by the creator. I will never understand why someone doesn't pad a few bytes nowadays when creating a 2-300MB in the first place. But it is how it is

crankedguy avatar Feb 28 '22 16:02 crankedguy

I notched this up to 2**21 until now and it brought tremendous speed improvements. Still slow though in terms to normal speed of the shares.

crankedguy avatar Mar 02 '22 12:03 crankedguy

There is also related #587

phw avatar Feb 14 '23 14:02 phw