Archived

This forum has been archived. Please start a new discussion on GitHub.

Does IceStorm support load balancing

ice version:3.5

The first question: Does IceStorm support load balancing policies In this version?Because in our system, each client is an information publisher, and the server is a subscriber.

The second question: If it supports load balancing, I finished it according to C++ example of an IceGrid deployment in the directory demo/IceStorm/replicated

I finished it like this:
192.168.1.144 hosts
Create a registry and node configuration file,the file contains the following properties:
IceGrid.InstanceName=DemoIceGrid

Ice.Default.Locator=DemoIceGrid/Locator:default -h 192.168.1.144 -p 4061

IceGrid.Registry.Client.Endpoints=default -h 192.168.1.144 -p 4061
IceGrid.Registry.Server.Endpoints=default -h 192.168.1.144  
IceGrid.Registry.Internal.Endpoints=default -h 192.168.1.144 
IceGrid.Registry.Data=C:\IceGrid\registry1
IceGrid.Registry.PermissionsVerifier=DemoIceGrid/NullPermissionsVerifier
IceGrid.Registry.AdminPermissionsVerifier=DemoIceGrid/NullPermissionsVerifier
IceGrid.Registry.SSLPermissionsVerifier=DemoIceGrid/NullSSLPermissionsVerifier
IceGrid.Registry.AdminSSLPermissionsVerifier=DemoIceGrid/NullSSLPermissionsVerifier

IceGrid.Node.Name=node1
IceGrid.Node.Endpoints=default -h 192.168.1.144 
IceGrid.Node.Data=C:\IceGrid\node1
IceGrid.Node.CollocateRegistry=1

# Trace properties.
IceGrid.Node.Trace.Activator=3
IceGrid.Node.Trace.Adapter=3
IceGrid.Node.Trace.Replica=3
IceGrid.Node.Trace.Server=3
IceGrid.Registry.Trace.Adapter=1
IceGrid.Registry.Trace.Node=2

#
# Dummy username and password for icegridadmin.
#
IceGridAdmin.Username=foo
IceGridAdmin.Password=bar

the server descriptor:
<icegrid>
	<application name="DemoIceStorm">
		<server-template id="IceStorm">
			<parameter name="index" />
			<parameter name="topic-manager-endpoints" default="default -h localhost" />
			<parameter name="publish-endpoints" default="default -h localhost" />
			<parameter name="node-endpoints" default="default -h localhost" />
			<parameter name="instance-name" />
			<icebox id="${instance-name}-${index}" exe="icebox"
				activation="on-demand">
				<service name="IceStorm" entry="IceStormService,35:createIceStorm">
					<dbenv name="${service}" />
					<adapter name="${service}.TopicManager" endpoints="${topic-manager-endpoints}"
						replica-group="${instance-name}-TopicManagerReplicaGroup" />
					<adapter name="${service}.Publish" endpoints="${publish-endpoints}"
						replica-group="${instance-name}-PublishReplicaGroup" />
					<adapter name="${service}.Node" endpoints="${node-endpoints}" />
					<properties>
						<property name="${service}.InstanceName" value="${instance-name}" />
						<property name="${service}.Trace.TopicManager" value="2" />
						<property name="${service}.Trace.Topic" value="1" />
						<property name="${service}.Trace.Subscriber" value="1" />
						<property name="${service}.NodeId" value="${index}" />
					</properties>
				</service>
			</icebox>
		</server-template>
		<replica-group id="DemoIceStorm-PublishReplicaGroup">
		</replica-group>
		<replica-group id="DemoIceStorm-TopicManagerReplicaGroup">
			<load-balancing type="round-robin" />
			<object identity="DemoIceStorm/TopicManager" type="IceStorm.TopicManager" />
		</replica-group>
		<node name="node1">
			<server-instance template="IceStorm" index="1"
				instance-name="DemoIceStorm" />
			<server-instance template="IceStorm" index="2"
				instance-name="DemoIceStorm" />
			<server-instance template="IceStorm" index="3"
				instance-name="DemoIceStorm" />
		</node>
		<node name="node2">
			<server-instance template="IceStorm" index="4"
				instance-name="DemoIceStorm" />
			<server-instance template="IceStorm" index="5"
				instance-name="DemoIceStorm" />
			<server-instance template="IceStorm" index="6"
				instance-name="DemoIceStorm" />
		</node>
	</application>
</icegrid>

192.168.1.155 hosts
Create a node configuration file,the file contains the following properties:
#The IceGrid locator proxy. 
Ice.Default.Locator=DemoIceGrid/Locator:tcp -h 192.168.1.144 -p 4061

#IceGrid node configuration
IceGrid.Node.Name=node2
IceGrid.Node.Endpoints=default -h 192.168.1.155
IceGrid.Node.Data=C:\IceGrid\node2
IceGrid.Node.CollocateRegistry=0 

# Trace properties.
IceGrid.Node.Trace.Activator=3
IceGrid.Node.Trace.Adapter=3
IceGrid.Node.Trace.Replica=3
IceGrid.Node.Trace.Server=3
IceGrid.Registry.Trace.Adapter=1
IceGrid.Registry.Trace.Node=2
#Ice.Trace.Network=3
#Ice.Trace.Protocol=3
#Ice.Trace.Locator=3
#Ice.Trace.Retry=2
#Ice.LogFile=c:\IceGrid\log.txt
Starting the Node and Deploying the Application
Executing the Subscriber program,
The Java implementation of the Subscriber is shown below:
import IceStorm.AlreadySubscribed;
import IceStorm.BadQoS;
import iceGridAndIceBoxAndIceStorm.servant.MonitorI;
import publisherAndSubscribe.Monitor;

public class Subscriber extends Ice.Application {

	public int run(String[] args) {
		Ice.ObjectPrx obj = communicator().stringToProxy("DemoIceStorm/TopicManager");
		IceStorm.TopicManagerPrx topicManager = IceStorm.TopicManagerPrxHelper
				.checkedCast(obj);
		System.out.println("topicManager = "+topicManager);
		Ice.ObjectAdapter adapter = communicator().createObjectAdapter("WeatherMonitorAdapter");
		Monitor monitor1 = new MonitorI("the first monitor");
		Ice.ObjectPrx proxy1 = adapter.addWithUUID(monitor1).ice_oneway();
		adapter.activate();
		IceStorm.TopicPrx topic = null;
		try {
			topic = topicManager.retrieve("Weather");
		} catch (IceStorm.NoSuchTopic ex) {
			try
            {
                topic = topicManager.create("Weather");
            }
            catch(IceStorm.TopicExists it)
            {
                System.err.println("temporary failure, try again.");
            }
		}
		java.util.Map qos = null;
		try {
			topic.subscribeAndGetPublisher(qos, proxy1);
		} catch (AlreadySubscribed e) {
			e.printStackTrace();
		} catch (BadQoS e) {
			e.printStackTrace();
		}
		communicator().waitForShutdown();
		topic.unsubscribe(proxy1);
		return 0;
	}

	public static void main(String[] args) {
		Subscriber app = new Subscriber();
		System.exit(app.main("Server", args,"C:\\config.sub"));
	}
}
When the program execution here "topic = topicManager.retrieve("Weather");"
The thread seems to have been blocked
Terminal display log as follows
topicManager = DemoIceStorm/TopicManager -t -e 1.1
-- 13-8-13 10:21:10:437 Server: Network: attempting to bind to tcp socket 192.168.1.144:0
-- 13-8-13 10:21:10:437 Server: Network: listening for tcp connections at 192.168.1.144:3732
-- 13-8-13 10:21:10:453 Server: Network: published endpoints for object adapter `WeatherMonitorAdapter':
   tcp -h 192.168.1.144 -p 3732
-- 13-8-13 10:21:10:593 Server: Network: accepting tcp connections at 192.168.1.144:3732
-- 13-8-13 10:21:10:593 Server: Protocol: sending request 
   message type = 0 (request)
   compression status = 0 (not compressed; do not compress response, if any)
   message size = 70
   request id = 2
   identity = DemoIceStorm/TopicManager
   facet = 
   operation = retrieve
   mode = 1 (nonmutating)
   context = 
   encoding = 1.1
-- 13-8-13 10:21:10:593 Server: Network: sent 70 of 70 bytes via tcp
   local address = 127.0.0.1:3728
   remote address = 127.0.0.1:3709
-- 13-8-13 10:22:10:765 Server: Network: received 14 of 14 bytes via tcp
   local address = 192.168.1.144:3704
   remote address = 192.168.1.144:4061
-- 13-8-13 10:22:10:765 Server: Protocol: received close connection 
   message type = 4 (close connection)
   compression status = 1 (not compressed; compress response, if any)
   message size = 14
-- 13-8-13 10:22:10:765 Server: Network: closing tcp connection
   local address = 192.168.1.144:3704
   remote address = 192.168.1.144:4061

Program stops at the retrieve,Where is the wrong configuration?

Comments

  • Got the same problem, blocked on "retrieve ".
    can anyone help on this ?