Java api: blob input stream default values might causes out of memory error

Mhanna AbuTareef 1 Reputation point
2022-05-03T12:39:35.05+00:00

Hi

I have noticed that when using the BlobInputStream with default BlobInputStreamOptions, the jvm might crahs because of out of memory.
I uses a jvm with 12g, it crashed after couple of days.
from the gc log i see many humongous allocation because the g1heapregion we use is 4m, but the default BlobInputStream's block size is 4m, which is not suffecient in this case.

I wondered if a fine tune to the block size is required to fit with my jvm args or there is other azure blob store's java api i may use.

Following is how i use it

BlobInputStreamOptions biso = new BlobInputStreamOptions();
biso.setRequestConditions(new BlobRequestConditions().setIfNoneMatch((String) moreData));
BlobInputStream blob = remoteBlobClient.openInputStream(biso);

maybe the better use is by setting the block size

BlobInputStreamOptions biso = new BlobInputStreamOptions();
biso.setBlockSize(1024*1024).setRequestConditions(new BlobRequestConditions().setIfNoneMatch((String) moreData));
BlobInputStream blob = remoteBlobClient.openInputStream(biso);

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
3,040 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Mhanna AbuTareef 1 Reputation point
    2022-05-30T07:57:55.307+00:00

    We already updated the block size and after a days of monitoring, it seems that it helps making the heap performing better.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.