Project

General

Profile

Worker Processes - org-z2env-worker » History » Revision 4

Revision 3 (Henning Blohm, 26.08.2015 15:02) → Revision 4/6 (Henning Blohm, 26.08.2015 15:09)

h1. Worker Processes (org.z2env.worker) 

 A worker process component, when _prepared_ starts a new z2 Java process that keeps running until invalidated or some configured Runnable or Main class completes.  

 See also JAVADOC IWorkerProcess 

 ??The point in using worker process components is that this allows you to configure process configuration such as heap size via a component declaration in a central repository rather than using some scripting rules. Also, when using worker processes, the home process can be used to make sure actual application processes get restarted, in case of process crashes. Finally, in nontrivial and distributed scenarios, where a number of different node types are required, starting any combination of those from a single home process makes scale out configuration simple and robust.?? 

 A worker process component is declared by specifying some process configuration and some target states, e.g. like this: 

 <pre><code class="bash"> 
 org.z2env.component.type=org.z2env.worker 
 worker.process.vmOptions=-Xmx1024M 
 worker.states=mymodule/workerUp 
 </code></pre> 

 or like this, in case the component *mymodule/main* is a main component or supplies a Runnable. 

 <pre><code class="bash"> 
 org.z2env.component.type=org.z2env.worker 
 worker.process.vmOptions=-Xmx1024M 
 worker.states=mymodule/workerUp 
 worker.main=mymodule/main 
 </code></pre> 

 h2. Some Details 

 Some noteworthy facts: 

 * The command line for a worker process is computed by using the VM options defined in the worker process configuration, possibly adding debug configuration, and by copying all command line system properties found for the home process. That is: Command line system properties (some -D<name>=<value> params) will be passed on to worker processes. 

 * In general the *worker.debug=true* setting may be set in order to turn on remote debugging. This will only be effective, if the home process was started in debug mode. 

 * Worker processes may be _detached_. This means that a worker process is marked as obsolete but may still be kept running until all work has completed. This is the underpinning of the [[How_to_Gateway|Gateway]] feature that allows to keep web applications running in update situations until all sessions have completed. New worker process instances may be started already. In order to avoid port conflicts (in JMX and debug), the port settings are base numbers that will be increased with every new generation of worker process.  


 




 h2. Properties 

 |_. name |_. values | 
 | org.z2env.component.type | org.z2env.any | 
 | component.className | Name of the class that implements the any components |