I am using context.logStreamName
to identify the lambda instance. Concurrency is set to unreserved. But it the log shows out only 50 instance is working.
Am I misunderstand the logStream (pre logStream pre instance)? I'd got the information from this blog
Below is my corresponding code:
let instances = {};
for (let i = 0; i < each_invokes; i++) {
lambda.invoke(params, function (err, data) {
if (err) {
console.log(err, err.stack);
} else {
// console.log(data);
let logs = Buffer.from(data.LogResult, 'base64').toString('utf8');
let instanceID = logs.match(new RegExp("\\$InstanceID: (.*?) \\$END", "ig"))[0].split(" ")[1];
if (instanceID) {
if (instances.hasOwnProperty(instanceID)) {
instances[instanceID] += 1
} else {
instances[instanceID] = 0
}
console.log(instanceID, instances[instanceID], 'StatusCode:', data.StatusCode);
} else {
console.log('missing instanceID:', data.StatusCode)
}
}
console.log(Object.keys(instances).length)
});
}
I console.log(context.logStreamName)
on my lambda function and use RegExp
to warp out instance ID.
The tail log keeps showing the below output:
b4afda96edf04e07ab819589d298521d 3 StatusCode: 200
50
a1ef1f4b518d47398daedda434ddd48c 3 StatusCode: 200
50
8dedc647796545ada94770895a8b190a 3 StatusCode: 200
50
7c4f48d72de0486e86e47c76ed3269ec 3 StatusCode: 200
50
2aa1f0dc9b0440fcac3d3127d123edb8 3 StatusCode: 200
50
3d1abeb38e7a45a4b933b669ad0c12d7 3 StatusCode: 200
50
531883ce26ac43b9bb0976726a2e5aa6 3 StatusCode: 200
50
cb9d0611a2e24244bd9ee98967a768c2 3 StatusCode: 200
50
So is it means that, the AWS lambda can only run 50 instance? If it does, how can I increase the count of concurrency in AWS Lambda?