Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FilesAPI.upload_bytes very slow #730

Open
thomafred opened this issue Sep 3, 2020 · 1 comment
Open

FilesAPI.upload_bytes very slow #730

thomafred opened this issue Sep 3, 2020 · 1 comment
Labels
1.x Issues related to 1.x SDK

Comments

@thomafred
Copy link

thomafred commented Sep 3, 2020

Is your feature request related to a problem? Please describe.
The file upload function FilesAPI.upload_bytes is very slow. Currently uploading 10 files concurrently, but upload speed no more than 4 MB/s (my internet-connection supports 10 MB/s).

The function FilesAPI.upload is however quite fast.

Describe the solution you'd like
The library should be able to parallelize file upload similar to the blob-client in the Azure SDK.

Describe alternatives you've considered
Attempted to parallelize using the Multiprocessing-library:

from multiprocessing import Pool

NUM_WORKERS = 10

# {.... }

def file_upload_cb(file_name):
  global cdf_client

  with open(file_name, 'rb') as f:
    cdf_client.files.upload_bytes(f, external_id=fname) # Use file-name as external ID for demo-purpose

with Pool(NUM_WORKERS) as pool:
  pool.map(file_upload_cb, list_of_files)

Additional context

In the picture below, the blue line is the download speed from Azure Blob-storage, the red line is the total upload-speed for 10 concurrent file-uploads using the Cognite FileApi.

Screenshot from 2020-09-03 08-34-48

@thomafred thomafred added the 1.x Issues related to 1.x SDK label Sep 3, 2020
@thomafred
Copy link
Author

thomafred commented Sep 3, 2020

Seems that it is the function FilesAPI.upload_bytes which is slow. The function FilesAPI.upload is sufficiently fast. I have updated the issue to reflect this

@thomafred thomafred changed the title File upload very slow FilesAPI.upload_bytes very slow Sep 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.x Issues related to 1.x SDK
Projects
None yet
Development

No branches or pull requests

1 participant