Re: [Qgis-developer] QGIS Server performance deterioration

2016-06-08 Thread René-Luc Dhont

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( 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




___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] QGIS Server performance deterioration

2016-06-08 Thread René-Luc Dhont

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( 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


___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] QGIS Server performance deterioration

2016-06-08 Thread Luca Manganelli
On Wed, Jun 8, 2016 at 8:06 AM, Luca Manganelli  wrote:
> On Tue, Jun 7, 2016 at 5:52 PM, René-Luc Dhont  wrote:
>> [...]

I compiled a debug version of QGIS Server. It seems that there's a
memory leak when it reads the QGS project file, after some project
switching in QWC project list:

Program received signal SIGSEGV, Segmentation fault.
0xb6f80d11 in QBasicAtomicInt::ref (this=0x7fff) at
/usr/include/qt4/QtCore/qatomic_i386.h:120
120 : "memory");
(gdb) bt
#0  0xb6f80d11 in QBasicAtomicInt::ref (this=0x7fff) at
/usr/include/qt4/QtCore/qatomic_i386.h:120
#1  0xb6f82ce4 in QString::QString (this=0xafc1b2c, other=...) at
/usr/include/qt4/QtCore/qstring.h:726
#2  0xb7238b33 in QgsMapLayer::id (this=0xab1fc20) at
/usr/local/src/qgis-2.14.3/src/core/qgsmaplayer.cpp:107
#3  0xb7093f85 in QgsLayerTreeLayer::QgsLayerTreeLayer
(this=0xafc1b10, layer=0xab1fc20)
at /usr/local/src/qgis-2.14.3/src/core/layertree/qgslayertreelayer.cpp:27
#4  0xb709462e in QgsLayerTreeLayer::readXML (element=...) at
/usr/local/src/qgis-2.14.3/src/core/layertree/qgslayertreelayer.cpp:111
#5  0xb70a724d in QgsLayerTreeNode::readXML (element=...) at
/usr/local/src/qgis-2.14.3/src/core/layertree/qgslayertreenode.cpp:56
#6  0xb7091d85 in QgsLayerTreeGroup::readChildrenFromXML
(this=0xaf28218, element=...)
at /usr/local/src/qgis-2.14.3/src/core/layertree/qgslayertreegroup.cpp:293
#7  0xb70917c0 in QgsLayerTreeGroup::readXML (element=...) at
/usr/local/src/qgis-2.14.3/src/core/layertree/qgslayertreegroup.cpp:259
#8  0xb70a7200 in QgsLayerTreeNode::readXML (element=...) at
/usr/local/src/qgis-2.14.3/src/core/layertree/qgslayertreenode.cpp:54
#9  0xb7091d85 in QgsLayerTreeGroup::readChildrenFromXML
(this=0xada4e48, element=...)
at /usr/local/src/qgis-2.14.3/src/core/layertree/qgslayertreegroup.cpp:293
#10 0xb70917c0 in QgsLayerTreeGroup::readXML (element=...) at
/usr/local/src/qgis-2.14.3/src/core/layertree/qgslayertreegroup.cpp:259
#11 0x080f9da2 in QgsServerProjectParser::findLegendGroupElements
(this=0xafc7df0)
at /usr/local/src/qgis-2.14.3/src/server/qgsserverprojectparser.cpp:1209
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] QGIS Server performance deterioration

2016-06-07 Thread René-Luc Dhont

Hi Luca,

How did you measure it ?
Which part of QGIS Server is slower ?
Have you do some fixes ?


Le 07/06/2016 16:04, Luca Manganelli a écrit :

On Tue, Jun 7, 2016 at 3:58 PM, René-Luc Dhont  wrote:

Hi devs,

Regarding the subject of the email, we discovered that the rendering
in QGIS Server 2.8.6  is at least 1.5x/2x faster than 2.14.3, loading
the same project (filled only with PostGIS layers).

Worse than this, project switching in QGIS 2.14.3 is broken; it
produces segmentation fault.
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer


___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] QGIS Server performance deterioration

2016-06-07 Thread Luca Manganelli
On Tue, Jun 7, 2016 at 3:58 PM, René-Luc Dhont  wrote:
> Hi devs,

Regarding the subject of the email, we discovered that the rendering
in QGIS Server 2.8.6  is at least 1.5x/2x faster than 2.14.3, loading
the same project (filled only with PostGIS layers).

Worse than this, project switching in QGIS 2.14.3 is broken; it
produces segmentation fault.
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer