Enable parallel processing

In cluster mode, you can specify the parallelism (the number of instances to run) to enable parallel processing for a function.

Example1

Specify the --parallelism flag of the create command when deploying a function.

  1. bin/pulsar-admin functions create \
  2. --parallelism 3 \
  3. # Other function info

Enable parallel processing - 图1tip

For an existing function, you can adjust the parallelism by using the update command.

Example2

Specify the parallelism parameter when deploying a function configuration through YAML.

  1. # function-config.yaml
  2. parallelism: 3
  3. inputs:
  4. - persistent://public/default/input-1
  5. output: persistent://public/default/output-1
  6. # other parameters

For an existing function, you can adjust the parallelism by using the update command as follows.

  1. bin/pulsar-admin functions update \
  2. --function-config-file $PWD/function-config.yaml