NSOperationQueue maxConcurrentOperationCount –1 and undocumented system throttling boundary
0 reputation · 07 Mar 2023, 04:45 UTC
NSOperationQueue is configured with maxConcurrentOperationCount set to –1, which is documented as unlimited. In practice the system caps the number of concurrent threads for a queue based on CPU and memory resources.
The throttling policy and thresholds are not documented, and the queue’s internal throttling state is not exposed through a public API. Developers therefore have no permission boundary to query effective concurrency or adjust system-level limits, leaving the behavior opaque across iOS and macOS.
The goal is to establish a deterministic configuration boundary for queues used under high concurrent load where latency must remain predictable.
Is there a documented API to observe the effective concurrency applied by the system for a queue with maxConcurrentOperationCount –1? Does Apple intend the –1 setting to be a performance contract or an advisory hint subject to opaque throttling? What configuration is required to avoid non-deterministic latency spikes under concurrent requests?