Apache Ignite does not distribute an executing closure to a newly spawned node in the compute grid -
apache ignite version is: 2.1.0
i using default configuration client & servers. following client configuration. server configuration not have "clientmode" property.
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:util="http://www.springframework.org/schema/util" xsi:schemalocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> <bean abstract="true" id="ignite.cfg" class="org.apache.ignite.configuration.igniteconfiguration"> <!-- set true enable distributed class loading examples, default false. --> <property name="peerclassloadingenabled" value="true"/> <property name="clientmode" value="true"/> <!-- enable task execution events examples. --> <property name="includeeventtypes"> <list> <!--task execution events--> <util:constant static-field="org.apache.ignite.events.eventtype.evt_task_started"/> <util:constant static-field="org.apache.ignite.events.eventtype.evt_task_finished"/> <util:constant static-field="org.apache.ignite.events.eventtype.evt_task_failed"/> <util:constant static-field="org.apache.ignite.events.eventtype.evt_task_timedout"/> <util:constant static-field="org.apache.ignite.events.eventtype.evt_task_session_attr_set"/> <util:constant static-field="org.apache.ignite.events.eventtype.evt_task_reduced"/> <!--cache events --> <util:constant static-field="org.apache.ignite.events.eventtype.evt_cache_object_put"/> <util:constant static-field="org.apache.ignite.events.eventtype.evt_cache_object_read"/> <util:constant static-field="org.apache.ignite.events.eventtype.evt_cache_object_removed"/> </list> </property> <!-- explicitly configure tcp discovery spi provide list of initial nodes. --> <property name="discoveryspi"> <bean class="org.apache.ignite.spi.discovery.tcp.tcpdiscoveryspi"> <property name="ipfinder"> <!-- ignite provides several options automatic discovery can used instead os static ip based discovery. information on options refer our documentation: http://apacheignite.readme.io/docs/cluster-config --> <!-- uncomment static ip finder enable static-based discovery of initial nodes. --> <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.tcpdiscoveryvmipfinder">--> <!-- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.tcpdiscoverymulticastipfinder"> --> <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.tcpdiscoveryvmipfinder"> <property name="addresses"> <list> <!-- in distributed environment, replace actual host ip address. --> <value>210.104.106.91:47500..47509</value> <value>210.104.106.92:47500..47509</value> </list> </property> </bean> </property> </bean> </property> </bean> </beans> the closure gets executed on server nodes in grid expected.
when add new node executing below command grid during execution of closure
.\ignite.bat ..\examples\config\example-ignite.xml
the existing nodes acknowledge addition of new node in grid closure not distributed newly added node.
is there configuration available enable execution of closure node added during execution of closure?
edit 1:
below igniteclosure implementation class:
public class simpleinterestclosure implements igniteclosure<simpleinterestparam, accruedsimpleinterest> { private static final long serialversionuid = -5542687183747797356l; private static final biginteger hundred = new biginteger("100".getbytes()); private static logger log = logger.getlogger("simpleinterestclosure"); @override public accruedsimpleinterest apply(simpleinterestparam e) { biginteger si = e.getprincipal().multiply(new biginteger(e.getdurationinyears().tostring().getbytes())). multiply(new biginteger(e.getinterestrate().tostring().getbytes())).divide(simpleinterestclosure.hundred); log.info("calculated si id=" + e.getid()); return new accruedsimpleinterest(e, si); } } edit 2:
below method invokes igniteclosure implementation
public void method() throws igniteexception, ioexception { factory<simpleinterestclosure> siclosurefactory = factorybuilder.singletonfactoryof( new simpleinterestclosure()); classpathresource ress = new classpathresource("example-ignite.xml"); file file = new file(ress.getpath()); try (ignite ignite = ignition.start(file.getpath())) { log.info("started ignite cluster"); ignitefuture<collection<accruedsimpleinterest>> ignitefuture = ignite.compute() .applyasync(siclosurefactory.create(), createparamcollection()); collection<accruedsimpleinterest> res = ignitefuture.get(); } }
this sounds you're looking job stealing: http://apacheignite.readme.io/docs/load-balancing#job-stealing
although has bug may issue in particular case: http://issues.apache.org/jira/browse/ignite-1267
Comments
Post a Comment