PopChart Embedder Configuration

Another important step in setting up your cluster is figuring out how to use the PopChart Embedder. Specifically, clustering may affect the values of up to three attributes in your PopChart Embedder code: externalServerAddress, internalCommPortAddress, and clusterMonitorAddress.

PopChart Embedder interfaces between your web applications and PopChart Server. All communication between PopChart Embedder and PopChart Server is done through the communications port (commport). This address is set using the internalCommPortAddress attribute of the PopChart Embedder. Meanwhile, images are served to the client from the PopChart Server's main port, set by PopChart Embedder's externalServerAddress attribute. By default the main port is 2001 and the commport is 2002.

The main port may be exposed directly, however it is common to use one of the PopChart's HTTP redirectors to redirect http requests on port 80 on the web server to PopChart Server's main port. Refer to Chapter 12, "HTTP Redirection," for details.

The PopChart Server commport should not be exposed outside of your firewall. However, this IP and port needs to be visible to the application using the PopChartEmbedder.

Configuring the Commport Address

The value that you set for the comm port address ( internalCommPortAddress) will depend on your network architecture.

network architecture is similar to Example 13.1 through Example 13.5.

If PopChart Server is running on the same physical server as your Application Server (each Application Server has a 1:1 mapping to a PopChart Server), then you can set the comm port address to your local computer, as in the following line of code:

myPopChart.internalCommPortAddress= "127.0.0.1:2002"

This, of course, assumes that the comm port is 2002.

If you want your Application Servers to be able to talk to several PopChart Servers in the cluster, but the Application Server will talk to them directly (not through a load balancer), then you need to use a pcClusterMonitor (refer to "Configuring the ClusterMonitor Address"). If this is the case, you will not use internalCommPortAddress. The same is true if your applications are running on different machines than your PopChart Servers, and the applications are talking directly to the PopChart Servers (not through a load balancer). This situation could be possible in a network architecture similar to that of Example 13.2 through Example 13.5.

Network Architecture is Similar to Example 13.6

If a load balancer is exposing a virtual IP:port combination to your Application Servers for the PopChart Cluster commport, then you would want to set your comm port address to the virtual address being exposed by your load balancer. For example, if your load balancer maps the virtual address 100.10.20.50:2002 to your PopChart Cluster (i.e. it randomly picks a PopChart Server to forward communication to), you would assign your comm port as follows:

myPopChart.internalCommPortAddress = "100.10.20.50:2002"

Configuring the Server Address

The value of your server address ( externalServerAddress) will also depend on your network configuration.

Server Address with HTTP Redirection

If you are using a redirector, set the server address to point to the address of the redirector. Refer to Chapter 12, "HTTP Redirection," for details.

Network Architecture Similar to Example 13.1

In Example 13.1, applications running on server 1 would set their server address to the redirector running on server 1, while applications running on server 2 would set their server address to the redirector running on server 2, and so on. This is because each server is its own web server and requires its own redirector.

Network Architecture Similar to Example 13.2 through Example 13.6

In these examples, the server address will be the same for all of the Application Servers. This is because there is only one web server or virtual web server, and therefore only one HTTP redirector address.

Server Address without HTTP Redirection

In most configurations without a redirector, you will use a load balancer. This is the case in Example 13.2 and Example 13.6 ( Example 13.3- Example 13.5 require a redirector). In this case, set the server address to the virtual IP address and port that the load balancer assigns to the PopChart Cluster.

Configuring the ClusterMonitor Address

If you are using the pcClusterMonitor, you should never set the comm port address ( internalCommPortAddress).

If you are running on Windows and have IIS installed, you can use the ISAPI version of the pcClusterMonitor. You would set the monitor address in PopChart Embedder with this line of code:

myPopChart.clusterMonitorAddress = "http://localhost/scripts/pcClusterMonitor.dll/";

If you are using a Java-based Application Server you can use the servlet version of pcClusterMonitor. You would set the monitor address in PopChart Embedder with this line of code:

myPopChart.clusterMonitorAddress = "http://localhost/servlet/pcClusterMonitor/";

Note: These examples assume the cluster monitor is running on the same system as the web application server, which is highly recommended.