While working on NEDNSProxy* network extension I've noticed that during certain network change events DNS system is getting flooded with DNS requests from all kinds of applications. I guess that's normal and expected, however the API apparently doesn't attempt to control rate and the whole situation is quickly leading to "too many" open connections and blockage of the whole thing in addition to bloated memory and so on. Since we have UDP here there is always a certain amount of time involved while waiting for response (1-2 sec at least) and you may or may not get it after all. More specifically, this call seems to be the place where I should try to control the situation:
Is there a recommended way to handle such situations? Should I start dropping those flows, adding a delay before processing them or both? What are the thresholds? Does this API have a capacity after which we know that it can't handle flows anymore? This all applies to regular AppProxy APIs too, I think.
Code Block - (BOOL)handleNewUDPFlow:(NEAppProxyUDPFlow *)flow initialRemoteEndpoint:(NWHostEndpoint *)remoteEndpoint
Is there a recommended way to handle such situations? Should I start dropping those flows, adding a delay before processing them or both? What are the thresholds? Does this API have a capacity after which we know that it can't handle flows anymore? This all applies to regular AppProxy APIs too, I think.