Dundas Data Visualization Support Site
Dundas Support Site Home  |  Contact Us  |  Dundas Data Visualization  
Contact Us via Email

How to use Dundas Chart with a Web Garden or Server Farm


Version: This article only applies to Dundas Chart for ASP.NET v5.5 or later, and Dundas Chart for SharePoint.

Web garden and web farm environments have similar effects on the use of Dundas Chart under its default settings. Problems can occur such as mismatched, broken or distorted Chart images, or incorrect behavior when using Dundas Chart's AJAX functionality. These are caused by one process or web server handling the request for the page, and a different process/server handling the next request for the page or an image.

  • Image-based server controls typically must generate an image during the request for the page, and render it as an <img> tag in HTML; however the client browsers must issue an additional request to download the actual image referenced in this tag. If Dundas Chart stores this image in memory, its default setting, it cannot be shared between processes or servers, so the correct image cannot always be provided when requested.

  • Dundas Chart's AJAX features require the use of session state, since they use .NET callbacks to render updates. (Unlike postbacks, or partial postbacks with an UpdatePanel, Dundas Chart's callbacks do not render the entire page and its view state, improving the performance of its interactivity.) This causes a problem when using multiple processes or servers if your web site is configured to use in-process session state, which it does by default.

To ensure correct behavior, you can either configure your server(s) to prevent requests from individuals from being alternated between multiple processes or servers, or you can configure Dundas Chart's temporary images and ASP.NET's session state to be shared between them.

Ensuring One Process/Server Per Session

If you are using IIS version 6 or higher (in Windows Server 2003, Windows Vista, or newer versions of Windows), each ASP.NET application is assigned an application pool. Application pools can be configured to use multiple worker processes in the pool, which is called a "web garden". By default, the number of worker processes is one. To check or configure this, go to the Performance tab of the application pool's Properties in IIS Manager. (Microsoft TechNet offers more details.)

If you are using multiple servers for load balancing (a server farm or cluster), you can configure the cluster's affinity to ensure one host handles all requests from the same client (single or Class C affinity, for example). This is sometimes called "sticky sessions." More details can be found here.

Once you have ensured there is no more than one worker process for each application with Dundas Chart, and configured the affinity settings for your cluster, no further actions are necessary to ensure the correct behavior of Dundas Chart with respect to your web garden or web farm.

Sharing Temporary Images and Session State

If you instead choose the option to share temporary data and session state between processes or servers, the following steps are necessary to configure your application:

  1. Save temporary files generated by Dundas Chart outside of memory. There are two methods of doing this:
    • Storing temporary files in the file system. In your Web.Config file, under <appSettings>, modify the value for storage and change it from "memory" (the default) to "file".
        <add key="ChartHttpHandler" value="Storage=file;Timeout=180;Url=~/temp/;"/>

      In web farm environments, the Url that you specify must map to a central location, which is saved to by all servers in the farm. This can be done using a virtual directory that maps to a common shared folder on the network. You may optionally specify a value for the Dir attribute, which corresponds to the folder location of a server path to which all temporary images are stored: again, this should be a central location common to Dundas Chart's settings on all servers. A unique machine ID is added to each temporary file to prevent Chart images from being overwritten by another machine. (ASP.NET version only)

      <add key="ChartHttpHandler" value="Storage=file;Timeout=60;

      If you are using SharePoint and a single server machine, the following is a good location to save temporary files on the SharePoint server:

        <add key="ChartHttpHandler" value="Storage=file;Timeout=60;Url=~/_layouts/Dundas/Charting/Temp/;" />
    • Storing temporary data in a database or other location. You can also choose to use a database server or any storage medium of your choice to hold temporary images. To do this, you must create a custom image handler by implementing ChartHttpHandler.IImageHandler to save and retrieve binary data to/from your data store.

      You can find the ChartHttpHandler.IImageHandler interface in the language reference section of the documentation. Class file templates and more details are available for download here.

  2. Implement out-of-process session state. There are two options for this as well:
    • Using State Server mode. Modify your website's Web.Config file to save session state out-of-process. To do this, add the following tag within the <System.Web> tags:
      <sessionState mode="StateServer" stateConnectionString="tcpip=StateServerName:42424" />

      This method uses the ASP.NET state service, and can be configured to run either on the same machine or on a different machine. Visit this Technet article for details on ensuring that the ASP.NET state service is running.

    • Using SQL Server mode. An alternative to using the State Server mode for out-of-process state storage is SQL Server mode, to persist session state in Microsoft SQL Server rather than in memory. Here are some external links to help you set up SQL Server State Persistence:

    For more information on the available session state modes and their configuration, see this article in the MSDN Library.

  3. Consider reducing the value for time-to-live. This step is not required, but it can help to lower the number of temporary files on the server.

    The Timeout attribute corresponds to a "time-to-live" (in seconds) for temporary files. Files that remain for a longer period of time than this may be overwritten in the order that they were created. For example, if the Timeout is set to 360, and the first file (File1) has been stored for more than 360 seconds (6 mins), the next file created will overwrite File1.

    By default Timeout is set to 180 (three minutes), which is more than enough. Even on a slow Internet connection, it does not take this long to download these files. Since each subsequent request results in the creation of more temp files until old files time-out, it can be helpful to keep this in check.

      <add key="ChartHttpHandler" value="Storage=file;Timeout=60;"/>

Below is a sample abstract of a Web.Config file for a website using Dundas Chart:

      <add key="ChartHttpHandler" value="Storage=file;Timeout=60;Url="~/temp/" />
     <add path="ChartAxd.axd" verb="*"type="Dundas.Charting.WebControl.ChartHttpHandler" validate="false"/>
<sessionState mode="StateServer" cookieless="false" timeout="20" />