Skip to content

🐛 [Firebase_Storage] Slow upload speed  #4278

@hyobbb

Description

@hyobbb

I am using firebase storage to save images and videos(.mp4) but upload speed is too slow.
Every files I upload is less then 4MB and it takes more than 15secs to upload it to firebase storage.
If I upload same file directly from console it only takes few seconds.
Is there any way to optimize the upload speed? such as setting chunk size?

Here is the log of uploadTask information and flutter doctor -v

UploadTask uploadVideoFile(String fileName, String filePath, String subFolder) {
    final file = File(filePath);
    //final fileName = path.basename(filePath);
    currentTask = _storageRef
        .child('$video/$subFolder/$fileName.mp4')
        .putFile(file);
    return currentTask;
  }

      print('[RecordingProviderDebug] start upload ${DateTime.now()}');
      _videoUrl = await uploadVideoFile(videoName, _encodingPath, _subfolder)
          .then((upload) => upload.ref.getDownloadURL());

      print('[RecordingProviderDebug] end upload ${DateTime.now()}');
      print('[RecordingProviderDebug] upload bytes size ${_fireVideoService.currentTask.snapshot.totalBytes}');
I/flutter (11648): [RecordingProviderDebug] start upload 2020-12-01 15:30:11.337365
I/System.out(11648): (HTTPLog)-Static: isSBSettingEnabled false
I/System.out(11648): (HTTPLog)-Static: isSBSettingEnabled false
D/BufferPoolAccessor(11648): bufferpool2 0x6f231f5620 : 0(0 size) total buffers - 0(0 size) used buffers - 1/7 (recycle/alloc) - 6/258 (fetch/transfer)
D/BufferPoolAccessor(11648): Destruction - bufferpool2 0x6f231f5620 cached: 0/0M, 0/0% in use; allocs: 7, 14% recycled; transfers: 258, 98% unfetced
I/ViewRootImpl@eaa066[MainActivity](notion://www.notion.so/11648): MSG_WINDOW_FOCUS_CHANGED 1 1
D/InputMethodManager(11648): prepareNavigationBarInfo() DecorView@a651d00[MainActivity]
D/InputMethodManager(11648): getNavigationBarColor() 0
I/System.out(11648): (HTTPLog)-Static: isSBSettingEnabled false
I/System.out(11648): (HTTPLog)-Static: isSBSettingEnabled false
D/UploadTask(11648): Increasing chunk size to 524288
I/System.out(11648): (HTTPLog)-Static: isSBSettingEnabled false
I/System.out(11648): (HTTPLog)-Static: isSBSettingEnabled false
D/UploadTask(11648): Increasing chunk size to 1048576
I/System.out(11648): (HTTPLog)-Static: isSBSettingEnabled false
I/System.out(11648): (HTTPLog)-Static: isSBSettingEnabled false
D/UploadTask(11648): Increasing chunk size to 2097152
I/System.out(11648): (HTTPLog)-Static: isSBSettingEnabled false
I/System.out(11648): (HTTPLog)-Static: isSBSettingEnabled false
I/System.out(11648): (HTTPLog)-Static: isSBSettingEnabled false
I/System.out(11648): (HTTPLog)-Static: isSBSettingEnabled false
I/flutter (11648): [RecordingProviderDebug] end upload 2020-12-01 15:30:29.363642
I/flutter (11648): [RecordingProviderDebug] upload bytes size 3104208

Took 18secs for 3.1MB file

I/flutter ( 8584): [RecordingProviderDebug] start upload 2020-12-01 15:52:26.829094
I/System.out( 8584): (HTTPLog)-Static: isSBSettingEnabled false
I/System.out( 8584): (HTTPLog)-Static: isSBSettingEnabled false
I/System.out( 8584): (HTTPLog)-Static: isSBSettingEnabled false
I/System.out( 8584): (HTTPLog)-Static: isSBSettingEnabled false
W/ract.nowfiprot( 8584): Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
D/UploadTask( 8584): Increasing chunk size to 524288
I/System.out( 8584): (HTTPLog)-Static: isSBSettingEnabled false
I/System.out( 8584): (HTTPLog)-Static: isSBSettingEnabled false
D/UploadTask( 8584): Increasing chunk size to 1048576
I/System.out( 8584): (HTTPLog)-Static: isSBSettingEnabled false
I/System.out( 8584): (HTTPLog)-Static: isSBSettingEnabled false
D/UploadTask( 8584): Increasing chunk size to 2097152
I/System.out( 8584): (HTTPLog)-Static: isSBSettingEnabled false
I/System.out( 8584): (HTTPLog)-Static: isSBSettingEnabled false
I/System.out( 8584): (HTTPLog)-Static: isSBSettingEnabled false
I/System.out( 8584): (HTTPLog)-Static: isSBSettingEnabled false
I/flutter ( 8584): [RecordingProviderDebug] end upload 2020-12-01 15:52:44.418709
I/flutter ( 8584): [RecordingProviderDebug] upload bytes size 2632654

Also took 18secs for 2.6MB file

[✓] Flutter (Channel stable, 1.22.4, on Mac OS X 10.15.7 19H15 darwin-x64, locale en-KR)
    • Flutter version 1.22.4 at /Users/hyobbb/development/flutter
    • Framework revision 1aafb3a8b9 (3 weeks ago), 2020-11-13 09:59:28 -0800
    • Engine revision 2c956a31c0
    • Dart version 2.10.4

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/hyobbb/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.2, Build version 12B45b
    • CocoaPods version 1.10.0

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin installed
    • Dart plugin version 201.9245
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

 
[✓] Connected device (1 available)            
    • SM G970N (mobile) • R39M30264QW • android-arm64 • Android 10 (API 29)

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions