From 842a585b373e6a381828d2477c22d68468cba5c5 Mon Sep 17 00:00:00 2001 From: AlaeddineAbdessalem Date: Thu, 22 Sep 2022 13:47:19 +0300 Subject: [PATCH] docs: document grpc client limitation (#5193) --- docs/fundamentals/client/client.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/fundamentals/client/client.md b/docs/fundamentals/client/client.md index 9ba3feef21138..cc4d63bfe2163 100644 --- a/docs/fundamentals/client/client.md +++ b/docs/fundamentals/client/client.md @@ -128,7 +128,7 @@ Client(host='my.awesome.flow', port=1234, protocol='grpc', tls=True) ```` -You can also use a mixe of both: +You can also use a mix of both: ```python from jina import Client @@ -148,6 +148,15 @@ Client(host='https://my.awesome.flow:1234', port=4321) ``` ```` +````{admonition} Caution +:class: caution +In case you instanciate a `Client` object using the `grpc` protocol, keep in mind that `grpc` clients cannot be used in +a multi-threaded environment (check [this gRPC issue](https://github.com/grpc/grpc/issues/25364) for reference). +What you should do, is to rely on asynchronous programming or multi-processing rather than multi-threading. +For instance, if you're building a web server, you can introduce multi-processing based parallelism to your app using +`gunicorn`: `gunicorn main:app --workers 4 --worker-class uvicorn.workers.UvicornWorker ...` +```` + ## Test readiness of the Flow