[Development] Default enabling inbound flow control on sockets

shane.kearns at accenture.com shane.kearns at accenture.com
Tue Feb 14 18:51:33 CET 2012


> -----Original Message-----
> From: development-bounces+shane.kearns=accenture.com at qt-project.org
> [mailto:development-bounces+shane.kearns=accenture.com at qt-project.org]
> On Behalf Of Thiago Macieira
> Sent: 13 February 2012 19:27
> To: development at qt-project.org
> Subject: Re: [Development] Default enabling inbound flow control on
> sockets
>
> As you said yourself, there's a huge potential for regressions here,
> especially with a limit as low as 64k. So I am unsure whether we should
> do this at all.
>
> We could apply a high buffer size, like 1 MB. That's probably enough to
> contain most data files being downloaded and yet avoid exploding by
> OOM. On a modern embedded system, an application would need to be
> downloading 50 items in parallel (which means from at least 9 different
> servers) before it started to get into trouble.
>

I'm also not convinced we should do this yet, but some more thoughts on the subject.

When using the high level (QNetworkReply) API, you are dealing with objects.
Intuitively, downloading a 100MB file will allocate 100MB of memory unless you take steps to prevent this.
You might get more or less data than you were expecting, if the object on the server has changed.
Regressions are likely, because downloading a complete object and then processing it would be a common usage.

When using the low level (QTcpSocket) API, you are dealing with a stream.
Intuitively, you would expect the stream applies flow control and rate limiting by itself.
If using native apis (either synchronous or asynchronous) on all platforms, this is what happens.
The exact amount of buffering in the OS level varies between platforms.
With QTcpSocket, this does not happen, because Qt reads all available data from the OS into its own buffers each time the event loop runs socket notifiers.
Regressions are less likely, because socket using code is normally processing the stream as it arrives.

________________________________
Subject to local law, communications with Accenture and its affiliates including telephone calls and emails (including content), may be monitored by our systems for the purposes of security and the assessment of internal compliance with Accenture policy.
______________________________________________________________________________________

www.accenture.com




More information about the Development mailing list