Typically NSOperationQueue
guarantees thats that tasks with low priorities will not be executed until tasks with high priorities are done executing. However, when a large number of operations are added quickly to the queue, sometimes the operation queue can overload, as shown below
This graph tracks the history of 1000 operations. The red line shows the number of tasks with NSOperationQueueVeryLowPriority
priority that are currently executing, the green line shows the number of tasks with NSOperationQueueNormalPriority
that are idle in the queue and NOT executing, and finally the blue line shows the total number of operations in the queue.
Now, the default max concurrency of the NSOperationQueue
in this case seems to be 64. When all of those 64 slots get filled up, even if tasks with higher priorities exists, they don't get executed and have to wait. My question is, is there some way to tweak the NSOperationQueue
so that even when under load, it reserves some of the capacity for higher priority operations?