Multithreading for long running task

G

Guest

Hello All,

I am developing a file uploading sever. I am planning to create this as a
multithreaded application in which every file upload request will be done
through a separate thread from the thread pool. While going through some
articles on the internet, I came to know that it is a bad practice to
allocate thread from thread pool for long running application.

I would like to know what other alternatives are available in the threading
context, so that I can delegate the task of uploading files to different
threads for files which are very large in size.

Thanks
pradeep_tp
 
V

VJ

really? can I see the article. All I have seen is thread pool is the best
practice...

Ok what we do is we use BITS, do large file transfers, but that ofcourse
eliminates FTP. We ran this of as background thread, use BITS capacity to
move files. Worked will so far.

VJ
 
C

Chris Mullins [MVP]

You shouldn't take the approach that you described - you'll be causig
yourself all sorts of problems and really limiting your applications
performance and scalability.

I strongly suggest that you spend some time looking into Asyncronous I/O, as
this is by far the best mechanism to handle multiple incoming file streams.

Depending on your use case, you could also look into BITS, and MTOM. I
believe there are also some File Upload controls available for ASP.Net 2.0 -
these may do the trick for you as well.
 
J

Jon Skeet [C# MVP]

VJ said:
really? can I see the article. All I have seen is thread pool is the best
practice...

If you allocate long running tasks to the system threadpool, you can
easily swamp the threadpool.

The fact that the threadpool is a singleton is a major pain in the
neck. I tend to prefer using my own separate threadpool, or just new
threads.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top