Per-request clients vs single client for fastapi server #1105
-
Hello, We currently use 3 different client types (kinesis, iot-core and s3) and we have around 100 endpoints being called several time per second. Our app is replicated with docker replicas and each replica has 1 CPU allocated right now. In this setting, which option would be ideal?
At first glance, 2 looks better if creating a client has an overhead, but according to the docs clients are mostly used as context managers when needed. However, in some previous issues it was listed as an option (#806). Could you please clarify on this point? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
you want to keep as few clients as possible for as long as possible. each client has its own connection pool. also look into aioboto3 for a smoother transition |
Beta Was this translation helpful? Give feedback.
you want to keep as few clients as possible for as long as possible. each client has its own connection pool. also look into aioboto3 for a smoother transition