Skip to content

Commit 8944b1f

Browse files
authored
⚗️Director-v0: Disable keep-alive connections (ITISFoundation#7405)
1 parent 85e24e8 commit 8944b1f

File tree

4 files changed

+36
-24
lines changed

4 files changed

+36
-24
lines changed

.github/workflows/ci-testing-deploy.yml

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1897,14 +1897,14 @@ jobs:
18971897
path: /${{ runner.temp }}/build
18981898
attempt_limit: 5
18991899
attempt_delay: 1000
1900-
- name: load docker images
1901-
run: make load-images local-src=/${{ runner.temp }}/build
19021900
- name: install uv
19031901
uses: astral-sh/setup-uv@v5
19041902
with:
19051903
version: "0.5.x"
19061904
enable-cache: false
19071905
cache-dependency-glob: "**/web/server/requirements/ci.txt"
1906+
- name: load docker images
1907+
run: make load-images local-src=/${{ runner.temp }}/build
19081908
- name: show system version
19091909
run: ./ci/helpers/show_system_versions.bash
19101910
- name: install
@@ -1961,14 +1961,14 @@ jobs:
19611961
path: /${{ runner.temp }}/build
19621962
attempt_limit: 5
19631963
attempt_delay: 1000
1964-
- name: load docker images
1965-
run: make load-images local-src=/${{ runner.temp }}/build
19661964
- name: install uv
19671965
uses: astral-sh/setup-uv@v5
19681966
with:
19691967
version: "0.5.x"
19701968
enable-cache: false
19711969
cache-dependency-glob: "**/web/server/requirements/ci.txt"
1970+
- name: load docker images
1971+
run: make load-images local-src=/${{ runner.temp }}/build
19721972
- name: show system version
19731973
run: ./ci/helpers/show_system_versions.bash
19741974
- name: install
@@ -2025,14 +2025,14 @@ jobs:
20252025
path: /${{ runner.temp }}/build
20262026
attempt_limit: 5
20272027
attempt_delay: 1000
2028-
- name: load docker images
2029-
run: make load-images local-src=/${{ runner.temp }}/build
20302028
- name: install uv
20312029
uses: astral-sh/setup-uv@v5
20322030
with:
20332031
version: "0.5.x"
20342032
enable-cache: false
20352033
cache-dependency-glob: "**/director-v2/requirements/ci.txt"
2034+
- name: load docker images
2035+
run: make load-images local-src=/${{ runner.temp }}/build
20362036
- name: show system version
20372037
run: ./ci/helpers/show_system_versions.bash
20382038
- name: install
@@ -2096,8 +2096,6 @@ jobs:
20962096
path: /${{ runner.temp }}/build
20972097
attempt_limit: 5
20982098
attempt_delay: 1000
2099-
- name: load docker images
2100-
run: make load-images local-src=/${{ runner.temp }}/build
21012099
- name: install rclone
21022100
run: sudo ./ci/github/helpers/install_rclone.bash
21032101
- name: install uv
@@ -2106,6 +2104,8 @@ jobs:
21062104
version: "0.5.x"
21072105
enable-cache: false
21082106
cache-dependency-glob: "**/director-v2/requirements/ci.txt"
2107+
- name: load docker images
2108+
run: make load-images local-src=/${{ runner.temp }}/build
21092109
- name: show system version
21102110
run: ./ci/helpers/show_system_versions.bash
21112111
- name: install
@@ -2162,8 +2162,6 @@ jobs:
21622162
path: /${{ runner.temp }}/build
21632163
attempt_limit: 5
21642164
attempt_delay: 1000
2165-
- name: load docker images
2166-
run: make load-images local-src=/${{ runner.temp }}/build
21672165
- name: install rclone
21682166
run: sudo ./ci/github/helpers/install_rclone.bash
21692167
- name: install uv
@@ -2172,6 +2170,8 @@ jobs:
21722170
version: "0.5.x"
21732171
enable-cache: false
21742172
cache-dependency-glob: "**/dynamic-sidecar/requirements/ci.txt"
2173+
- name: load docker images
2174+
run: make load-images local-src=/${{ runner.temp }}/build
21752175
- name: show system version
21762176
run: ./ci/helpers/show_system_versions.bash
21772177
- name: install
@@ -2229,14 +2229,14 @@ jobs:
22292229
path: /${{ runner.temp }}/build
22302230
attempt_limit: 5
22312231
attempt_delay: 1000
2232-
- name: load docker images
2233-
run: make load-images local-src=/${{ runner.temp }}/build
22342232
- name: install uv
22352233
uses: astral-sh/setup-uv@v5
22362234
with:
22372235
version: "0.5.x"
22382236
enable-cache: false
22392237
cache-dependency-glob: "**/docker-api-proxy/requirements/ci.txt"
2238+
- name: load docker images
2239+
run: make load-images local-src=/${{ runner.temp }}/build
22402240
- name: show system version
22412241
run: ./ci/helpers/show_system_versions.bash
22422242
- name: install
@@ -2293,14 +2293,14 @@ jobs:
22932293
path: /${{ runner.temp }}/build
22942294
attempt_limit: 5
22952295
attempt_delay: 1000
2296-
- name: load docker images
2297-
run: make load-images local-src=/${{ runner.temp }}/build
22982296
- name: install uv
22992297
uses: astral-sh/setup-uv@v5
23002298
with:
23012299
version: "0.5.x"
23022300
enable-cache: false
23032301
cache-dependency-glob: "**/simcore-sdk/requirements/ci.txt"
2302+
- name: load docker images
2303+
run: make load-images local-src=/${{ runner.temp }}/build
23042304
- name: show system version
23052305
run: ./ci/helpers/show_system_versions.bash
23062306
- name: install
@@ -2381,14 +2381,14 @@ jobs:
23812381
path: /${{ runner.temp }}/build
23822382
attempt_limit: 5
23832383
attempt_delay: 1000
2384-
- name: load docker images
2385-
run: make load-images local-src=/${{ runner.temp }}/build
23862384
- name: install uv
23872385
uses: astral-sh/setup-uv@v5
23882386
with:
23892387
version: "0.5.x"
23902388
enable-cache: false
23912389
cache-dependency-glob: "**/public-api/requirements/ci.txt"
2390+
- name: load docker images
2391+
run: make load-images local-src=/${{ runner.temp }}/build
23922392
- name: show system version
23932393
run: ./ci/helpers/show_system_versions.bash
23942394
- name: install
@@ -2441,14 +2441,14 @@ jobs:
24412441
path: /${{ runner.temp }}/build
24422442
attempt_limit: 5
24432443
attempt_delay: 1000
2444-
- name: load docker images
2445-
run: make load-images local-src=/${{ runner.temp }}/build
24462444
- name: install uv
24472445
uses: astral-sh/setup-uv@v5
24482446
with:
24492447
version: "0.5.x"
24502448
enable-cache: false
24512449
cache-dependency-glob: "**/swarm-deploy/requirements/ci.txt"
2450+
- name: load docker images
2451+
run: make load-images local-src=/${{ runner.temp }}/build
24522452
- name: show system version
24532453
run: ./ci/helpers/show_system_versions.bash
24542454
- name: install
@@ -2512,14 +2512,14 @@ jobs:
25122512
path: /${{ runner.temp }}/build
25132513
attempt_limit: 5
25142514
attempt_delay: 1000
2515-
- name: load docker images
2516-
run: make load-images local-src=/${{ runner.temp }}/build
25172515
- name: install uv
25182516
uses: astral-sh/setup-uv@v5
25192517
with:
25202518
version: "0.5.x"
25212519
enable-cache: false
25222520
cache-dependency-glob: "**/e2e/requirements/requirements.txt"
2521+
- name: load docker images
2522+
run: make load-images local-src=/${{ runner.temp }}/build
25232523
- name: show system version
25242524
run: ./ci/helpers/show_system_versions.bash
25252525
- name: setup
@@ -2699,6 +2699,12 @@ jobs:
26992699
uses: docker/setup-buildx-action@v3
27002700
with:
27012701
driver: docker-container
2702+
- name: install uv
2703+
uses: astral-sh/setup-uv@v5
2704+
with:
2705+
version: "0.5.x"
2706+
enable-cache: false
2707+
cache-dependency-glob: "**/e2e-playwright/requirements/ci.txt"
27022708
# FIXME: Workaround for https://github.com/actions/download-artifact/issues/249
27032709
- name: download docker images with retry
27042710
uses: Wandalen/wretry.action@master

packages/service-library/src/servicelib/fastapi/client_session.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22
from fastapi import FastAPI
33

44

5-
def setup_client_session(app: FastAPI) -> None:
5+
def setup_client_session(app: FastAPI, *, max_keepalive_connections: int = 20) -> None:
66
async def on_startup() -> None:
7-
session = httpx.AsyncClient(transport=httpx.AsyncHTTPTransport(http2=True))
7+
session = httpx.AsyncClient(
8+
transport=httpx.AsyncHTTPTransport(http2=True),
9+
limits=httpx.Limits(max_keepalive_connections=max_keepalive_connections),
10+
)
811
app.state.aiohttp_client_session = session
912

1013
async def on_shutdown() -> None:

services/director/src/simcore_service_director/core/application.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@ def create_app(settings: ApplicationSettings) -> FastAPI:
5353
if app.state.settings.DIRECTOR_TRACING:
5454
initialize_tracing(app, app.state.settings.DIRECTOR_TRACING, APP_NAME)
5555

56-
# replace by httpx client
57-
setup_client_session(app)
56+
setup_client_session(
57+
app,
58+
max_keepalive_connections=settings.DIRECTOR_REGISTRY_CLIENT_MAX_KEEPALIVE_CONNECTIONS,
59+
)
5860
setup_registry(app)
5961

6062
setup_instrumentation(app)

services/director/src/simcore_service_director/core/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ class ApplicationSettings(BaseApplicationSettings, MixinLoggingSettings):
112112
),
113113
)
114114

115+
DIRECTOR_REGISTRY_CLIENT_MAX_KEEPALIVE_CONNECTIONS: NonNegativeInt = 0
115116
DIRECTOR_REGISTRY_CLIENT_MAX_CONCURRENT_CALLS: PositiveInt = 20
116117
DIRECTOR_REGISTRY_CLIENT_MAX_NUMBER_OF_RETRIEVED_OBJECTS: PositiveInt = 30
117118

0 commit comments

Comments
 (0)