I need to implement a throttled copy in my project, please considering the scenario is like a web service need to read store for each request. In the meanwhile, the store data could be refreshed. The data hosted in a SSD and the new data download to another disk. During system running, if new data is available, I need to copy new data to SSD disk, this need throttled copy to minimized the impact to SSD read.
the max write speed(SSD) without limitation could be 100-150MB/s.
In my implementation:
TotalCopyTime = FileSize / CopySpeed(from config)
TotalCopyLoops = FileSize / WriteUnitSize
Get each write time T in runtime.
SleepTimeBetweenEachWrite = [TotalCopyTime - (T * TotalCopyLoops)] / n
Based on above, the code is keep reading data from source, and write to the target, insert Sleep between each write.
The problem is: if the copy speed is 16MB/s, the real write time is bigger than SleepTimeBetweenEachWrite. So even the copy speed is 16MB/s, still have big impact to the read op.
Besides, I use some copy tool with speed configuration, copy with 16MB/s, no impact to the read op.
I'm wondering how does the tool implement the throttled copy? (tools like UltraCopier)
Aucun commentaire:
Enregistrer un commentaire