用于Java V10 Max连接的Microsoft Azure存储SDK

时间:2018-10-10 08:56:54

标签: azure azure-storage azure-storage-blobs

我正在使用Java的Microsoft Azure存储SDK,并且特定的工件坐标为:scanf("%lf %lf",&a,&b);

我的用例是通过库提供的Azure客户端将来自服务器的传入上载流传输到Azure:

com.microsoft.azure:azure-storage-blob:10.1.0

我想知道Azure客户端可以处理多少个并发连接,并且该值是否可配置?

我确实尝试通过以下方式配置[Client] ---upload---> [My Server] ---put object---> [Azure]

channelPoolSize

但是我看到的是,大约250个并发上传,客户端开始失败:

final NettyClient.Factory factory = new NettyClient.Factory( new Bootstrap(), 0, 10000); //<--- channelPoolSize final HttpClient client = factory.create(null); final PipelineOptions pipelineOptions = new PipelineOptions() .withLogger(new Slf4jLogger(LOG)) .withRequestRetryOptions(NO_RETRY) .withClient(client); final HttpPipeline pipeline = StorageURL.createPipeline(credential, pipelineOptions); final URL endpoint = endpointForAccountOrThrow(accountName); final ServiceURL serviceURL = new ServiceURL(endpoint, pipeline); containerURL = serviceURL.createContainerURL(containerName);

有什么主意吗?


您好,我发现了问题,并在此分享,以防其他人使用。 问题在于,随着用户数量的增加,流媒体时间越来越长。 大约有250个并发上传,有些请求花费了超过1分钟的时间,但是我有一个通用的重试策略,定义如下:

java.util.concurrent.TimeoutException: null at io.reactivex.internal.operators.single.SingleTimeout$TimeoutMainObserver.run(SingleTimeout.java:115) at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:38) at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:26) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)

这种策略迫使请求在一分钟内完成(这是默认的tryTimeout)。

阅读 private static RequestRetryOptions NO_RETRY = new RequestRetryOptions( RetryPolicyType.EXPONENTIAL, 1, null, null, null, null); 的Java文档后:

RequestRetryOptions

我切换到了每个请求重试策略,该策略根据内容大小设置tryTimeout值。 这解决了我的问题

0 个答案:

没有答案