mchidk/BinaryRage

Sleeping caps out write performance at 100kB/s

Opened this issue · 0 comments

Lines 55 and 56 in WritetoStorage() in Storage.cs reads

            //Calculate pause based on amount of bytes
            Thread.Sleep(value.Length / 100);

I am trying to use BinaryRage for writing blobs of about 1-100MB. The code then sleeps for 10-1000 seconds, which is clearly suboptimal when SSD:s today could sustain several hundred megabytes per second.

The discussion for the commit mentions improved performance in some use cases. What would a generic sleep time that would work for both small and largish values look like? Would something like Math.Log(1+value.Length, 2) + value.Length/1e8 be better? See graph below.

image

Another alternative might be to either have an option to disable the sleep or just making the sleep constant...