diff --git a/.github/workflows/ci-testing-deploy.yml b/.github/workflows/ci-testing-deploy.yml index 857601cfb93c..02bd934b643b 100644 --- a/.github/workflows/ci-testing-deploy.yml +++ b/.github/workflows/ci-testing-deploy.yml @@ -1897,14 +1897,14 @@ jobs: path: /${{ runner.temp }}/build attempt_limit: 5 attempt_delay: 1000 - - name: load docker images - run: make load-images local-src=/${{ runner.temp }}/build - name: install uv uses: astral-sh/setup-uv@v5 with: version: "0.5.x" enable-cache: false cache-dependency-glob: "**/web/server/requirements/ci.txt" + - name: load docker images + run: make load-images local-src=/${{ runner.temp }}/build - name: show system version run: ./ci/helpers/show_system_versions.bash - name: install @@ -1961,14 +1961,14 @@ jobs: path: /${{ runner.temp }}/build attempt_limit: 5 attempt_delay: 1000 - - name: load docker images - run: make load-images local-src=/${{ runner.temp }}/build - name: install uv uses: astral-sh/setup-uv@v5 with: version: "0.5.x" enable-cache: false cache-dependency-glob: "**/web/server/requirements/ci.txt" + - name: load docker images + run: make load-images local-src=/${{ runner.temp }}/build - name: show system version run: ./ci/helpers/show_system_versions.bash - name: install @@ -2025,14 +2025,14 @@ jobs: path: /${{ runner.temp }}/build attempt_limit: 5 attempt_delay: 1000 - - name: load docker images - run: make load-images local-src=/${{ runner.temp }}/build - name: install uv uses: astral-sh/setup-uv@v5 with: version: "0.5.x" enable-cache: false cache-dependency-glob: "**/director-v2/requirements/ci.txt" + - name: load docker images + run: make load-images local-src=/${{ runner.temp }}/build - name: show system version run: ./ci/helpers/show_system_versions.bash - name: install @@ -2096,8 +2096,6 @@ jobs: path: /${{ runner.temp }}/build attempt_limit: 5 attempt_delay: 1000 - - name: load docker images - run: make load-images local-src=/${{ runner.temp }}/build - name: install rclone run: sudo ./ci/github/helpers/install_rclone.bash - name: install uv @@ -2106,6 +2104,8 @@ jobs: version: "0.5.x" enable-cache: false cache-dependency-glob: "**/director-v2/requirements/ci.txt" + - name: load docker images + run: make load-images local-src=/${{ runner.temp }}/build - name: show system version run: ./ci/helpers/show_system_versions.bash - name: install @@ -2162,8 +2162,6 @@ jobs: path: /${{ runner.temp }}/build attempt_limit: 5 attempt_delay: 1000 - - name: load docker images - run: make load-images local-src=/${{ runner.temp }}/build - name: install rclone run: sudo ./ci/github/helpers/install_rclone.bash - name: install uv @@ -2172,6 +2170,8 @@ jobs: version: "0.5.x" enable-cache: false cache-dependency-glob: "**/dynamic-sidecar/requirements/ci.txt" + - name: load docker images + run: make load-images local-src=/${{ runner.temp }}/build - name: show system version run: ./ci/helpers/show_system_versions.bash - name: install @@ -2229,14 +2229,14 @@ jobs: path: /${{ runner.temp }}/build attempt_limit: 5 attempt_delay: 1000 - - name: load docker images - run: make load-images local-src=/${{ runner.temp }}/build - name: install uv uses: astral-sh/setup-uv@v5 with: version: "0.5.x" enable-cache: false cache-dependency-glob: "**/docker-api-proxy/requirements/ci.txt" + - name: load docker images + run: make load-images local-src=/${{ runner.temp }}/build - name: show system version run: ./ci/helpers/show_system_versions.bash - name: install @@ -2293,14 +2293,14 @@ jobs: path: /${{ runner.temp }}/build attempt_limit: 5 attempt_delay: 1000 - - name: load docker images - run: make load-images local-src=/${{ runner.temp }}/build - name: install uv uses: astral-sh/setup-uv@v5 with: version: "0.5.x" enable-cache: false cache-dependency-glob: "**/simcore-sdk/requirements/ci.txt" + - name: load docker images + run: make load-images local-src=/${{ runner.temp }}/build - name: show system version run: ./ci/helpers/show_system_versions.bash - name: install @@ -2381,14 +2381,14 @@ jobs: path: /${{ runner.temp }}/build attempt_limit: 5 attempt_delay: 1000 - - name: load docker images - run: make load-images local-src=/${{ runner.temp }}/build - name: install uv uses: astral-sh/setup-uv@v5 with: version: "0.5.x" enable-cache: false cache-dependency-glob: "**/public-api/requirements/ci.txt" + - name: load docker images + run: make load-images local-src=/${{ runner.temp }}/build - name: show system version run: ./ci/helpers/show_system_versions.bash - name: install @@ -2441,14 +2441,14 @@ jobs: path: /${{ runner.temp }}/build attempt_limit: 5 attempt_delay: 1000 - - name: load docker images - run: make load-images local-src=/${{ runner.temp }}/build - name: install uv uses: astral-sh/setup-uv@v5 with: version: "0.5.x" enable-cache: false cache-dependency-glob: "**/swarm-deploy/requirements/ci.txt" + - name: load docker images + run: make load-images local-src=/${{ runner.temp }}/build - name: show system version run: ./ci/helpers/show_system_versions.bash - name: install @@ -2512,14 +2512,14 @@ jobs: path: /${{ runner.temp }}/build attempt_limit: 5 attempt_delay: 1000 - - name: load docker images - run: make load-images local-src=/${{ runner.temp }}/build - name: install uv uses: astral-sh/setup-uv@v5 with: version: "0.5.x" enable-cache: false cache-dependency-glob: "**/e2e/requirements/requirements.txt" + - name: load docker images + run: make load-images local-src=/${{ runner.temp }}/build - name: show system version run: ./ci/helpers/show_system_versions.bash - name: setup @@ -2699,6 +2699,12 @@ jobs: uses: docker/setup-buildx-action@v3 with: driver: docker-container + - name: install uv + uses: astral-sh/setup-uv@v5 + with: + version: "0.5.x" + enable-cache: false + cache-dependency-glob: "**/e2e-playwright/requirements/ci.txt" # FIXME: Workaround for https://github.com/actions/download-artifact/issues/249 - name: download docker images with retry uses: Wandalen/wretry.action@master diff --git a/packages/service-library/src/servicelib/fastapi/client_session.py b/packages/service-library/src/servicelib/fastapi/client_session.py index de700737399e..c3bc2728c647 100644 --- a/packages/service-library/src/servicelib/fastapi/client_session.py +++ b/packages/service-library/src/servicelib/fastapi/client_session.py @@ -2,9 +2,12 @@ from fastapi import FastAPI -def setup_client_session(app: FastAPI) -> None: +def setup_client_session(app: FastAPI, *, max_keepalive_connections: int = 20) -> None: async def on_startup() -> None: - session = httpx.AsyncClient(transport=httpx.AsyncHTTPTransport(http2=True)) + session = httpx.AsyncClient( + transport=httpx.AsyncHTTPTransport(http2=True), + limits=httpx.Limits(max_keepalive_connections=max_keepalive_connections), + ) app.state.aiohttp_client_session = session async def on_shutdown() -> None: diff --git a/services/director/src/simcore_service_director/core/application.py b/services/director/src/simcore_service_director/core/application.py index af9a787e1679..c6df150dde31 100644 --- a/services/director/src/simcore_service_director/core/application.py +++ b/services/director/src/simcore_service_director/core/application.py @@ -53,8 +53,10 @@ def create_app(settings: ApplicationSettings) -> FastAPI: if app.state.settings.DIRECTOR_TRACING: initialize_tracing(app, app.state.settings.DIRECTOR_TRACING, APP_NAME) - # replace by httpx client - setup_client_session(app) + setup_client_session( + app, + max_keepalive_connections=settings.DIRECTOR_REGISTRY_CLIENT_MAX_KEEPALIVE_CONNECTIONS, + ) setup_registry(app) setup_instrumentation(app) diff --git a/services/director/src/simcore_service_director/core/settings.py b/services/director/src/simcore_service_director/core/settings.py index a17f9175bff4..bf949cb58279 100644 --- a/services/director/src/simcore_service_director/core/settings.py +++ b/services/director/src/simcore_service_director/core/settings.py @@ -112,6 +112,7 @@ class ApplicationSettings(BaseApplicationSettings, MixinLoggingSettings): ), ) + DIRECTOR_REGISTRY_CLIENT_MAX_KEEPALIVE_CONNECTIONS: NonNegativeInt = 0 DIRECTOR_REGISTRY_CLIENT_MAX_CONCURRENT_CALLS: PositiveInt = 20 DIRECTOR_REGISTRY_CLIENT_MAX_NUMBER_OF_RETRIEVED_OBJECTS: PositiveInt = 30