Mutiple Jpg image in Array is taking time with azure blob response

Questions, comments and suggestions concerning VintaSoft Imaging .NET SDK.

Moderator: Alex

Post Reply
jwalit.katira
Posts: 31
Joined: Mon Sep 18, 2023 1:41 pm

Mutiple Jpg image in Array is taking time with azure blob response

Post by jwalit.katira »

Hello

In .NET core we have override CreateSessionDataStorage method to give response as blob stream , below is sample code

Code: Select all

protected override IDataStorage CreateSessionDataStorage(string sessionId)
{
    return new BlobDataStorage();
}

public class BlobDataStorage : IDataStorage
{
    public object GetItemCopy(string key)
    {
         if (Contains(key))
        {
            var blobclient = new BlobClient("UseDevelopmentStorage=true", "service",key);
            return blobclient.OpenRead();
        }
        else
            throw new Exception(string.Format("Data storage does not have image with identifier \"{0}\".", key));
    }
    ...
the method GetImageFileInfo() is taking almost 1 min to response for 1260 array of jpg . if is is just JSON response cannot we some how give response directly

same method GetImageFileInfo() i override as as response stream from physical 1260 array of jpg file it is only take 3 sec

Code: Select all

protected override IDataStorage CreateSessionDataStorage(string sessionId)
{
    if (sessionId == null)
    {
        if (IsEmptySessionSupported)
            sessionId = "";
        else
            throw new ArgumentNullException("sessionId");
    }

    string path = Path.Combine("C:\\Jwalit\\Sample Files\\JPEGNEW\\", sessionId);

    if (!Directory.Exists(path))
        Directory.CreateDirectory(path);

    return new StreamDataStorage(path);
}
can you please suggest

Thanks
Jwalit katira
Alex
Site Admin
Posts: 2319
Joined: Thu Jul 10, 2008 2:21 pm

Re: Mutiple Jpg image in Array is taking time with azure blob response

Post by Alex »

Hello Jwalit,

Please do the following test:
  • Create console application that creates BlobClient object and reads data from 1260 blobs. Run the application and measure the execution time.
  • Create console application that reads bytes from 1260 file streams. Run the application and measure the execution time.
I think as a result you will see that the second application works much faster.

If you want to improve performance of data storage, which loads data from blobs, I think you need to improve performance of blobs.

Best regards, Alexander
Post Reply