Configuring the Number of Parallel Checks (file check concurrency)
Viewing and Increasing Parallelism
The number of concurrently performed file checks (for example, antivirus checks) is 1 by default, so checks are performed serially.
To display the current value, run:
sofie file-check-concurrencyIf the parameter has not yet been stored in the configuration, the command displays the default value 1.
To increase the value, run:
sofie file-check-concurrency <number><number> must be an integer greater than or equal to 1. If it is equal to the current value, the command makes no change; a lower value is rejected. Confirmation is required before every increase.
If the number of available CPU cores can be detected, the command calculates a recommended maximum. It is 1 for a server with no more than three cores; on a larger server, it is the number of cores minus two. If you select a higher value, the command displays an additional warning and requires another confirmation.
After confirmation, the value is stored in the configuration, the number of partitions of the file_check queue in Apache Kafka is increased, and the sofie-worker service is restarted. The other application services are not restarted.
The number of Kafka partitions cannot be decreased automatically. The command therefore rejects a lower value and refers to the manual procedure below. Increase parallelism carefully.
Reducing Parallelism
This action must be performed when the application is “idle” and no tasks or checks are running. At a minimum, check in the admin interface that Packages → Queued is empty.
The procedure for reducing it is as follows:
Stop the application:
sofie stopCheck that consumers are no longer connected to the queue:
kafka-consumer-groups --bootstrap-server localhost:9092 --describe --all-groupsThis may take a while, so wait until you see:
Consumer group 'worker' has no active members.
Example:
[root@sofie]# kafka-consumer-groups --bootstrap-server localhost:9092 --describe --all-groups
Consumer group 'worker' has no active members.
GROUP TOPIC PARTITION CURRENT-OFFSET LOG-END-OFFSET LAG CONSUMER-ID HOST CLIENT-ID
worker syslog 0 1164 1164 0 - - -
worker file_workflow 0 116351 116351 0 - - -
worker check_integrity 0 1 1 0 - - -
worker scanner_status 0 11332 11332 0 - - -
worker file_check 5 3670 3670 0 - - -
worker file_check 3 29020 29020 0 - - -
worker file_check 4 3669 3669 0 - - -
worker file_check 1 29015 29015 0 - - -
worker file_check 2 3668 3668 0 - - -
worker file_check 0 29064 29064 0 - - -
worker package_workflow 0 38950 38950 0 - - -
worker encryption 0 84 84 0 - - -
worker email_queue 0 32 32 0 - - -
[root@sofie]#In this example, we can also see that the parallelism was set to 6 (based on the number of file_check partitions).
Delete and recreate the topic:
WARNING: This action deletes the Kafka message topic/queue (file_check), and if there are unresolved file checks in it, they will be lost and will not be performed. It is therefore advisable to first make sure that nothing is currently being checked. In the table above, this can be verified by checking that the value in the LAG column is 0. If it is not, we can start the application again, wait for completion, and start the procedure again later.
# delete the topic
kafka-topics --delete --topic file_check --bootstrap-server localhost:9092
# make sure it has disappeared
kafka-topics --describe --topic file_check --bootstrap-server localhost:9092
# create a new topic with 1 partition
kafka-topics --create --topic file_check --bootstrap-server localhost:9092 --partitions 1 --replication-factor 1
# make sure again that it has been created
kafka-topics --describe --topic file_check --bootstrap-server localhost:9092Modify the configuration so that it matches the new topic:
sed -i 's/^topic\.FILE_CHECK\.concurrency=.*/topic.FILE_CHECK.concurrency=1/' /etc/sofie/META-INF/microprofile-config.propertiesStart the application:
sofie startThis completes the process, and everything runs again with the default parallelism of 1, that is, serially.
Parallelism Higher Than 1
If we want concurrency higher than 1, we can directly modify the commands above, or set it to 1 and then increase it using the SOFiE command. For example, for concurrency 3:
sofie file-check-concurrency 3