Skip to content

⚗️Director-v0: Disable keep-alive connections #7405

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 26 additions & 20 deletions .github/workflows/ci-testing-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading