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 NSOperation
s for those URLs to push into NSOperationQueue
.
Is it Right Approach? Does not it affect application performance in main thread?
If you want to run 300 uploads in parallel then this is rather bad idea regardless of platform.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With