[GIS] How to optimize a WMS request by limiting number of tiles

geoserveropenlayers-2optimizationtileswms

I want to display the layer using WMS and meanwhile I want to limit the number of tiles with their respecive BBox when map is loaded. At the backend I am using geoserver.

I can limit the number of features to load for WFS using "Maximum number of features" option in WFS setting in geoserver. But I am somehow lost to find the way of limiting number of tiles in WMS.
If I do like:

var bound = new OpenLayers.Bounds(6.9228, 50.9251, 6.9911, 50.9574);

and if i go and play around with different lat-lon bbox i can see in tomcat log file that, get request for tiles with respective BBOX are varying depending upon how deep i am looking for.

Is there any config setting in geoserver or openlayers api to control the tiles?
Thanks

Best Answer

I think you are missing some thing here :-) This is not how WMS servers work, You are also conflating tiles and features. With tiles. If you are using tiles then the hope is that a tile will be drawn once and cached for subsequent viewings. The cache can be at the server (where the cost of drawing a tile can be shared between all users) or in the browser (where it will only benefit the user of that machine). So it doesn't really matter how many features are drawn on a tile as the next time you view it there will be no draw at all.

If your WMS (or initial tile draw) is too slow because of the number of features being drawn then the best plan is to work out why that is. Adding an index to your data will be the first thing to try, then look at the type of data store you are using (try PostGIS instead of shapefiles etc). Finally if things are still too slow look at scale dependent rendering using SLD (http://geo.ifip.tuwien.ac.at/imak/2009/stack_workshop/doc/sld_basic/scale.html) to restrict the drawing of features to the most important ones when the user is zoomed out.