Proposal #7 Mapstore multiple WMS urls for the same source - geosolutions-it/MapStore GitHub Wiki
#Overview
Improve MapStore to allow multiple url for WMS services and increase the number of simultaneous requests limited by the browser.
Proposed By
Lorenzo Natali (offtherailz)
Assigned to Release
TBD
State
Under Discussion
Motivation
In order to improve performances and multiply the number of cuncurrent requests for the same server, we should allow MapStore to manage many URLs (different by domain name or port) that provides the same layers. Openlayers is ready to manage an array of URLs instead of a single URL, but both GeoExt and GXP don't support this array.
From heuristic tests, the response time is inversely proportional to the number of servers provided
t = mid_response_time/server_number
This is bounded to the max requests limit of the server.
Proposal
Provide directly in the static configuration forceWMSURLs
and force the usage of that URLs in OpenLayers.
configuration:
"turbogs": {
"ptype": "gxp_wmssource",
"title": "Multi GeoServer",
"url": "http://osm.geo-solutions.it/geoserver/ows",
"forceWMSURLs":[
"http://osm.geo-solutions.it/geoserver/ows?SERVICE=WMS",
"http://osm1.geo-solutions.it/geoserver/ows?SERVICE=WMS",
"http://osm2.geo-solutions.it/geoserver/ows?SERVICE=WMS"
],
WMSSource.js:
//..
url = this.forceWMSURLs || layer.url
layer = new OpenLayers.Layer.WMS(
config.title || config.name,
url, //instead of layer.url
params, {
attribution: layer.attribution,
maxExtent: maxCachedExtent,
//..
Caching
At first sight the caching of the tiles works during the same session of work, so the same tile is taken always from the same source. The URL to use for a request is deterministically selected based on the paramString.
- For details about the algorithm see the code .
Plugins to fix and improve
Many plugin uses getLayer()
from the LayerRecord
object and then layer.url. These have to be refactored to skip the problem array.
a list of gxp widget and plugin that uses the layer.url:
plugins\AddLayer.js
plugins\ClickableFeatures.js
(seems to be compatible. we can check this solution use it in the other plugins)plugins\GoogleEarth.js
widgets\GoogleEarthPanel.js
plugins\PrintSnapshot.js
plugins\Styler.js
plugins\WMSFilterView.js
plugins\WMSGetFeatureInfo.js
(see above)plugins\WMSGetFeatureInfoMenu.js
(same as above)widgets\WMSLayerPanel.js
widgets\WMSStylesDialog.js
widgets\grid\CapabilitiesGrid.js
plugins\Print.js
(not directly use of .url,but forward to server an array and the server doesn't support it)
Known issues
WMSGetFeatureInfo Tool and Menu
The tool don't work with this configuration, because it uses the layer.url in the OpenLayers GetFeatureInfo Control, but it doesn't support multiple URL. This should be fixed simply removing the url and let OpenLayers use the layer's URL by itself.
WMSGetFeatureInfo.js:
//..
var control = new OpenLayers.Control.WMSGetFeatureInfo(
// url: x.getLayer().url,
queryVisible: true,
layers: [x.getLayer()],
vendorParams: vendorParams,
//..
Print Plugin
The GeoExt implementation of the print plugin forward directly the layer.url to the server side part. So this should be fixed,maybe at GeoExt level.
Feedback
This section should contain feedback provided by members who may have a problem with the proposal.
Voting
Tobia Di Pisa +1. Mauro Bartolomeoli +1.