<div dir="ltr">Hey Sergio,<div><br></div><div>The definition of mapObject - > applySLD() in the map server documentation is as follows.</div><b><div><b><br></b></div>int applySLD(string sldxml)</b><div><b>Apply the SLD document to the map file. </b></div><div><b>The matching between the sld document and the map file will be done using the layer’s name.</b></div><div><b>See SLD HowTo for more information on the SLD support.</b></div><div><b><br></b></div><div>Assuming that your SLD document is applied to every layer in the mapfile I see two potential areas for bottle necks to appear.</div><div><br></div><div>Since the mapping between SLD and layer is based on the layer name, what could be happening is that for every NamedLayer occurence </div><div>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.</div><div>For 76 occurences( as stated by you) <b>this would become an order n-squared complexity search.</b></div><div><b>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</b></div><div><b>and request processing times would scale on n-squared basis where n is the the number of NamedLayerOccurences.</b></div><div><br></div><div>The actual styling of a layer based on SLD shouldn't increase the time all that much.</div><div><br></div><div>Could you try applying the SLD on a lyer basis instead of for the whole map.</div><div><br></div><div>If you have reference to the actual layerObj you could just call layerObj - > applySLD().</div><div><br></div><div>This should cut down the time involved in searching through the entire map file for a LAYER reference with matching layer name.</div><div><br></div><div>Regards,</div><div>Sushrut Shivaswamy</div></div>