This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Upload a file in multiple chunks paralelly Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Upload a file in multiple chunks paralelly" Watch "Upload a file in multiple chunks paralelly" New topic
Author

Upload a file in multiple chunks paralelly

amarnath nalumachu
Greenhorn

Joined: Feb 10, 2005
Posts: 10
Hi All,

We have a web application that uses an applet to upload a file in chunks and transfers sequentially to the server and on the server side, a servlet receives the chunks. Now we are thinking of improving the overall performance. We are thinking of sending multiple chunks paralelly and servlet (some server side component) will assemble the chunks in right order (assume chunk order is passed) and creates the file the server side.
So my question, is this approach feasible? If feasible, what are the issues can arise with this approach? Please throw your ideas. Appreciate your help.

Thanks
Brian Mozhdehi
Ranch Hand

Joined: Aug 17, 2006
Posts: 81
I cant think of a reliable way to do this. Why are you doing this in chunks? It seems like the only reliable and efficient way to do this is to upload the file in its entirety
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

Maybe I'm missing something but it seems to be pretty straight-forward. The individual threads, each uploading their particular chunk, could write their chunk onto the file system, and as each finishes checks to see if it's the last one and that all the other chunks have been written. That last thread would concatentate the files into one and remove the individual chiunks when done.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
amarnath nalumachu
Greenhorn

Joined: Feb 10, 2005
Posts: 10
I see following constraints or what ever.

1. We need to maintain the chunk order so that file assembly is proper on the server side. What is best way to identify a chunk number?
2. What if a chunk transfer fails, we need to mark the whole transfer as failure and ask the end user to transfer again.
3. Performance, there is lot of IO involved, as each chunk written to disk and later read the chunk and write a big file.

Any ideas.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Upload a file in multiple chunks paralelly
 
Similar Threads
FTP Upload
How to upload a file from applet to the webserver ?
File upload
Is there any other alternate to find file size and restrict it?
AJAX