Dispatch queue qos in Network Extension

I am implementing a Packet Tunnel Network Extensions (https://developer.apple.com/documentation/networkextension/nepackettunnelprovider). There I have a Dispatch Queue where all incoming packets are handled.


I am wondering what kind of Quality of Service (qos) attribute I should use for my Dispatch Queue (https://developer.apple.com/documentation/dispatch/dispatchqos)? I obviosly want the packets to be handled as fast as possible (otherwise user may experince slow network connections) so maybe I should use .userInteractive. But on the other hand that seems a bit excessive and maybe .utility is more approprite. I already read https://developer.apple.com/library/archive/documentation/Performance/Conceptual/EnergyGuide-iOS/PrioritizeWorkWithQoS.html#//apple_ref/doc/uid/TP40015243-CH39-SW1 but that didn't really help me to find an answer.


Maybe some one here could help?

Answered by DTS Engineer in 328525022
.userInteractive
is clearly inappropriate. That QoS level is intended to be used for “critical interaction with the user such as handling events on the main event loop, view drawing, animation, etc.” (quoting from
<sys/qos.h>
).
.userInitiated
is also probably inappropriate. Again, quoting
<sys/qos.h>
:
  • It’s for “operations of short enough duration that the user is unlikely to switch tasks while waiting for the results”

  • It “will have progress indicated by the display of placeholder content or modal user interface”

This may apply to some network traffic going through your provider but you can’t guarantee that.

.utility
is what I’d recommend.

You should not use

.background
. Such work can be deferred indefinitely when the system is low on resources (for example, when the device is in Low Power Mode) and that’d be bad for a provider.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
Accepted Answer
.userInteractive
is clearly inappropriate. That QoS level is intended to be used for “critical interaction with the user such as handling events on the main event loop, view drawing, animation, etc.” (quoting from
<sys/qos.h>
).
.userInitiated
is also probably inappropriate. Again, quoting
<sys/qos.h>
:
  • It’s for “operations of short enough duration that the user is unlikely to switch tasks while waiting for the results”

  • It “will have progress indicated by the display of placeholder content or modal user interface”

This may apply to some network traffic going through your provider but you can’t guarantee that.

.utility
is what I’d recommend.

You should not use

.background
. Such work can be deferred indefinitely when the system is low on resources (for example, when the device is in Low Power Mode) and that’d be bad for a provider.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

This is really helpful. Thanks a alot!!

Dispatch queue qos in Network Extension
 
 
Q