How to Upload Large Files in Blocks in Parallel Using Seven-Niu java-sdk

  java, question

Now I want to upload a large file on the server with the java-sdk of seven cows, the file size is about 100M, and then upload it using the common method. I find it is very slow.

Common uploaded code is the code on the document.

public String uploadResouce(String fileLocation, String fileName) {
 System.out.println("start to upload resource to qiniu server");
 Mac mac = new Mac(Config.ACCESS_KEY, Config.SECRET_KEY);
 //Please ensure that the bucket already exists
 String bucketName = "xxx";
 PutPolicy putPolicy = new PutPolicy(bucketName);
 try {
 String uptoken = putPolicy.token(mac);
 PutExtra extra = new PutExtra();
 String key = fileName;
 String localFile = fileLocation;
 PutRet ret = IoApi.putFile(uptoken, key, localFile, extra);
 Getstatuscode () plus "";
 } catch (Exception e) {
 return e.getMessage();

Then I want to use the method of parallel uploading of File Transfer Protocol and blocks, but I don’t understand the official documents very well. Can you give me a simple sample, please, because google hasn’t found an example of parallel uploading of 7-Niu java-sdk blocks for half a day?

Then my server is a machine in Alibaba Cloud, 1G1stone has a bandwidth 1G 1Mbps. I don’t know if it is because the bandwidth is small that the upload speed is also affected.

I hope the experienced person can point out a direction greatly. Now it takes more than 1 minute to upload files of more than 10 m, and it is too slow to move to upload files of 100 m.

The upload function you are using is normal upload, not breakpoint continuous upload. The upload interface to be called for breakpoint continuous upload isResumeableIoApi.put, you can refer to unit test code here.