Chart FX for Java and Web Farms (Server clustering)

Once you hit a certain threshold, cost-effective scalability requires the use of multiple processors spread across multiple servers. In other words, you'll need a Web Farm.

We mentioned that when using the getHTmlTag method a chart file is saved to disk. The one problem with web farm architecture is that when the browser comes back to the server to retrieve the file; the HTTP request could be directed to another server on the farm on which the chart was not originally saved, resulting in an empty chart placeholder on the page.

To address this issue, you can do the following:

1. Change the server affinity setting, which lets you instruct the service to route HTTP requests over the same physical server once the first request has gone through. However, affinity slows the system down by requiring it to maintain a user-to-server mapping and perform a lookup upon each request. In other words, changing server affinity compromises scalability and the benefits of request-based load balancing are lost.

2. Replicate the chart file on all servers in the web farm. Although this is possible in a variety of ways, there is no way to guarantee the chart file will be successfully replicated and stored on all servers by the time the browser requests it. This is especially true on intranets where latency effects are virtually non-existent.

3. Force all servers in the farm to generate charts on a unique server. In other words, tweak the JSP code to have all servers generate charts in a specified directory on a particular machine if the farm and make the browser look for charts in that directory. Although a viable solution, this makes chart integration and maintenance much more difficult. It will also shift performance bottlenecks to the hard drive on which the charts are being stored and prevent the application to be server fault tolerant, which is a nice addition when using a web farm.

In other words, generating a chart file that will be saved to disk poses many server performance and scalability problems on a Web Farm. Therefore, we suggest you use the getHtmlData method which bit-streams the chart directly to the browser, preventing many of the abovementioned issues and providing a more natural integration to a web farm.