Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sending More than 200 images to server in Multitasking Mode?

I want to upload 300 images to server through NSOperationQueue. I have to use one single URL for each image, so I will use 300 URLs. In other words 300 NSOperations for those URLs to push into NSOperationQueue.

Is it Right Approach? Does not it affect application performance in main thread?

like image 338
senthilM Avatar asked May 02 '14 05:05

senthilM


2 Answers

If you want to run 300 uploads in parallel then this is rather bad idea regardless of platform.

like image 108
Marcin Orlowski Avatar answered Nov 17 '22 22:11

Marcin Orlowski


The performance in the main thread will not be affected because the main thread will not take too much time off no matter how many the threads are. But the problem is too much of context switching between a large number of threads running in parallel will give much lesser time to them to execute. Never keep the number of threads running parallel to such a huge number. I would recommend no more than 5 threads at once.

Another advantage associated with running the upload process in a thread (but only in a single thread is) if the upload process stops within the upload lets say after 50 images are uploaded then at least you will have those 50 images there. If you do this all in thread, then may be even after half of the uploading done, you may have no image completely uploaded.

like image 3
Khawar Ali Avatar answered Nov 17 '22 22:11

Khawar Ali