[Qgis-developer] [Server] performance questions

Matthias Kuhn matthias at opengis.ch
Sat Apr 23 02:47:44 PDT 2016


Hi Jörg,

On 22/04/16 18:24, Jörg Habenicht wrote:
> Hi Matthias,
>
> Am 22.04.2016 um 17:20 schrieb Matthias Kuhn:
>> Hi,
>>
>> I don't know the server code very well, so I may be wrong, but I think
>> that making the server multithreaded rendering (MTR) capable should be
>> possible. And while it is certainly often possible to increase the
>> performance with filtering, rules and caching there are certainly also
>> situations where MTR can help a server to generate quick responses (many
>> layers, few requests).
>>
>> As far as I can see, the main task would be porting the code from
>> QgsMapRenderer to QgsMapRendererJob and QgsMapSettings. A first step
>> into this direction can be found in a recently closed pull request [1],
>> in particular this commit [2].
> I'll have a look.
> It seems to me I have to extract the code inside the loop (in
> QgsMapRenderer::render(), "while ( li.hasPrevious() )") into a separate
> method and call QtConcurrent on that.
You shouldn't have to deal directly with QtConcurrent, this code is 
alredy present.

https://qgis.org/api/classQgsMapRendererJob.html#details

Have a look at QgsMapCanvas::refreshMap() which sets up a job and 
connects the signal finished() to a local slot and continues execution.
On the server instead you probably want to use a QFutureWatcher with 
waitForFinished() to wait for the painting job (with its threads) finish 
before responding with the freshly painted image.

Matthias


More information about the Qgis-developer mailing list