[mapserver-users] PHP/MapScript applySLD() bottleneck

Sergio Segala sergio.segala.list at gmail.com
Tue Jan 17 02:03:57 PST 2017


Hi Sushrut,

thanks for answer. I can try to split the SLD, apply the fragment to the 
right layer, and see the performance difference.

Sergio


On 01/16/2017 03:18 PM, Sushrut Shivaswamy wrote:
> Hey Sergio,
>
> The definition of mapObject - > applySLD() in the map server 
> documentation is as follows.
> *
> *
> *
> int applySLD(string sldxml)*
> *Apply the SLD document to the map file. *
> *The matching between the sld document and the map file will be done 
> using the layer’s name.*
> *See SLD HowTo for more information on the SLD support.*
> *
> *
> Assuming that your SLD document is applied to every layer in the 
> mapfile I see two potential areas for bottle necks to appear.
>
> Since the mapping between SLD and layer is based on the layer name, 
> what could be happening is that for every NamedLayer occurence
> in your SLD,  mapserver must be iterating over all the layers in the 
> map file to see which layer name matches the name in the SLD.
> For 76 occurences( as stated by you) *this would become an order 
> n-squared complexity search.*
> *Unless mapserver has an internal hash-table like structure to 
> associate a layerName with layerObj which I doubt, this would take a 
> lot of time*
> *and request processing times would scale on n-squared basis where n 
> is the the number of NamedLayerOccurences.*
>
> The actual styling of a layer based on SLD shouldn't increase the time 
> all that much.
>
> Could you try applying the SLD on a lyer basis instead of for the 
> whole map.
>
> If you have reference to the actual layerObj you could just call 
> layerObj - > applySLD().
>
> This should cut down the time involved in searching through the entire 
> map file for a LAYER reference with matching layer name.
>
> Regards,
> Sushrut Shivaswamy
>
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20170117/316a8844/attachment.html>


More information about the mapserver-users mailing list