Qiniu php sdk uploads files too slowly.

problem description

sometimes it takes 2s to upload the same file (32kb), but sometimes it takes 11s. The upload speed is too unstable and too slow.

the upload process is that the front end uploads the file to the interface of the back-end php (using yii2 framework), and the php calls the sdk upload method of qiniu. After investigation, the time for the front end to upload files to the server where the php backend is located is very short in a few hundred milliseconds, which is negligible. I would like to ask why the process of uploading to Qiniu is so slow and how to solve this problem. Because the system is about to be used, it is still urgent to upload.

the environmental background of the problems and what methods you have tried

it has been checked that the time for uploading files to the server from the front end is not slow, and the network speed has also been checked.

related codes

/ / Please paste the code text below (do not replace the code with pictures)
/ *

  • Qiniu Cloud storage components

*
* /

namespace appcommoncomponents;

use Yii;
use yiibaseComponent;
use QiniuAuth;
use QiniuStorageUploadManager;

class Qiniu extends Component
{

public $accessKey;
public $secretKey;
public $auth;
public $defaultBucket;
public $privateBucket;
public $cdnHost;

public function init()
{
    parent::init();
    $this->auth = new Auth($this->accessKey, $this->secretKey);
}

/**
 * 
 *
 * @param string $filePath 
 * @param string $key 
 *
 * @return string 
 */
public function upload($filePath, $key, $bucket = null)
{
    $uploadMgr = new UploadManager();
    $bucket = empty($bucket) ? $this->defaultBucket : $bucket;
    $token = $this->auth->uploadToken($bucket);
    list($ret, $err) = $uploadMgr->putFile($token, $key, $filePath);
    if ($err !== null) {
        Yii::$app->response->error(
            Yii::$app->response->resCode["ERROR_QINIU_UPLOAD_FAILED"],
            "Upload to qiniu failed."
        );
    } else {
        return $ret["key"];
    }
}

/**
 *  CDN URL
 *
 * @param string $key 
 *
 * @return string
 */
 public function generateUrl($key, $hostType = "default")
 {
    return !empty($key) ? $this->cdnHost[$hostType] . trim($key, "/") : "";
 }

}

what result do you expect? What is the error message actually seen?

uploading dozens of kb files is not so slow. I hope someone can help solve this situation. Thank you.

Php
Feb.18,2022

cannot go to the intranet. Is it file streaming


can be uploaded directly at the front end, but directly uploaded to Qiniuyun
2 without going to the server


1. Directly use the administrator's browser to upload to Qiniuyun, do not need to go through the server


to say that the front end uploads to Qiniu, but the server does not verify the format?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e4374e-44a25.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e4374e-44a25.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?