def test_s3_stresstest():
with Storage('s3://seunglab-test/cloudvolume/connection_pool/', n_threads=0) as stor:
stor.put_file('test', 'some string')
n_trials = 500
pbar = tqdm(total=n_trials)
@retry
def create_conn(interface):
conn = S3_POOL.get_connection()
# assert S3_POOL.total_connections() <= S3_POOL.max_connections * 5
bucket = conn.get_object(
Bucket='seunglab-test',
Key='cloudvolume/connection_pool/test',
)
S3_POOL.release_connection(conn)
pbar.update()
with ThreadedQueue(n_threads=20) as tq:
for _ in range(n_trials):
tq.put(create_conn)
pbar.close()
评论列表
文章目录