Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PERF]: Improved server-side serialization with orjson + async (#1938)
This is PR #1695 migrated to Chroma repo for stacking the outstanding changes. ## Description of changes *Summarize the changes made by this PR.* - Improvements & Bug fixes - Added orjson serialization improving serialization performance especially on large batches 100+ docs 2x faster (tested with locust) - Added async body serialization further improving performance (tested with locust) -⚠️ Fixed an issue with SQLite lack of case_sensitive_like for FastAPI Server thread pool connections ## Test plan *How are these changes tested?* - [x] Tests pass locally with `pytest` for python, `yarn test` for js - [x] Locust performance tests For performance tests, **5** concurrent clients were querying, and **1** was adding pre-computed OpenAI (ada-02) embeddings (runtime **~1m**) **Batch size**: 100 (1000 also attached in a zip) Tests with existing `main` codebase: ![Screenshot 2024-02-03 at 17 52 39](https://github.com/chroma-core/chroma/assets/1157440/5d87b4d5-4dae-48fe-908c-7c09db2a5abc) Tests with orjson + async: ![Screenshot 2024-02-03 at 17 53 17](https://github.com/chroma-core/chroma/assets/1157440/d9818fdd-11c3-45c9-81dd-8baecbb638cf) [1m-100batch-5concur.zip](https://github.com/chroma-core/chroma/files/14152062/1m-100batch-5concur.zip) [1m-1000batch-5concur.zip](https://github.com/chroma-core/chroma/files/14152063/1m-1000batch-5concur.zip) ## Documentation Changes *Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the [docs repository](https://github.com/chroma-core/docs)?* ## Refs - https://showmax.engineering/articles/json-python-libraries-overview - https://github.com/ijl/orjson - https://catnotfoundnear.github.io/finding-the-fastest-python-json-library-on-all-python-versions-8-compared.html --------- Co-authored-by: Ben Eggers <[email protected]>
- Loading branch information