Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request is a rebase of #1779 with some small adjustments and fixes. It introduces a new prefork execution model in MCPClient based on a process pool. The size of the pool is configurable and dynamically adjusted by the parent process. Workers are automatically restarted to free resources and will reuse database connections when possible. Logging is centralized with a queue that is shared with pool processes. Metrics are captured using mmap and collected by the parent process. For more details, see https://gist.github.com/sevein/f4ff0e024c1b394eedb196e63bdeb91c.
Two new settings were added:
ARCHIVEMATICA_MCPCLIENT_WORKERS
Number of workers. If undefined, it defaults to the number of CPUs available on the machine. Only client modules that define
concurrent_instances
will perform concurrent execution of tasks (e.g. identify_file_format).ARCHIVEMATICA_MCPCLIENT_MAX_TASKS_PER_CHILD
Maximum number of tasks a worker can execute before it's replaced by a new process in order to free resources.
After a few rounds of testing a new setting has added to limit the output of the metrics:
ARCHIVEMATICA_MCPCLIENT_MCPCLIENT_PROMETHEUS_DETAILED_METRICS
Send detailed metrics to Prometheus. With large transfers this might affect performance of the local storage in Prometheus and slow down its threads in Archivematica.
Connects to archivematica/Issues#943 and archivematica/Issues#1482.