Open giohappy opened 4 years ago
@nmco can you groom this with @aaime help and then assign it to someone
@giohappy do you have a WMS client hitting GeoServer with the GWC transparent integration enabled? Is it desirable to have this behavior also in WMTS for example? Also, just to be sure, the requested area matches existing tiles, it's just a matter of stacking them one on top of the other, right?
@aaime no, we are hitting standard GS with integrated GWC. Not even hitting GWC directly.
@aaime our specific use case doesn't require WMTS and, as alreaady said by @simboss , we're hitting GS directly. If you think the implementation should cover more use cases I leave the decision to you and @simboss .
The expected behaviour, from my point of view, is that layers tiles will be stacked the same as without a cache behind them.
Ok, think I got it. Here is a more formal specification before we estimate:
Some further questions/observations:
If any of the layers in the stack is not cached, or does not match the requested tile and parameters (e.g, custom style, cql filter), a full WMS response will be used
@aaime does this mean all-or-nothing? Either all the layers have a cache or everything will be rendered from scratch?
No, read again: "In case the above checks pan out, each tile will be requested to GWC, which will eventually create it if missing". The checks mentioned above are to verify that each layer is cacheable at all in the tile requested.
ok, so "a full WMS response will be used for those layers".
For my specific use case I'm fine with all the resitrctions that you mention (not considering STYLES, CQL, etc.) because this is mainly intended for usage on mobile without the ability to set filters, select styles, and so on.
The following point is not clear to me:
We have no quick way to know if a WMS request corresponds or not to an already available tile or not. If the cache happens to be empty, each tile will be generated, along with the meta-tile containing it, which will cause a potentially long computation time.
Isn't the same process that happens when we have a cache miss with normal, single layer, WMS requests?
There is no "process", we ask GWC to process the request, if it can, it will return a tile, either from cache or freshly computed, if it does not, it means it cannot process it and we do the normal WMS path. What I meant, there is no way to know in advance if a tile corresponding to the request is already in the tile cache, and eventually use the tile composition only if all the needed tiles are already cached (that is, the fastest case).
I see. The worst case is no tiles cached. In that case doing a direct WMS render would be faster then having to check each layer against GWC (and eventually waiting fot it to create the cached tile). This is the point, right?
It all depends, but yes, depending on the combination of layers involved, the server load, it might happen that building tiles on the fly through WMS is faster than recomposing them from tiles. The worse case is not having the tiles in cache, but even having them, if the source layers are fast enough, having to decode N PNGs might take more time than actually rendering from the data. The thing is, I have no easy way to figure out which case it is, at runtime, it's going to be a "all or nothing", we either recompose tiles crossing fingers, or don't.
Hi @aaime good point.
Not sure @giohappy said this above but the idea is to come up with a mechanism in the TOC of the client(MapStore) where we can control how many layers we coalesce at a time to prevent having the problem you are referring to, plus to have seeding so that we have less cache writes on the most used views.
As an instance, let's say you have a maps with 20 layers (yeah that happens now) I would not go directly for asking tiled GetMaps with 20 layers but I would group them by 3 or so which would still reduce a lot the number of requests we are making and make the client lighter in load on the underlying HW.
@aaime clearly we have to find a good balance between the number of requests and the number of layers per request, but having this in place will give us the opportunity to tune things depending on the use case (mobile client vs desktop client, number and types of layers, cache configurations, etc.) .
BTW when we have cached tiles I imagine that the overload will always be less then having to hit the DB each time, in partticular when dozens of layers are requested...
Ok, some of the observations/questions I pointed out before have been answered, other ignored... let me try again with a final spec, filling in some blanks, please tell me if it's ok:
Sounds good?
sounds good to me
After further analysis we noticed that the specifc case use a lot of requests with SQL parameters. This means that these should be included in the spec and caches should be configured to use them. The latter won't be done, at least not soon, so we can freeze this issue for the moment.
Currently a WMS GetMap request with multiple layers doesn't use GWC cached tiles.
I want to discuss the implementation of this feature for a client of us. The basic idea is the ability to use cached tiles when these are available for one or more of the requested layers.