Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update MCPClient forking model #1845

Merged
merged 2 commits into from
Jan 29, 2024
Merged

Conversation

replaceafill
Copy link
Member

@replaceafill replaceafill commented Sep 8, 2023

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.

@replaceafill replaceafill added AMAUAT Issues relating to the improvement of the AM Automated Acceptance tests and removed AMAUAT Issues relating to the improvement of the AM Automated Acceptance tests labels Sep 8, 2023
@replaceafill replaceafill force-pushed the dev/mcpclient-redux-take-three branch 2 times, most recently from 6148845 to 5a03268 Compare January 29, 2024 14:35
cole and others added 2 commits January 29, 2024 15:43
Rebase of #1779

Co-authored-by: Jesús García Crespo <[email protected]>
Co-authored-by: Miguel Angel Medinilla <[email protected]>
@replaceafill replaceafill force-pushed the dev/mcpclient-redux-take-three branch from 5a03268 to e0eeb76 Compare January 29, 2024 15:18
@replaceafill replaceafill added AMAUAT Issues relating to the improvement of the AM Automated Acceptance tests and removed AMAUAT Issues relating to the improvement of the AM Automated Acceptance tests labels Jan 29, 2024
@replaceafill replaceafill merged commit 91d17ad into qa/1.x Jan 29, 2024
39 of 41 checks passed
@replaceafill replaceafill deleted the dev/mcpclient-redux-take-three branch January 29, 2024 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants