Browse DevX
Sign up for e-mail newsletters from DevX


Scale Your Applications with Component Load Balancing-2 : Page 2




Building the Right Environment to Support AI, Machine Learning and Deep Learning

Setting Up Component Load Balancing
Figure 1: Application Center MMC snap-in with a routing cluster configured.
CLB is based on the fact that there is one computer or a cluster of computers that receive a request for an object. This server or cluster is called the COM+ routing cluster. It forwards requests to other servers within a COM+ application cluster. The COM+ application cluster is the group of servers that are configured to service requests from a routing cluster. To create a COM+ routing cluster, the Microsoft Management Console (MMC) snap-in for Application Center provides a wizard that steps you through the process. Figure 1 displays a routing cluster called ZodiacCluster in the tree view on the left.

The COM+ routing server must perform two tasks: route requests to the appropriate application server and poll the application servers for information regarding the current load on the server. The data collected is timing data on each component configured to be load balanced on the server. The routing server uses the timing data to rank the servers and control which server will receive the next request.

Figure 2: Setting up the COM+ application cluster.
Once the COM+ routing cluster has been setup, the COM+ application cluster must be configured. Servers can be added to the application cluster through the properties tab of COM+ routing cluster. Figure 2 displays the properties tab with two servers in the application cluster.

Figure 3: Activation settings for classes on a CLB server.
The last configuration that must be made is to configure which components are load balanced. This is performed on a per-class basis. Each class in the application cluster must be declared to support dynamic load balancing. To perform this, an administrator can check off the "Component supports dynamic load balancing" checkbox on the activation page of a class's property page in the Component Services Explorer as shown in Figure 3.

Turning on this checkbox allows CLB to collect timing data on each component every 200 milliseconds. How the CLB service collects this data is undocumented. Once the components have been configured they can be deployed to each server in the application cluster. Application Center offers tools to help define and deploy the application.

From the client's standpoint, instantiating objects being load balanced by CLB is the same as instantiating a component using DCOM. All you need to do is pass the name of the CLBS into the CreateObject function or set the RemoteServerName attribute for the component in the registry.

Figure 4: Architecture behind the Component Load Balancing Service.
The CLBS uses two services to manage the routing of activation requests. The first, as mentioned before, is the SCM which runs in the RPCSS service. In addition, Application Center has another service called COMLB. This service is responsible for collecting the timing information and maintaining the ordered list of servers to route requests to. Figure 4 shows the architecture.

In Application Center, the SCM is extended to inspect an ordered list of servers in the COM+ application cluster. This ordered list is maintained by the COMLB service. The listing of servers is maintained in shared memory between the SCM and the COMLB services. In order to keep the listing of servers accurate and determine which server has the lightest load, the COMLB services uses the stub objects in COM+ to intercept the calls and perform some pre and post processing. In MTS, the stub was used to determine how many instances of a class were active.

Once the server has been chosen from the order lists of servers in the shared memory, the COM+ routing server SCM forwards the activation request to the other server's SCM. If the instantiation of the object fails, the COM+ routing server moves to the next server in a round-robin algorithm and continues until a valid interface pointer is returned to the client. From this point, all communication will occur directly between the client and the server that handled the request.

Issues with Application Center
One problem that arises with CLB is that the configuration of the components must be the same on all of the servers within the application cluster. If one of the servers has a different configuration, random results may occur. If one component was set with a different security setting on servers in the application cluster, users may be able to run the application if the CLB server forwards a request to a server that allows them access, but other times it may forward the request to a server that denies them access. These types of random results would be difficult to track down. To solve this, Microsoft has added tools in Application Center to give administrators the ability to easily deploy applications across multiple computers.

The other issue that arises is performance. By moving the components to another computer throughput will decline. This is true whenever calls are made over a network instead of calling and out-of-process or in-process component on the same server. Initial test show that an out-of-process component on the same server is three times faster then calls to another box and an in-process component on the same server is five times faster. This needs to be considered when you are planning the architecture for your Web site. If throughput is the most critical factor in your Web site, CLB is not the technology for you.

CLB is an extremely useful technology for building highly scalable applications and providing availability to your application servers. It provides the mechanism to route client requests to the least busy server, which results in a quick response time to client applications. This mechanism of finding the least busy server and forwarding requests to other servers is built directly into the COM SCM and a new service called COMLB.

Matthew Arnheiter is a Senior Consultant at GoAmerica Communications (www.goamerica.net) of Hackensack, NJ. He has also the author of: "The Visual Basic Developer's Guide to Design Patterns and UML" (Sybex, 2000) He can be reached here.
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date