Skip to content

Conversation

@jairad26
Copy link
Contributor

@jairad26 jairad26 commented Nov 6, 2025

Description of changes

Summarize the changes made by this PR.

  • Improvements & Bug fixes
    • Adds support for chroma_http_keepalive_secs , chroma_http_max_connections , chroma_http_max_keepalive_connections in settings, propagating to fastapi and async fastapi httpx Clients.
    • Fixes a bug where when ssl was set, all http limits were removed when a new httpx client was created with the ssl variables.
  • New functionality
    • ...

Test plan

How are these changes tested?
Added tests to ensure settings are persisted, and that the httpx client correctly defines the limits

  • [ x] Tests pass locally with pytest for python, yarn test for js, cargo test for rust

Migration plan

Are there any migrations, or any forwards/backwards compatibility changes needed in order to make sure this change deploys reliably?

Observability plan

What is the plan to instrument and monitor this change?

Documentation Changes

Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the docs section?

@github-actions
Copy link

github-actions bot commented Nov 6, 2025

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

Copy link
Contributor Author

jairad26 commented Nov 6, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@jairad26 jairad26 force-pushed the jai/keepalive-max-conns branch from 4268f1d to dabff1a Compare November 6, 2025 16:07
@jairad26 jairad26 marked this pull request as ready for review November 6, 2025 16:16
@propel-code-bot
Copy link
Contributor

propel-code-bot bot commented Nov 6, 2025

Expose HTTP keep-alive & connection-limit settings to Python clients

Adds three new Settings fields (chroma_http_keepalive_secs, chroma_http_max_connections, chroma_http_max_keepalive_connections) and threads them through the shared BaseHTTPClient, FastAPI, and AsyncFastAPI implementations. The refactor centralises limit calculation in BaseHTTPClient.http_limits, ensures limits survive SSL-verification branches, and fixes the previous bug where specifying ssl_verify silently dropped limit arguments. Associated unit tests validate defaults, overrides, and that httpx.Client/AsyncClient receive the expected Limits object.

Key Changes

• Introduced chroma_http_keepalive_secs, chroma_http_max_connections, chroma_http_max_keepalive_connections in chromadb.config.Settings with default 40s / None / None
• Refactored BaseHTTPClient to inherit from Component, compute httpx.Limits once, and expose via http_limits property
• Updated FastAPI and AsyncFastAPI to use self.http_limits (and pass through verify= when SSL verification is configured) eliminating previous logic that discarded limits
• Added tests test_fastapi_uses_http_limits_from_settings, test_http_client_setting_defaults, test_http_client_setting_overrides plus test helper factory
• Adjusted deserialisation cleanup in both FastAPI flavours (metadatas no longer type-ignored)

Affected Areas

chromadb/config.py (settings schema)
chromadb/api/base_http_client.py
chromadb/api/fastapi.py
chromadb/api/async_fastapi.py
• unit tests in chromadb/test/test_client.py and chromadb/test/test_config.py

This summary was automatically generated by @propel-code-bot

from chromadb.config import Settings, System
from chromadb.api import ClientAPI
import chromadb.server.fastapi
from chromadb.api.fastapi import FastAPI as SyncFastAPI
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason this is renamed?

@jairad26 jairad26 force-pushed the jai/keepalive-max-conns branch from 467aae7 to 7924163 Compare November 7, 2025 03:07
@jairad26 jairad26 enabled auto-merge (squash) November 7, 2025 03:08
@jairad26 jairad26 merged commit 117de89 into main Nov 7, 2025
62 checks passed
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.

3 participants