|
Methods defined here:
- __getitem__(self, key)
- __init__(self, chainPollTime, defaultChunkSize, priorityPct, charityRate=1.85, charityTime=0.0003)
- __init__ - Create a BackgroundIOPriority.
Some terms: throughput - Bandwidth out (Megs per second)
interactivity - CPU time available for other tasks (calculations, other I/O, etc)
@param chainPollTime - float > 0, When chaining, this is the sleep time between checking if prior is finished.
Too low and the polling takes up CPU time, too high and you'll lose a little time in between chained writes, while gaining interactivity elsewhere.
@param defaultChunkSize - integer > 0, When providing a straight string/bytes to bgwrite (instead of chunking yourself, or using bgwrite_chunk) this will
be used as the max size of each chunk. Each chunk is written and a flush is issued (if the stream supports it).
Increasing this increases throughput while decreasing interactivity
@param priorityPct - integer > 0, generally 0-100. When this number is high, throughput for the operation will be higher. When it is lower,
interactivity is higher, e.x. if you have a calculation going and a write going, the lower this number the longer the write will take, but the more
calculations will be performed during that period.
@param charityRate - float >= 0, Every couple of blocks written, the current throughput is checked and if things have been going swiftly
a short sleep will be incurred. Increasing this number causes that check to happen more often.
This number is related to both the number of blocks and the priorityPct. The default, should be fine, but you may find it better
as a different value in certain cases. Increasing or decreasing could either increase or decrease interactivity, depending on those other factors.
Generally, however, increasing this increases interactivity and ability to write in parallel, at the cost of throughput.
@param charityTime - float >= 0 - Used to calculate the time to sleep when the charity period hits. The equation is:
sleepTime = charityTime * ((dataWritten / delta) / ( (dataWritten / delta) * priorityPctDec))
Where dataWritten = number of bytes written already, delta = total time spent writing (not including charity time sleeping)
and priorityPctDec = priorityPct / 100.
Increasing this can increase interactivity and allow more parallel operations at the cost of throughput.
The default should be fine for the majority of cases, but it is tunable.
An "interactivity score" is defined to be (number of calculations) / (time to write data).
- __setitem__(self, key, value)
Data descriptors defined here:
- chainPollTime
- charityRate
- charityTime
- defaultChunkSize
- priorityPct
|