In this post I'd like to present what might appear as a rather un-intuitive performance tip for Autodesk Infrastructure Map Server / MapGuide: Under certain conditions, superior performance can be achieved by using layer theming to perform row filtering rather than filtering at the database level.
Traditional Database Filtering
Frequently when configuring map layers you will want to display only a subset of the records in a table. For example, if you have a Land Parcels table, you might have separate layers for different types of parcels (e.g. Residential, Commercial and Archived). Additionally, there may be an overlay layer for parcel text. Separate layers allows these layers to be turned on and off separately by users.
Figure 1 - SQL database provides filtering
We usually recommend implementing filtering of rows in a database table using the database itself. This can be done using database views (as in Figure 1 above) or using layer filters (layer filters are translated to additions to the where clause in the SQL statement generated by the FDO provider).
Typically this achieves best performance because the database engine is more effective at filtering through its ability to use indexes and other optimisations, plus this reduces the size of the dataset transferred from the database to the map server.
In this particular example, where the filtering is performed by the database as in figure 1, there will be 4 separate queries to the database; one for each layer.
Thematic Filtering
To implement Thematic Filtering, we have to take whatever filters were in the database views and layer filters and add to the layer's thematic expressions. If the layer was using basic styling previously, it will need to be converted to thematic styling. For layers already using thematic styling, each thematic style will need its expression modified to include the filter from the database view and layer filter.
From the point of view of an individual layer, this arrangement is inefficient because some of the records passed to the each layer are not displayed by that layer.
In this configuration all 4 layers access records directly the same table.
Figure 2 - Each layer has conditional theming to exclude some records
Since the set of records requested by each layer is identical, Infrastructure Map Server is smart enough to only retrieve the set of records once. The saving in having a single result set shared by all 4 layers achieves an improvement overall performance.
Actual Performance Gains
Up to now this discussion has been theoretical, so let us now turn to a production installation of Infrastructure Map Server.
In this particular system, there are 6 parcel related layers all referencing the same underlying table.
Using the Performance Report functions in Infrastructure Map Server Site Administrator, first introduced in 2013, we measured an impressive 82% performance improvement for scales below 1:10000, with overall layer redraw time for these zoom scales dropping from around 3 seconds to sub 1-second.
Figure 3 - Performance improvements from a production system
You can clearly see in the graph above that with zoom scales 1:10000 and above, thematic filtering becomes less efficient. The reason for this is that 4 of the 6 layers in question are not active at 1:10000 and above, and hence reducing the result set from the database becomes the more efficient approach. This particular system has Infrastructure Map Server tiling enabled for the higher zoom levels, and starts where thematic theming benefits end.
Conclusion
In this post we have considered a scenario where thematic filtering to exclude records received from the database achieves superior performance to traditional database filtering such as database views and layer filters, the latter translate to database filters through the FDO provider. We also consider performance from a production system where a significant performance improvement is evident at lower scale ranges. Finite and differing scale ranges for the various related layers result in poorer performance at higher zoom levels; and tiling was suggested as an effective technique at these higher zoom levels.
Hi Paul,
interesting article - I will take that into account when creating a new project in AIMS.
Rob
http://raumpatrouille3d.blogspot.ch/
Posted by: Rob | October 23, 2013 at 11:35 PM