运行多个 Java 应用程序从队列上传到 Azure Blob 存储时,文件上传需要更长时间?
我有一个用例,需要将队列中的文件发送到 Java 中的 azure blob 存储。这些文件需要同时上传。想知道是否有人可以帮助我选择的方向。
我有 4 个正在运行的 Java 上传应用程序 (JAR),它们正在侦听队列并简单地上传文件。
我能够从队列中获取我的特定项目,以便 4 个上传应用程序可以根据大小上传文件。每个实例都有自己的大小组。0-10MB、11MB 到 30MB 等等。
我根据示例编写了以下内容来上传文件。
BlobServiceClient blobServiceClient = new BlobServiceClientBuilder() .endpoint(storageAccountUrl) .sasToken(sasToken) .buildClient(); BlobContainerClient blobContainerClient = blobServiceClient.getBlobContainerClient(container); BlobClient blobClient = blobContainerClient.getBlobClient(targetFileName); blobClient.uploadFromFile(fullFileName);
应用程序只是从队列中获取文件并发送它。
我观察到的是 4 个独立的“Java 上传应用程序”在队列上运行侦听,它们开始花费更长的时间将文件上传到 Azure 存储。按照运行的 Java 应用程序数量排序!
例如,上传一个 9MB 的文件需要 7 秒才能上传仅在一个上传器应用程序上运行的文件。当我运行 4 个上传应用程序时,相同的文件大约需要 27 秒。
这样做时有什么需要注意的吗?
I have a use-case where I need to send files on a queue to azure blob storage in Java. The files will need to be uploaded concurrently. Was wondering whether someone could help with the direction I am taking.
I have 4 java uploader apps (JARs) running that are listening on the queue and simply upload the file.
I am able to get my specific items from the queue so that the 4 uploader apps can upload files based on size. Each instance works with its own size group.0-10MB, 11MB to 30MB and so on.
I wrote the following from examples to upload a file.
BlobServiceClient blobServiceClient = new BlobServiceClientBuilder() .endpoint(storageAccountUrl) .sasToken(sasToken) .buildClient(); BlobContainerClient blobContainerClient = blobServiceClient.getBlobContainerClient(container); BlobClient blobClient = blobContainerClient.getBlobClient(targetFileName); blobClient.uploadFromFile(fullFileName);
The apps just gets the files from the queue and send it.
What I am observing is the 4 independent "Java uploader apps" running listening on the queue, they start taking longer to upload files to Azure storage. In order of number of Java apps running!
For example a 9MB file takes 7 seconds to upload one running on only one uploader app. When I am running 4 uploader apps, this same file takes about 27 seconds.
Is there anything I need to bear in mind when doing this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论