Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connection pool is full warning while reading S3 objects via multiple threads

I am using boto3 to read s3 objects

s3_client = boto3.client('s3', region_name='us-east-1')
obj = s3_client.get_object(Bucket=S3_BUCKET, Key=key)

I am running this via 50-100 threads to access different objects and getting warning :

urllib3.connectionpool - WARNING - Connection pool is full, discarding connection: s3.amazonaws.com

How can I increase the connection pool size?

Is there any better way to access different S3 objects with multiple threads?

like image 446
Dev Avatar asked Jul 21 '26 10:07

Dev


1 Answers

Adding max_pool_connections (default 10) solved it.

client_config = botocore.config.Config(
    max_pool_connections=50
)
s3_client = boto3.client('s3', region_name='us-east-1', config=client_config)
like image 200
Dev Avatar answered Jul 23 '26 19:07

Dev