[Qgis-developer] QGIS Server performance deterioration

René-Luc Dhont rldhont at gmail.com
Wed Jun 8 11:10:38 PDT 2016


Hi Devs,

I have created a PR: https://github.com/qgis/QGIS/pull/3186

QgsEditorWidgetRegistry connects to appropriate signals from map layers 
to load and save style but never disconnects its. In the context of QGIS 
Server, layers are connecting to appropriate signals at each request.

Thanks to review it.

Regards,

Le 08/06/2016 17:50, René-Luc Dhont a écrit :
> Hi Devs,
>
> I found which object is connected to QgsMapLayerRegistry through 
> layerWasAdded slot in QGIS Server, and it's QgsEditorWidgetRegistry !
>
> The method mapLayerAdded is apply to the layer added:
> ```
> void QgsEditorWidgetRegistry::mapLayerAdded( QgsMapLayer* mapLayer )
> {
>   QgsVectorLayer* vl = qobject_cast<QgsVectorLayer*>( mapLayer );
>
>   if ( vl )
>   {
>     connect( vl, SIGNAL( readCustomSymbology( const QDomElement&, 
> QString& ) ), this, SLOT( readSymbology( const QDomElement&, QString& 
> ) ) );
>     connect( vl, SIGNAL( writeCustomSymbology( QDomElement&, 
> QDomDocument&, QString& ) ), this, SLOT( writeSymbology( QDomElement&, 
> QDomDocument&, QString& ) ) );
>   }
> }
> ```
>
> Could a method call `mapLayerWillBeRemoved` be added ?
>
>
> Le 07/06/2016 15:58, René-Luc Dhont a écrit :
>> Hi devs,
>>
>> David Marteau, our colleague in 3Liz, has found some serious 
>> deteriorations of performance in QGIS Server.
>>
>> The first one concerne QgsExpressionContext which is not clean up in 
>> QgsServer::handleRequest
>>
>> Each call to QgsMapLayer::draw add items to QgsExpressionContext scope.
>> The scope is not cleaned between request and thus the scope list to 
>> grow indefinitely.
>>
>> Having the list growing indefinitely deteriorate seriously 
>> performances in the long run. It also increase the memory footprint 
>> but in a less noticiable way.
>>
>> This behavior has been checked by monitoring reponse time of several 
>> ten of thousand identical requests during server long runs.
>>
>> This has been fixed in master and in LTR:
>> https://github.com/qgis/QGIS/commit/5c3aa51e80887de6ff76682a42814041bb32cd5b 
>>
>> https://github.com/qgis/QGIS/commit/50181eee00709e3f7e29b2b53282f28bdedfe265 
>>
>>
>> Now we encounter an other issue with deteriorationof performance in 
>> QGIS Server.
>>
>> This issue is due to the slot 'layerWasAdded' in QgsMapLayerRegistry. 
>> The duration of the emit layerWasAdded grows with the number of 
>> drawing. Do you know what it is done when 'layerWasAdded' is emitted ?
>>
>> Regards,
>> René-Luc D'Hont
>> 3Liz
>



More information about the Qgis-developer mailing list