In this topic
- Cache map services
- Evaluate the image format of the map cache
- Use ArcGIS Server Internet connections
- Use the StaticMode property on the OverviewMap
- Optimize the TOC control
- Eliminate unnecessary Web controls
- Deploy production applications without debug
- Use HTTP compression
- Disable MIME data
- Define the data frame name for ArcGIS Server services
- Use ArcGIS Server LayerDescription to improve query response time
- Do not create child controls in a custom control
Cache map services
By caching your map services, you reduce the time it takes for your map to draw. When possible, cache all the services in your application and do not combine cached and un-cached services. At ArcGIS 9.3, the display of maps—where dynamic and cached services are combined—has been optimized dramatically.
Evaluate the image format of the map cache
The default image format for the caching tools at ArcGIS 9.2 was PNG24. Using a different image format, such as PNG8 or JPEG, can result in smaller image file sizes and faster display of images in the Map control.
Do not use Internet Explorer 6 when the Web application contains multiple cached services in PNG24 format. Internet Explorer 6 has limitations in its ability to display transparency for PNG24 images. The Web ADF includes code that works around this limitation, but there is a performance penalty incurred when this scenario is encountered. Avoid this scenario by performing the following:
- Use Internet Explorer 7 or Firefox 2 when viewing blended map services cached in PNG24 format.
- Cache your map services in PNG8, PNG32, or JPEG format if Internet Explorer 6 must be used.
At ArcGIS 9.3, the default cache format is PNG8.
Use ArcGIS Server Internet connections
Connect to your server using ArcGIS Server Internet connections to make more efficient use of server context requests. Use ArcGIS Server local connections only when the application requires working with ArcObjects on the server. This includes making stateful changes to the service and utilizing functionality that is only available in ArcObjects.
Use the StaticMode property on the OverviewMap
The OverviewMap was enhanced at ArcGIS 9.2 Service Pack 5 to include a StaticMode property. By setting StaticMode to true, the image in the OverviewMap does not change when the Map extent changes. Previously, an image was generated for the OverviewMap each time the Map extent changed.
Optimize the TOC control
ArcGIS 9.2 Service Pack 3 resolved a significant performance issue with the TOC control. This issue was particularly noticeable when using map services with a significant number of layers, group layers, and layers with scale dependency applied.
The TOC control has the following options that allow you to reduce the amount of information requested from the server:
- TOCType—The default setting of SwatchList generates a TOC that lists both the layer names and the symbology in each layer. Changing this setting to LayerList reduces the amount of information requested from the sever by displaying only the layer names and not the symbology.
- RenderOnDemand—When a TOC is configured to display symbology, setting this property to true delays the requesting of swatch information until a layer is expanded. This improves the initial startup time of the application.
- ExpandDepth—Use an ExpandDepth value of 0 or 1 to minimize the number of nested layers visible when the TOC is displayed at initial application startup.
- Set the Visible property on some of your MapResourceItems to false. This results in the application loading quicker; however, the Web page user must turn on the layers manually.
Eliminate unnecessary Web controls
The default Web Mapping Application that comes with Manager and Visual Studio includes Web controls such as TOC, OverviewMap, and Scalebar. As you interact with your application, these controls request new images and updated status information. Eliminating controls from the application that are rarely used improves application performance and scalability of the system.
Deploy production applications without debug
Web ADF controls emit JavaScript required for use by ADF controls. When deploying an application in a production environment, remove the debug option from the web.config file to ensure the compressed version of the Web ADF JavaScript files are streamed to the client. This reduces the amount of time at initial load of the application.
Use HTTP compression
Internet Information Services (IIS) provide the ability to compress resources (JavaScript) streamed to the client browser at run time. Compression reduces the amount of information that is provided to the client (usually at initial load).
Disable MIME data
By default, non-cached map resources in the Web ADF generate Multipurpose Internet Mail Extensions (MIME) images that are streamed to the browser for blending. To reduce the amount of information that must be processed directly by the ADF, disable use of MIME data on the resource (the Request MIME data option in the map resource display settings editor dialog box). The uniform resource locator (URL) to the map image generated by a map service must be available in a public virtual directory. During a map draw operation at run time, the browser is provided with the URL to the map image instead of the image MIME data. The browser retrieves the image via the URL instead of reading and rendering the MIME stream.
Variable transparency applied to the map resource is not applied in this scenario. Background transparency is respected if the image type generated by the map service supports it (for example, .png).
Define the data frame name for ArcGIS Server services
The resource definition for an ArcGIS Server resource includes the data frame and map service names. If the data frame name is the default, the ADF application must request the default data frame name from the map service when the resource is initialized (potentially at every request). Explicitly set the data frame name to avoid this extra request.
Use ArcGIS Server LayerDescription to improve query response time
Each ArcGIS Server map resource in the ADF has a MapDescription that maintains a list of layer descriptions as a LayerDescription array. MapDescription and LayerDescription are types defined by the ArcGIS Server Simple Object Access Protocol (SOAP) application programming interface (API). LayerDescription describes the contents of a layer in a map service. When querying layers in an ArcGIS Server map service using ADF types (for example, IQueryFunctionality), the ArcGIS Server SOAP API is used. As a result, modifications to the SOAP types associated with an ArcGIS Server map resource can modify query results.
In many cases, returning geometry from a query is necessary to render features in a map as a selection or subset. The level of detail in the geometry returned (that is, number of vertices) directly affects the amount of time it takes to return a result. By default, geometry as stored in full detail is returned. If full detail is not necessary, you can generalize geometry returned from a query using the GeometryResultOptions object associated with LayerDescription. Generalizing geometry reduces the amount of time it takes for a query to return a result.
GeometryResultOptions defines two properties of interest: GeneralizeGeometry and MaximumAllowableOffset. Set GeneralizeGeometry to true and define MaximumAllowableOffset in map units. MaximumAllowableOffset defines how far the output geometry can be from the input geometry. The greater the value, the more generalized the geometry. Since the MapDescription for an ArcGIS Server map resource is stored in state, when you change this value, it is maintained for the duration of the session. To reset or disable it, manually modify the properties or set GeneralizeGeometry to false.
The following code block provides an example of how to set these properties using ArcGIS Server MapFunctionality and SOAP API LayerDescription in the Web ADF. After setting the values for LayerDescription, return geometry from a call to the ADF QueryFunctionality.Query method. The ADF geometries in the results (ADF FeatureGraphicsLayer) are generalized.
[C#]
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality agsMapFunctionality =
(ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality)mapFunctionality;
ESRI.ArcGIS.ADF.ArcGISServer.LayerDescription[] layerDescriptions =
agsMapFunctionality.MapDescription.LayerDescriptions;
ESRI.ArcGIS.ADF.ArcGISServer.LayerDescription activeLayerDescription =
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality.GetLayerDescription(activeLayerIDInt, layerDescriptions);
activeLayerDescription.LayerResultOptions.GeometryResultOptions.GeneralizeGeometries
= true;
activeLayerDescription.LayerResultOptions.GeometryResultOptions.MaximumAllowableOffset = 10000;
Do not create child controls in a custom control
When creating custom server controls for use with the Web ADF, such as Web tasks, the control often contains a collection of child controls, such as buttons, textboxes, and tables. Each request to the page iterates through the page and control lifecycle, which includes creating every control and its child controls. If a request is not processed by your custom server control, you can skip the creation of child controls. The easiest way to do this is to add conditional logic to the custom server control CreateChildControls method (usually the location where child controls are created and added to the parent control collection).
Two scenarios follow. Both use the utility class, AsyncOptimizer, to determine the caller in an async request and determine if CreateChildControls in the custom control should continue. The AsyncOptimizer class is included in the SDK sample Common CustomTasks.
- Scenario 1: Simple custom task with no child controls that generate async calls
protected override void CreateChildControls()
{
base.CreateChildControls();
#region Do not create child controls in an async call if this control is not
participating in the call
AsyncOptimizer asyncOptimizer = new AsyncOptimizer(this);
if (!asyncOptimizer.RequiresChildControls)
return ;
#endregion
- Scenario 2: Full-featured custom task with child controls and tools that generate async calls
protected override void CreateChildControls()
{
base.CreateChildControls();
#region Do not create child controls in an asyn call if this control is not
participating in the call
AsyncOptimizer asyncOptimizer = new AsyncOptimizer(this);
if (!asyncOptimizer.RequiresChildControls)
return ;
#endregion
#region Create Child Controls
< insert child control creation code here >
#endregion
#region Register child controls that can handle async calls
//Child controls that handle async calls:
asyncOptimizer.ChildControlsHandlingAsyncCalls.Clear();
asyncOptimizer.ChildControlsHandlingAsyncCalls.Add(treeviewPlus.UniqueID);
//Map tools on this control:
asyncOptimizer.MapToolsHandlingAsyncCalls.Clear();
asyncOptimizer.MapToolsHandlingAsyncCalls.Add(tlAddFeatures.Name);
#endregion
}