mtgao2
mtgao2

Reputation: 11

Java Parallel Upload

I'm currently working on a client-server application that allows me to upload and download with a client to a server. I've noticed that download speeds are pretty fast but uploads are much slower relatively.

I've been thinking of ways to potentially improve the performance of my upload by trying to do some sort of parallel upload. So I would split my file into 5 parts and have 5 threads all simultaneously upload their partition of the file to the same server endpoint.

First, I was wondering if this is even possible? Can I have multiple output streams writing to the same file at the same time? Also does this actually improve performance or will my upload speed still be inherently limited by my network bandwidth (so upload times will be virtually the same)?

Upvotes: 1

Views: 502

Answers (1)

Dellowar
Dellowar

Reputation: 3352

If you use just one thread it will upload at X MBs per ISP, if you use many threads, it will be still be only X MBs per ISP. Parallel processing can not be utilized in network connection.

Unless you own a datacenter, you're limited by your ISP's bandwidth far before your software performance will limit you.

The best way to make an efficient upload/download program is actually to only use one thread per connection. So what you have now is as (infrastructurally) efficient as you can be.

Upvotes: 0

Related Questions