com.hazelcast.jet.config

## Class InstanceConfig

- java.lang.Object
- - com.hazelcast.jet.config.InstanceConfig

-     public class InstanceConfig
      extends Object

  General configuration options pertaining to a Jet instance.
  Since:
    3.0

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `DEFAULT_BACKUP_COUNT` The default value of the `backup-count`
    `static int` | `DEFAULT_FLOW_CONTROL_PERIOD_MS` The default value of the `flow-control period`.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `InstanceConfig()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getBackupCount()` Returns the `number of backups` used for job metadata and snapshots.
    `int` | `getCooperativeThreadCount()` Returns the number of cooperative execution threads.
    `int` | `getFlowControlPeriodMs()` Returns the `flow-control period` in milliseconds.
    `long` | `getScaleUpDelayMillis()` Returns the scale-up delay, see `setScaleUpDelayMillis(long)`.
    `boolean` | `isLosslessRestartEnabled()` Returns if lossless restart is enabled, see `setLosslessRestartEnabled(boolean)`.
    `InstanceConfig` | `setBackupCount(int newBackupCount)` Sets the number of backups that Jet will maintain for the job metadata and snapshots.
    `InstanceConfig` | `setCooperativeThreadCount(int size)` Sets the number of threads each cluster member will use to execute Jet jobs.
    `InstanceConfig` | `setFlowControlPeriodMs(int flowControlPeriodMs)` While executing a Jet job there is the issue of regulating the rate at which one member of the cluster sends data to another member.
    `InstanceConfig` | `setLosslessRestartEnabled(boolean enabled)` Sets whether lossless job restart is enabled for the node.
    `InstanceConfig` | `setScaleUpDelayMillis(long millis)` Sets the delay after which auto-scaled jobs will restart if a new member is added to the cluster.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_FLOW_CONTROL_PERIOD_MS

          public static final int DEFAULT_FLOW_CONTROL_PERIOD_MS

      The default value of the `flow-control period`.
      See Also:
        Constant Field Values

    - #### DEFAULT_BACKUP_COUNT

          public static final int DEFAULT_BACKUP_COUNT

      The default value of the `backup-count`
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### InstanceConfig

          public InstanceConfig()

  - ### Method Detail

    - #### setCooperativeThreadCount

          @Nonnull
          public InstanceConfig setCooperativeThreadCount(int size)

      Sets the number of threads each cluster member will use to execute Jet jobs. This refers only to threads executing cooperative processors; each blocking processor is assigned its own thread.

    - #### getCooperativeThreadCount

          public int getCooperativeThreadCount()

      Returns the number of cooperative execution threads.

    - #### setFlowControlPeriodMs

          @Nonnull
          public InstanceConfig setFlowControlPeriodMs(int flowControlPeriodMs)

      While executing a Jet job there is the issue of regulating the rate at which one member of the cluster sends data to another member. The receiver will regularly report to each sender how much more data it is allowed to send over a given DAG edge. This method sets the length (in milliseconds) of the interval between flow-control ("ack") packets.

    - #### getFlowControlPeriodMs

          public int getFlowControlPeriodMs()

      Returns the `flow-control period` in milliseconds.

    - #### setBackupCount

          @Nonnull
          public InstanceConfig setBackupCount(int newBackupCount)

      Sets the number of backups that Jet will maintain for the job metadata and snapshots. Each backup is on another cluster member; all backup write operations must complete before the overall write operation can complete. The maximum allowed number of backups is 6 and the default is 1.

      For example, if you set the backup count to 2, Jet will replicate all the job metadata and snapshot data to two other members. If one or two members of the cluster fail, Jet can recover the data from the snapshot and continue executing the job on the remaining members without loss.

    - #### getBackupCount

          public int getBackupCount()

      Returns the `number of backups` used for job metadata and snapshots.

    - #### setScaleUpDelayMillis

          public InstanceConfig setScaleUpDelayMillis(long millis)

      Sets the delay after which auto-scaled jobs will restart if a new member is added to the cluster. The default is 10 seconds. Has no effect on jobs with auto scaling disabled.
      Parameters:
        `millis` - the delay, in milliseconds
      Returns:
        this instance for fluent API

    - #### getScaleUpDelayMillis

          public long getScaleUpDelayMillis()

      Returns the scale-up delay, see `setScaleUpDelayMillis(long)`.

    - #### isLosslessRestartEnabled

          public boolean isLosslessRestartEnabled()

      Returns if lossless restart is enabled, see `setLosslessRestartEnabled(boolean)`.

    - #### setLosslessRestartEnabled

          public InstanceConfig setLosslessRestartEnabled(boolean enabled)

      Sets whether lossless job restart is enabled for the node. With lossless restart you can restart the whole cluster without losing the jobs and their state. The feature is implemented on top of the Hot Restart feature of Hazelcast IMDG which persists the data to disk.

      If enabled, you have to also configure Hot Restart:

              JetConfig jetConfig = new JetConfig();
              jetConfig.getInstanceConfig().setLosslessRestartEnabled(true);
              jetConfig.getHazelcastConfig().getHotRestartPersistenceConfig()
                  .setEnabled(true)
                  .setBaseDir(new File("/mnt/hot-restart"))
                  .setParallelism(2);

      Note: the snapshots exported using `Job.exportSnapshot(java.lang.String)` will also have Hot Restart storage enabled.

      Feature is disabled by default. If you enable this option in open-source Hazelcast Jet, the member will fail to start, you need Jet Enterprise to run it and obtain a license from Hazelcast.

Copyright © 2019. All rights reserved.