Aws::S3::S3Client 构造函数非常慢
Aws::S3::S3Client constructor very slow
我正在尝试使用 AWS C++ SDK 为 S3 生成带符号的 URL,但是 Aws::S3::S3Client
构造函数似乎非常慢。在以下示例中:
#include <aws/core/Aws.h>
#include <aws/s3/S3Client.h>
int main() {
Aws::SDKOptions options;
Aws::InitAPI(options);
printf("1\n");
Aws::S3::S3Client client;
printf("2\n");
Aws::ShutdownAPI(options);
}
编译:
g++ example.cc -laws-cpp-sdk-core -laws-cpp-sdk-s3
1
和 2
之间有很长的延迟(至少 5 秒)。这是什么原因造成的?
该库是通过以下方式构建和安装的:
git clone https://github.com/aws/aws-sdk-cpp.git
cd aws-sdk-cpp
cmake . -DCMAKE_BUILD_TYPE=Release -D BUILD_ONLY="s3"
make
make install
当不在 AWS 上 运行 时,设置:
AWS_EC2_METADATA_DISABLED=true
禁用导致延迟的元数据API。
我正在尝试使用 AWS C++ SDK 为 S3 生成带符号的 URL,但是 Aws::S3::S3Client
构造函数似乎非常慢。在以下示例中:
#include <aws/core/Aws.h>
#include <aws/s3/S3Client.h>
int main() {
Aws::SDKOptions options;
Aws::InitAPI(options);
printf("1\n");
Aws::S3::S3Client client;
printf("2\n");
Aws::ShutdownAPI(options);
}
编译:
g++ example.cc -laws-cpp-sdk-core -laws-cpp-sdk-s3
1
和 2
之间有很长的延迟(至少 5 秒)。这是什么原因造成的?
该库是通过以下方式构建和安装的:
git clone https://github.com/aws/aws-sdk-cpp.git
cd aws-sdk-cpp
cmake . -DCMAKE_BUILD_TYPE=Release -D BUILD_ONLY="s3"
make
make install
当不在 AWS 上 运行 时,设置:
AWS_EC2_METADATA_DISABLED=true
禁用导致延迟的元数据API。