Start a Conversation

Unsolved

This post is more than 5 years old

951

October 17th, 2012 00:00

Uploading images to cloud using EMC API

I have an API of EMC using which my application upload images to cloud storage. The application uploads minimum 5000 images of 3kb size at a time.


It takes approximate 1.30 sec/image to upload on cloud server. So uploading 5000 images takes a long time to process.


Could you please guide to reduce the time to upload the images, so that it can process faster? Or Is there a way to upload multiple images using EsuRestApi?


We are using EsuApiLib dll and the application is build up in C# .Net 2005.


Below is the code snippet which we use to upload images to cloud storage.


------------------------- Start of code ------------------------

string filename = frmpath + "\\" + actimgpath;

string[] imgarr = imagename.Split(' ');

string imgn = imgarr[0].ToString();

FileInfo f = new FileInfo(filename);

long length = f.Length;

EsuRestApi cloudRest = new EsuRestApi(host, post, uid, sharedSecret);

Acl acl = new Acl();

acl.AddGrant(new Grant(new Grantee(cloudRest.GetUid(), Grantee.GRANTEE_TYPE.USER), Permission.FULL_CONTROL));

ObjectId oId = null;

Stream filestream = null;

try

{

filestream = File.OpenRead(filename);

oId = cloudRest.CreateObjectFromStreamOnPath(new ObjectPath(tofile), acl, null, filestream, length, "image/jpg", null);

}

------------------------- End of code ------------------------


Awaiting your valuable reply.


Thanks and regards,

Govindaraj Chettiar

222 Posts

October 17th, 2012 06:00

Have you considered using multiple threads to create objects in parallel?

2 Posts

October 17th, 2012 09:00

Thanks for your response. Yes i did tried using multiple threads the time has reduced but still not the way we wanted like while using single thread it takes 1.5 seconds and using multiple thread it uploads around 2 images in the same time but uploading 5k images still takes a long time. Is there a way I can do batch upload? Or do you have any idea where the process works more faster.

Looking for your valuable reply.

Thanks.

222 Posts

October 17th, 2012 10:00

There's not a means of making a single request to create multiple objects in a batch.  Each object (or part of an object) requires a single request.

There's not a faster means of creating objects than using multiple threads.

No Events found!

Top