Very Slow upload/download speed of Firebase Storage
<p><strong>The Story</strong></p>

<p>I am using Firebase Storage in my app to upload large files into the Firebase Storage. Files are mostly videos which can be even larger than 2 GB some times.</p>

<p><strong>What I Have Done</strong></p>

<p>This is what I have done.</p>

<pre><code>UploadTask originalUpload = originalDestination.putFile(Uri.fromFile(originalSource));
            mCurrentUploadTask = originalUpload;
            originalUpload.addOnProgressListener(mOnProgressUpdateListener);
originalUpload.addOnSuccessListener(mOriginalSuccessListener);
</code></pre>

<p>Just to inform, I am also converting these sync tasks to async as I need to process everything in the background using,</p>

<pre><code>Tasks.await(originalUpload);
</code></pre>

<p><strong>The Problem</strong></p>

<p>The problem is weird and unexpected. The upload/download works perfectly, but it is very slow.</p>

<p>I am on a good internet connection of 1 MBps but these files are never transferred at this speed. It is around 100-150 KBps which is almost 15% of the available speed of my network.</p>

<p>I have <strong>tested this several times and on several different networks</strong> before making this claim. Nowhere, I found Firebase making full use of the available bandwidth, whereas other non-Firebase downloads/uploads works at full speed.</p>

<p>My app needs to download and upload large files, and therefore <strong>cannot afford to transfer at such slow speeds</strong>. This was not at all expected from Firebase.</p>

<p><strong>Please let me know if I am doing anything wrong</strong> in my implementation or if it is an inherent problem with Firebase?</p>

<p><strong>UPDATE</strong></p>

<p>I have also been experiencing an issue with only the uploads. When ever I am downloading something and I just turn off the Wifi, the download gets cancelled with this error.</p>

<pre><code>com.google.firebase.storage.StorageException: An unknown error occurred, please check the HTTP result code and inner exception for server response.

Read error: ssl=0xb7e7a510: I/O error during system call, Connection timed out
                                                                           javax.net.ssl.SSLException: Read error: ssl=0xb7e7a510: I/O error during system call, Connection timed out
                                                                               at com.android.org.conscrypt.NativeCrypto.SSL_read(Native Method)
                                                                               at com.android.org.conscrypt.OpenSSLSocketImpl$SSLInputStream.read(OpenSSLSocketImpl.java:699)
                                                                               at com.android.okio.Okio$2.read(Okio.java:113)
                                                                               at com.android.okio.RealBufferedSource.read(RealBufferedSource.java:48)
                                                                               at com.android.okhttp.internal.http.HttpConnection$FixedLengthSource.read(HttpConnection.java:446)
                                                                               at com.android.okio.RealBufferedSource$1.read(RealBufferedSource.java:168)
                                                                               at java.io.InputStream.read(InputStream.java:162)
                                                                               at com.google.firebase.storage.FileDownloadTask.run(Unknown Source)
                                                                               at com.google.firebase.storage.StorageTask$5.run(Unknown Source)
                                                                               at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                                                                               at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                                                                               at java.lang.Thread.run(Thread.java:818)
</code></pre>

<p>But when I do the exact same thing for uploads, it just waits for connection and if I turn on the Wifi again, it reconnects and resumes. Why does the problem only happen with downloading files? <strong>Is it a problem with getFile() API again?</strong></p>

<p>FYI, I have not changed the timeout settings for both uploads and downloads. They are at their defaults.</p>