Does Amazon S3 have a connection pool? -
i ever used code
public static amazons3client s3 = null; ... basicawscredentials c = new basicawscredentials("absadgwslkjlsdjgflwa"); s3 = new amazons3client(c); only 1 instance s3 created while dozens of threads upload images s3.putobject(). in dump info, see 1 thread lock instance s3 while others waiting.
so think maybe faster if use code below:
basicawscredentials c = new basicawscredentials("absadgwslkjlsdjgflwa"); for(int = 0; < 10; i++) amazons3[i] = new amazons3client(c); everytime system random s3 instance , upload image.
private static amazons3 gets3(){ int = (int)(math.random() * 10); return amazons3[i]; } but seems system slow down. why happened? maybe instance s3 has used connection pool? confused.
each client in aws sdk java (including amazon s3 client) maintains it's own http connection pool. can tune maximum size of http connection pool through the clientconfiguration class can passed client object constructors.
we recommend sharing client objects, because of expense , overhead of having many http connection pools aren't being utilized effectively. should see better performance when share client objects across threads this.
Comments
Post a Comment