New HPC WCF Feature... Use Compute Cluster as Scalable SOA Platform

HPC_SOA

 

Windows HPC Server 2008 exposes two new service interfaces.  One is intended for compliance with cross-platform cluster interoperability (i.e. OGF's HPCBP specification).  The other extends high-performance computing platform technologies into the Service Oriented Architecture (SOA) solutions arena.

A cluster aware SOA client application initiates a session with the cluster scheduler.  The scheduler launches or assigns SOA Service Broker (also referred to as Service Router) nodes along with 1 or more SOA Service Instance processes on compute nodes to the session.  The number of broker and service instance process depends upon the job scheduling requirements as specified either by the client application or by pre-configured administrative scheduler templates customized with consideration of usage scenario dependent resource requirements. 

After resource assignment, the compute job becomes an interactive exchange between the client(s) and the Service Broker(s).  The broker(s) route and load balance service requests between the client and Service Instance(s).  Brokers also assist the scheduler service with management of service instance lifetimes and cluster resource grow/shrink policies.

Service Instances are responsible for hosting Windows Communication Foundation (WCF) components referred to as Endpoints.   Endpoints are registered on compute nodes.  Basically, Endpoints consist of an Address + Binding + Contract implemented as follows.  Client applications open a session with the cluster, specify the endpoint name, and subsequently interact with the endpoint via the Service Broker.

 

Service WCF Component:

using System.ServiceModel;

namespace EchoSvcLib
{

    [ServiceContract]
    public interface IEchoSvc
    {
        [OperationContract]
        string Echo(string input);
    }

    public class EchoSvc : IEchoSvc
    {
        public string Echo(string input)
        {
            return Environment.MachineName + ":" + input;
        }
    }
}

 

Service Assembly Configuration:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
         <appSettings>
                   <add key="assembly" value="c:\Services\EchoSvcLib.dll"/>
                   <add key="type" value="EchoSvcLib.EchoSvc"/>
                   <add key="contract" value="EchoSvcLib.IEchoSvc"/>
         </appSettings>
</configuration>

 

Client Application:

using System.ServiceModel;
using Microsoft.ComputeCluster.Scheduler.Session;

namespace EchoClient
{
    class Program
    {
        static void Main(string[] args)
        {
            string scheduler = "localhost";
            string serviceName = "EchoSvc";

            // Create a session object that specifies the head node
            // to which to connect and the name of the WCF service to use.
            // This example uses the default start information for a session.
            SessionStartInfo info = new SessionStartInfo(scheduler, serviceName);
            info.ResourceUnitType = Microsoft.ComputeCluster.Scheduler.JobUnitType.Node;
            info.MinimumUnits = 1;
            info.MaximumUnits = 4;
            using (Session session = Session.CreateSession(info))
            {
                Console.WriteLine("Session's Endpoint Reference:{0}", session.EndpointReference.ToString());

                // Binds session to the client proxy using NetTcp binding (specify only NetTcp binding). The
                // security mode must be Transport and you cannot enable reliable sessions.
                EchoSvcClient client = new EchoSvcClient(new NetTcpBinding(SecurityMode.Transport, false), session.EndpointReference);

                for (int i = 0; i < 100; i++)
                {
                    client.BeginEcho("hello world", EchoCallback, new RequestState(client, i));
                }
                client.Close();
            }
       }
    }
}

 

Learn more about this SOA computing model by joining the HPC Server 2008 beta program.  Register for the program at https://connect.microsoft.com.  Participate in the Windows HPC community at https://WindowsHPC.net.  Learn more about WCF by searching "https://Live.Com" for "WCF site:microsoft.com".  Also search for "HPC" on "https://channel9.msdn.com".