GeoServer usually serves data to several users. According to the size of your organization, the actual number may range from a few to several hundred concurrent requests.
As with any other shared resource, we will ensure that none can exceed a certain amount of processing power, leaving others waiting for what remains.
This is handled by the control flow module, which uses a per user limit setting. We will implement it in this recipe.
controlflow.properties
file and modify its contents as follows:#ip.blacklist=127.0.0.10 # Maximum number of concurrent requests per user user=2
In the preceding steps, we use Firefox and its debug extension Firebug. Firebug is not available by default in the browser but you can easily add it from the add-in page.
If you are more comfortable with Chrome, you may follow the instructions using the Developers tools' console; it opens when you press Ctrl + Shift + I.
In the previous steps, you set a limit of two concurrent requests per user. This is a very small number and you may want to increase it during a production installation.
When calculating the proper number to insert, you have to consider not only the GeoServer capacity to stand against user requests, but also if your users use a web application, consider that browser's limit by default as the concurrent requests you may send to the same host.
With Firefox, you may check its limit and also change it by opening the about:config URL and searching for the network.http.max-persistent-connections-per-server
parameter (defaulting to six limits for the current release).
To check how this works, you open the layer preview page. The simple OpenLayers application contained sends a GetMap
request to GeoServer, but a single request will not trigger the limit. So how can you test whether it is really working?
Using the Tiled mode does the magic! Of course, when selecting it, the application, instead of sending a single request upon your map actions, sends requests for tiles that compose your map. It uses a regular tessellation and you can check it by having a look at the parameters for each GetMap
request.
Using Firebug, inspect the details for the requests sent; you can control all GetMap
requests to have a 256 x 256 size as follows:
Using tiles lets you produce many concurrent requests, as shown in one of the earlier screenshots.
To check how GeoServer handles them and to be sure that the control flow module is properly working, open the log file. You should see something similar to the following:
2014-06-16 17:28:01,902 DEBUG [org.geoserver.ows] - Getting layers and styles from LAYERS and STYLES 2014-06-16 17:28:01,902 DEBUG [org.geoserver.ows] - establishing raster style for NaturalEarth:blueMarble 2014-06-16 17:28:01,902 DEBUG [org.geoserver.ows] - Getting layers and styles from LAYERS and STYLES 2014-06-16 17:28:01,902 DEBUG [org.geoserver.ows] - establishing raster style for NaturalEarth:blueMarble 2014-06-16 17:28:01,902 DEBUG [org.geoserver.flow] - UserFlowController(4,GS_CFLOW_-2cd39e64:146a546eaa8:-8000) queue size 2 2014-06-16 17:28:01,902 DEBUG [org.geoserver.flow] - UserFlowController(4,GS_CFLOW_-2cd39e64:146a546eaa8:-8000) queue size 2 2014-06-16 17:28:01,902 DEBUG [org.geoserver.flow] - UserFlowController(4,GS_CFLOW_-2cd39e64:146a546eaa8:-8000) total queues 1 2014-06-16 17:28:01,902 DEBUG [org.geoserver.flow] - UserFlowController(4,GS_CFLOW_-2cd39e64:146a546eaa8:-8000) total queues 1 2014-06-16 17:28:01,902 DEBUG [org.geoserver.flow] - UserFlowController(4) purged 0 stale queues
As you can see, the module properly handles your requests, queuing them, and avoiding your GeoServer instance from getting overwhelmed by too many concurrent requests.
3.135.206.254