All Products
Search
Document Center

Object Storage Service:What do I do if the speed is slow when I upload objects to or download objects from OSS?

Last Updated:Mar 08, 2024

This topic describes the causes of and solutions to the slow upload speed and download speed of objects in Object Storage Service (OSS).

Causes

The upload speed and download speed of objects are limited by the local bandwidth of the client and the network link of the Internet service provider (ISP).

Solutions

Troubleshoot the slow speed when you upload or download objects without using OSS SDKs

  1. Check how objects are uploaded or downloaded.

    • If the speed is slow when you upload or download objects in the OSS console or by using tools such as ossfs, ossbrowser, or ossftp, we recommend that you use ossutil. ossutil is more efficient and allows you to upload large objects or a large number of objects. For more information, see Upload objects and Download objects.

    • If the upload or download speed is not improved by using ossutil, proceed to the next step.

  2. Check whether the bandwidth and queries per second (QPS) of the network exceed the limit.

    1. Log on to the OSS console.

    2. In the left-side navigation pane, click Buckets. On the Buckets page, click the name of the bucket that you want to upload objects to or download objects from.

    3. In the left-side navigation pane, choose Data Usage > Basic Data and check whether the bandwidth and QPS of the network exceed the limit.

      • Default bandwidth limit: 10 Gbit/s in regions in the Chinese mainland and 5 Gbit/s in regions outside the Chinese mainland. If the bandwidth limit is reached, requests are throttled.

      • Default QPS limit: 10,000. Requests are denied after the QPS limit is reached.

  3. Check the local network environment and test the bucket domain name by using MTR to determine whether packet loss occurs in the link between the client and the server. For more information, see Connectivity testing.

    Note

    If you upload objects over an internal network, use an internal endpoint.

  4. Run the probe command of ossutil to check your network environment and upload speed, and check the network connectivity between ossutil and OSS. For more information, see probe.

  5. Check whether a cross-border network connection is involved between the client and the OSS bucket.

    For example, the OSS bucket is located in the China (Hangzhou) region and the client is located in the China (Hong Kong) region. In this case, the client is restricted by cross-border links. You can enable the transfer acceleration feature.

    OSS uses globally distributed data centers to implement transfer acceleration. When a request is sent to your bucket, the request is parsed and routed to the data center in which the bucket is located over the optimal network path and protocol. The transfer acceleration feature provides an optimized end-to-end solution to accelerate access to OSS over the Internet. For more information, see Enable transfer acceleration.

    Note

    Transfer acceleration takes effect within 30 minutes after it is enabled. Make sure that the configured transfer acceleration endpoint is valid.

    • Global acceleration endpoint: oss-accelerate.aliyuncs.com. Acceleration endpoints are distributed across the world. You can use a global acceleration endpoint to accelerate data transfer for buckets in all regions.

    • Acceleration endpoint of regions outside the Chinese mainland: oss-accelerate-overseas.aliyuncs.com. Acceleration endpoints are distributed across regions outside the Chinese mainland. You can use an acceleration endpoint outside the Chinese mainland to map a custom domain name without an Internet Content Provider (ICP) filing to a bucket in the China (Hong Kong) region or in another region outside the Chinese mainland.

Troubleshoot the slow speed when you upload or download objects by using OSS SDKs

The following section provides an example on how to troubleshoot the slow speed when you use OSS SDK for Python to upload an object:

  1. Check whether resumable upload is used if you upload an object that is greater than 100 MB. For more information, see Multipart upload. If resumable upload is used, proceed to the next step.

    If you upload an object by using resumable upload, check the configurations of the following parameters:

    • multipart_threshold: If the object size is greater than the value of this parameter, multipart upload is used to upload the object.

    • part_size: the size of the part. You must specify the part size based on the object size. For example, if an object is greater than 1 GB, we recommend that you set the part_size parameter to 100 MB.

      Note

      We recommend that you increase the size of each part when the network connection is stable and decrease the size of each part when the network connection is unstable.

    • num_threads: the number of threads for concurrent upload. In most cases, the num_threads parameter is set to 4.

    Recommended configurations:

    multipart_threshold=10000*1024,
    part_size=10000*1024,
    num_threads=4
  2. Check whether CRC-64 is enabled.

    If CRC-64 is enabled, we recommend that you disable CRC-64 when you initialize the OSSClient instance. You can replace CRC-64 with MD5 by adding the Content-MD5 request header to the request. For more information about how to initialize OSS SDK for Python, see Initialization.

    # -*- coding: utf-8 -*-
    import oss2
    from oss2.credentials import EnvironmentVariableCredentialsProvider
    
    # Obtain access credentials from environment variables. Before you run the sample code, make sure that the environment variables are configured. 
    auth = oss2.ProviderAuth(EnvironmentVariableCredentialsProvider())
    
    # Specify the endpoint of the region in which the bucket is located. For example, if the bucket is located in the China (Hangzhou) region, set the yourEndpoint parameter to https://oss-cn-hangzhou.aliyuncs.com. 
    endpoint = 'yourEndpoint'
    # Specify the name of the bucket. Example: examplebucket. 
    # enable_crc=False specifies that CRC-64 is disabled. 
    bucket = oss2.Bucket(auth, endpoint, 'examplebucket',enable_crc=False)  
    Note

    CRC-64 is used only to verify data and does not ensure data security.