Qt QNetworkAccessManager vs QTcpSocket: Interoperability of concurrent network requests
0 reputation · 24 Sept 2020, 16:41 UTC
Qt QNetworkAccessManager vs QTcpSocket: Interoperability of concurrent network requests
The goal is to understand how concurrent HTTP requests behave when issued through QNetworkAccessManager compared to raw QTcpSocket instances, focusing on perceived latency and queuing effects.
Key constraints include the default maximum connections per host (6), the internal thread‑pool that queues excess requests, and the requirement that QNetworkAccessManager is not thread‑safe across multiple threads unless each thread owns its own instance. These factors can lead to unpredictable latency spikes when many requests are issued simultaneously.
Uncertainty remains about the precise threshold at which the thread pool begins to queue requests, the impact of sharing a single manager versus per‑thread instances, and whether a dedicated QTcpSocket pool can avoid queuing latency at the cost of increased event‑loop overhead.
What is the measurable latency difference between a shared QNetworkAccessManager and per‑thread instances when more than six concurrent requests target the same host?
How does the size of the internal thread pool in QNetworkAccessManager correlate with latency spikes observed under heavy concurrency?
Can a dedicated QTcpSocket pool in separate threads eliminate the queuing latency seen with QNetworkAccessManager, and what trade‑offs in context‑switch overhead does this introduce?