目前我只能进行lambda函数的最大 50 并发执行。是因为我必须设置 ConnectionLimit 。
使用aws .net skd我可以通过以下方式进行设置:
new AmazonLambdaClient(new AmazonLambdaConfig
{
ConnectionLimit = 200,
RegionEndpoint = RegionEndpoint.APSoutheast2
});
///这是我用来调用lambda的代码
// Load the AWS SDK for Node.js
var AWS = require('aws-sdk');
// Set the region
AWS.config.update({region: 'ap-southeast-2'});
var lambda = new AWS.Lambda();
function fireLambda(){
var lambdaParams = {
FunctionName: "testLambda",
InvocationType: "RequestResponse",
LogType: "Tail",
Payload: '{"msgCount": 888}'
};
lambda.invoke(lambdaParams, function(err, data) {
if (err){
console.log(err, err.stack); // an error occurred
}else{
console.log(data); // successful response
}
fireLambda();
});
}
exports.handler = (event, context, callback) => {
let maxCount = event.maxConcurrentCount || 50;
setTimeout(() => {
process.exit(1);
}, 8000);
while(maxCount > 0)
{
maxCount--;
fireLambda();
}
};
此外,此Lambda的最大并发限制设置为 300 。
答案 0 :(得分:1)
我认为你应该看看:AWSjavascriptSDKdoc
特别是需要参数的函数putFunctionConcurrency
:
- FunctionName = name of the function you are setting concurrent execution limits on.
- ReservedConcurrentExecutions = concurrent execution limit number