当我将应用程序部署到 AWS 时,我遇到了严重的 aws-sdk 性能问题。我正在使用它,如下所示:
wrapper = {
accessKeyId: "YOURACCESSKEY",
secretAccessKey: "YOURSECRETKEY",
region: "us-east-1",
endpoint: new AWS.Endpoint('http://localhost:8000')
};
AWS.config.update(wrapper);
const docClient = new AWS.DynamoDB.DocumentClient();
module.exports ={"docClient":docClient};
我研究并发现 - https://github.com/aws/aws-sdk-js/issues/900 - 我们可以在 aws 中指定 httpOptions 以便启用 keepAlive。
我的问题是,如何在上面的 AWS-sdk 构造函数中指定 httpOptions:
var dynamo = new AWS.DynamoDB({
region: "ap-southeast-2",
httpOptions: {
agent: new https.Agent({
rejectUnauthorized: true,
keepAlive: true
})
}
});
如何将其添加到包装器配置中。它不接受 AWS.config.update 中任何额外的 httpOptions 键