[Interest] Multiple QNetworkAccessManagers for a single app

Konstantin Tokarev annulen at yandex.ru
Wed Jan 17 15:48:47 CET 2018

17.01.2018, 16:12, "Richard Moore" <rich at kde.org>:
> On 11 January 2018 at 18:41, Tom Isaacson <Tom.Isaacson at navico.com> wrote:
>> But is it a performance issue, a potential threading problem, what?
>> We have a large codebase and this practice hasn't been followed, I'm wondering what the potential impact is and whether it's worth fixing.
> A few of the reasons:
> Using a single QNAM:
> - Lets you use a common cache throughout your application which can dramatically improve performance

Note that QNAM doesn't provide any in-memory or disk cache by default, so you should have QNetworkDiskCache or custom QAbstractNetworkCache installed to make use of shared cache. Note that you can manually install same cache into multiple QNAM's

> - Allows connection reuse which can dramatically improve performance

Especially with HTTPS, where you can also save TLS handshakes.

> - Lets you share credentials throughout your application so you don't find that one part is logged in to a site and other isn't
> - Similar to the above for cookies

As opposed to cache, this *does* work out of the box, though you can also share cookies in memory by setting same QNetworkCookieJar into all QNAM objects.

> - Lets you manage the SSL configuration more easily

As well as proxy configuration.

Also, HSTS policies can only be reliably shared when single QNAM is used everywhere

> - Uses less resources
> Cheers
> Rich.
> ,
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest


More information about the Interest mailing list