Network.framework Performance issues in Downstream since Sonoma Update

I have built an application to measure network throughput using Network.framework. Since the Sonoma Update, I've encountered some strange performance issues with this framework. I use the Loopback Channel by running the server on my Mac itself, which is written in Golang. Before the update, performance was not an issue. After the update, however, the throughput fluctuates significantly.

I started to investigate, I use the following function to parse the data:

connection.receive(minimumIncompleteLength: 1, maximumLength: 32768) { 
    // My frame parsing code 
}

When I use a higher maximumLength, for example, 65536 bytes, it starts to fluctuate, and the received message size for parsing varies between 2.6 Mbytes and 7 Mbytes. However, if the maximumLength is 32768 or lower, and the message size is smaller or larger than this range, then the performance is as expected.

To further isolate the issue, I forced the server to just send messages and removed my frame parsing code, ensuring that the problem is not related to this. This behavior is very peculiar, and I'm unsure how to fix it. Are there others who have experienced similar performance problems? It's worth noting that this issue occurs only with downstream performance, not with upstream.

Accepted Reply

After some investigation I found the issue. The Problem was related to store the Incoming Data in a Foundation.Data Buffer and clearing the Buffer had this impact on performance. I switched over to DispatchData and the Performance is now as expected.

  • Thanks for sharing.

Add a Comment

Replies

After some investigation I found the issue. The Problem was related to store the Incoming Data in a Foundation.Data Buffer and clearing the Buffer had this impact on performance. I switched over to DispatchData and the Performance is now as expected.

  • Thanks for sharing.

Add a Comment