1

I have a minio cluster server with 2 nodes on linux(minio version Release.2023-05-04T21-44-30Z). The minio is used by a java(spring boot) application manages file upload and download. Minio runs with default config.

The application runs good and fast both upload and download, but very rarely uploading files suddenly goes very slow. Normally upload a file would be finised in a second, but when this problem happens it goes more than 1 minite (file size less than 100KB). And the problem will auto healed after about half a hour.

The application and minio seems good when problem happens. I tried restart the minio and java application but not worked. The network, cpu and memory is quite normal, I tried to upload files using minio console and it works fine. I just don't understand.

The java application is as below:

//pom file:
<dependency>
    <groupId>io.minio</groupId>
        <artifactId>minio</artifactId>
    <version>8.5.2</version>
</dependency>

//java code:
@Configuration
public class MinIoClientConfig {

    @Value("${minio.url}")
    private String url;

    @Value("${minio.username}")
    private String userName;

    @Value("${minio.password}")
    private String password;

    @Bean
    public MinioClient minioClient(){
        return MinioClient.builder().endpoint(url).credentials(userName, password).build();
    }
}

@Service
@Slf4j
public class MinIoServiceImpl implements IMinIoService {

    @Autowired
    private MinioClient minioClient;

    public FileBo upload(UploadFileTypeEnum uploadFileTypeEnum, UploadFileParam uploadFileParam) {
        //...
        try(InputStream inputStream = uploadFileParam.getFile().getInputStream()) {
            minioClient.putObject(PutObjectArgs.builder()
                    .bucket(uploadFileTypeEnum.getBucket().getName())
                    .object(savedPathName).userMetadata(generateMeta(uploadFileTypeEnum, uploadFileParam))
                    .stream(inputStream, uploadFileParam.getFile().getSize(), -1)
                    .build());
            return fileBo;
        }
    }
}
Joshua
  • 125
  • 2
  • 16

0 Answers0