In one setup, the wfs getfeature POST request has gone from <0.5 seconds
to >4 seconds.
The setup where I observed this uses jdbcconfig with hundreds of layers
and security rules (per layer). This is somewhat ironic because the
pull request was meant to improve performance with database catalogues
in particular.
The problem is that building the security filter when you have hundreds
of rules is very expensive. Rules are specified with layer names and
they all have to be translated to IDs. I tried improvements to
jdbcconfig in using the cache, this has reduced the time from 4 seconds
to 1.5 seconds, a substantial difference but still substantially more
expensive than the old version. The problem remains that building the
filter is too expensive with many rules. Would it be a good idea to keep
the security filter in a cache, indexed by Pairextends CatalogInfo> ?
The issue does not occur for GET requests because it does not trigger
WFSXmlUtils.initWFSConfiguration which triggers getting all layers from
the catalogue (secured). Is it perhaps possible to cache the WFS
configuration between different requests? Is using the secured catalog
even required here for parsing the XML? (I have no idea)
Bad news we all know about jdbcconfig inefficiencies.
Good news, re:
The issue does not occur for GET requests because it does not trigger
WFSXmlUtils.initWFSConfiguration which triggers getting all layers from
the catalogue (secured).
Still, I wonder about the creation of the security filter when you have 700+rules. I can tell you, that is one hell of a filter. I suspect even with the regular catalogue that would be an expensive operation.
Makes me think about the streaming renderer… it tries to push down to the data source all the filters contained in the active rules, but practice has shown that it’s not always possible, e.g., the generated SQL query can become too big to send to the database.
See here:
The default max is pretty conservative, only 5 (odd, I thought it was 20), when one goes beyond only the bbox filter is sent down, and filtering is performed in memory.
Now, without appyling the very same limit, maybe a similar mechanism can be implemented? Decide whether to pre-filter or post-filter based on a threshold on the number of filters being sent down?