Project

General

Profile

Worker Processes - org-z2env-worker » History » Version 5

Henning Blohm, 26.08.2015 15:27

1 1 Henning Blohm
h1. Worker Processes (org.z2env.worker)
2 2 Henning Blohm
3 3 Henning Blohm
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. 
4 1 Henning Blohm
5 3 Henning Blohm
See also JAVADOC IWorkerProcess
6
7 2 Henning Blohm
??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.??
8
9
A worker process component is declared by specifying some process configuration and some target states, e.g. like this:
10
11
<pre><code class="bash">
12
org.z2env.component.type=org.z2env.worker
13
worker.process.vmOptions=-Xmx1024M
14
worker.states=mymodule/workerUp
15
</code></pre>
16
17
or like this, in case the component *mymodule/main* is a main component or supplies a Runnable.
18
19
<pre><code class="bash">
20
org.z2env.component.type=org.z2env.worker
21
worker.process.vmOptions=-Xmx1024M
22
worker.states=mymodule/workerUp
23
worker.main=mymodule/main
24 1 Henning Blohm
</code></pre>
25 3 Henning Blohm
26
h2. Some Details
27
28 4 Henning Blohm
Some noteworthy facts:
29 3 Henning Blohm
30 4 Henning Blohm
* 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.
31
32
* 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.
33
34
* 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. 
35 3 Henning Blohm
36
37
h2. Properties
38
39
|_. name |_. values |
40 5 Henning Blohm
| org.z2env.component.type | org.z2env.worker |
41
| worker.process.vmOptions | General virtual machine parameters for the worker process. See for example http://blogs.sun.com/watt/resource/jvm-options-list.html for a general overview. |
42
| worker.mainComponent | Main component of the worker process. If specified this component will be invoked after loading the target states. The component is either a Main class with a main method (that is, it supports a java.lang.Class lookup) or a {@link Runnable} (lookup as {@link Runnable} that is). |
43
| worker.states | Comma-separated list of target states (or dependency components) of the worker process (see above). The worker process will try to attain these target states (or prepare these dependency components) and will try so again during each verification and synchronization. |
44
| worker.process.timeouts.start | Timeout in milliseconds. This time out determines when the worker process implementation will forcibly kill the worker process if it has not reported startup completion until then. |
45
| worker.process.timeouts.termination | Timeout in milliseconds. This time out determines when the worker process implementation will forcibly kill the worker process if it has not terminated after this timeout has passed since it was asked to terminate. |
46
| worker.process.timeouts.communication | Timeout in milliseconds. This time out is the default timeout that determines the time passed after which the worker process implementation will forcibly kill a worker process if a message request has not returned. |
47
| worker.concurrency | Size of application thread pool (see {@link ApplicationThreadPool}). This pool is used by z2 internals but may be used by applications as well. Ignore this, if you do not use the built-in thread pool |
48
| worker.debug | Debugging for the worker process will be configured if this property is set to *true* and the home process has debugging enabled. Otherwise the worker process will not be configured for debugging. |
49
| worker.debug.port | The debug port to use for this worker process, if it is configured for debugging. This port is subject to variant computation in the presence of detached worker processes. |
50
| worker.jmx.port | The jmx port to use for this worker process. This port is subject to variant computation in the presence of detached worker processes. |