Is there a way to programmatically know how many concurrent instances of a Lambda function are executing?
Lets suppose, at a given time, several instances of a particular Lambda function have been invoked asynchronously,
Then, is there a way to find how many active concurrent instances of the Lambda function are currently running?
In the account level metrics in the Dashboard we can find the number of concurrent executions. Also, I think for each new Lambda container creation, Cloudwatch creates a new Log Stream for the Lambda function. Maybe it is possible to somehow use those.
But I was wondering if there exists a different way to get these numbers programmatically, for example like using boto3
api etc.?
aws-lambda
add a comment |
Lets suppose, at a given time, several instances of a particular Lambda function have been invoked asynchronously,
Then, is there a way to find how many active concurrent instances of the Lambda function are currently running?
In the account level metrics in the Dashboard we can find the number of concurrent executions. Also, I think for each new Lambda container creation, Cloudwatch creates a new Log Stream for the Lambda function. Maybe it is possible to somehow use those.
But I was wondering if there exists a different way to get these numbers programmatically, for example like using boto3
api etc.?
aws-lambda
add a comment |
Lets suppose, at a given time, several instances of a particular Lambda function have been invoked asynchronously,
Then, is there a way to find how many active concurrent instances of the Lambda function are currently running?
In the account level metrics in the Dashboard we can find the number of concurrent executions. Also, I think for each new Lambda container creation, Cloudwatch creates a new Log Stream for the Lambda function. Maybe it is possible to somehow use those.
But I was wondering if there exists a different way to get these numbers programmatically, for example like using boto3
api etc.?
aws-lambda
Lets suppose, at a given time, several instances of a particular Lambda function have been invoked asynchronously,
Then, is there a way to find how many active concurrent instances of the Lambda function are currently running?
In the account level metrics in the Dashboard we can find the number of concurrent executions. Also, I think for each new Lambda container creation, Cloudwatch creates a new Log Stream for the Lambda function. Maybe it is possible to somehow use those.
But I was wondering if there exists a different way to get these numbers programmatically, for example like using boto3
api etc.?
aws-lambda
aws-lambda
asked Nov 15 '18 at 1:27
Anirban DasAnirban Das
284
284
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The short answer is no.
You can programatically access cloudwatch metrics (see: boto3 CloudWatch.Client.get_metric_data), however these metrics lag behind by a minute. Even worse, while individual lambdas return invocations
, you can only get ConcurrentExecutions
across the whole of your account- which means the best you could ever do is if you put a lambda in it's own AWS account, and even then you'd still be a minute behind- which is typically longer than the average lambda lifespan.
I should point out, though, that through 'reserved concurrency' lambda does expose a way to, atleast rudimentarily, control concurrency. The example use-case for this is if you are calling an external service/database that has a limited connection pool.
Thanks a lot for the explanation. Though, I wonder why AWS would not let us access this information.
– Anirban Das
Nov 15 '18 at 19:11
I guess it's because aws wants lambda to be treated as this stateless execution resource that isn't effected by its concurrency (for example, I suspect that answering the same question for any server cluster framework world hard). As an exercise I would suggest you ask this question again in terms of what you're trying to achieve by watching concurrency to see if there's a more 'lamdaish' way of achieving it.
– thomasmichaelwallace
Nov 15 '18 at 22:14
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53311165%2fis-there-a-way-to-programmatically-know-how-many-concurrent-instances-of-a-lambd%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The short answer is no.
You can programatically access cloudwatch metrics (see: boto3 CloudWatch.Client.get_metric_data), however these metrics lag behind by a minute. Even worse, while individual lambdas return invocations
, you can only get ConcurrentExecutions
across the whole of your account- which means the best you could ever do is if you put a lambda in it's own AWS account, and even then you'd still be a minute behind- which is typically longer than the average lambda lifespan.
I should point out, though, that through 'reserved concurrency' lambda does expose a way to, atleast rudimentarily, control concurrency. The example use-case for this is if you are calling an external service/database that has a limited connection pool.
Thanks a lot for the explanation. Though, I wonder why AWS would not let us access this information.
– Anirban Das
Nov 15 '18 at 19:11
I guess it's because aws wants lambda to be treated as this stateless execution resource that isn't effected by its concurrency (for example, I suspect that answering the same question for any server cluster framework world hard). As an exercise I would suggest you ask this question again in terms of what you're trying to achieve by watching concurrency to see if there's a more 'lamdaish' way of achieving it.
– thomasmichaelwallace
Nov 15 '18 at 22:14
add a comment |
The short answer is no.
You can programatically access cloudwatch metrics (see: boto3 CloudWatch.Client.get_metric_data), however these metrics lag behind by a minute. Even worse, while individual lambdas return invocations
, you can only get ConcurrentExecutions
across the whole of your account- which means the best you could ever do is if you put a lambda in it's own AWS account, and even then you'd still be a minute behind- which is typically longer than the average lambda lifespan.
I should point out, though, that through 'reserved concurrency' lambda does expose a way to, atleast rudimentarily, control concurrency. The example use-case for this is if you are calling an external service/database that has a limited connection pool.
Thanks a lot for the explanation. Though, I wonder why AWS would not let us access this information.
– Anirban Das
Nov 15 '18 at 19:11
I guess it's because aws wants lambda to be treated as this stateless execution resource that isn't effected by its concurrency (for example, I suspect that answering the same question for any server cluster framework world hard). As an exercise I would suggest you ask this question again in terms of what you're trying to achieve by watching concurrency to see if there's a more 'lamdaish' way of achieving it.
– thomasmichaelwallace
Nov 15 '18 at 22:14
add a comment |
The short answer is no.
You can programatically access cloudwatch metrics (see: boto3 CloudWatch.Client.get_metric_data), however these metrics lag behind by a minute. Even worse, while individual lambdas return invocations
, you can only get ConcurrentExecutions
across the whole of your account- which means the best you could ever do is if you put a lambda in it's own AWS account, and even then you'd still be a minute behind- which is typically longer than the average lambda lifespan.
I should point out, though, that through 'reserved concurrency' lambda does expose a way to, atleast rudimentarily, control concurrency. The example use-case for this is if you are calling an external service/database that has a limited connection pool.
The short answer is no.
You can programatically access cloudwatch metrics (see: boto3 CloudWatch.Client.get_metric_data), however these metrics lag behind by a minute. Even worse, while individual lambdas return invocations
, you can only get ConcurrentExecutions
across the whole of your account- which means the best you could ever do is if you put a lambda in it's own AWS account, and even then you'd still be a minute behind- which is typically longer than the average lambda lifespan.
I should point out, though, that through 'reserved concurrency' lambda does expose a way to, atleast rudimentarily, control concurrency. The example use-case for this is if you are calling an external service/database that has a limited connection pool.
answered Nov 15 '18 at 9:38
thomasmichaelwallacethomasmichaelwallace
2,6901918
2,6901918
Thanks a lot for the explanation. Though, I wonder why AWS would not let us access this information.
– Anirban Das
Nov 15 '18 at 19:11
I guess it's because aws wants lambda to be treated as this stateless execution resource that isn't effected by its concurrency (for example, I suspect that answering the same question for any server cluster framework world hard). As an exercise I would suggest you ask this question again in terms of what you're trying to achieve by watching concurrency to see if there's a more 'lamdaish' way of achieving it.
– thomasmichaelwallace
Nov 15 '18 at 22:14
add a comment |
Thanks a lot for the explanation. Though, I wonder why AWS would not let us access this information.
– Anirban Das
Nov 15 '18 at 19:11
I guess it's because aws wants lambda to be treated as this stateless execution resource that isn't effected by its concurrency (for example, I suspect that answering the same question for any server cluster framework world hard). As an exercise I would suggest you ask this question again in terms of what you're trying to achieve by watching concurrency to see if there's a more 'lamdaish' way of achieving it.
– thomasmichaelwallace
Nov 15 '18 at 22:14
Thanks a lot for the explanation. Though, I wonder why AWS would not let us access this information.
– Anirban Das
Nov 15 '18 at 19:11
Thanks a lot for the explanation. Though, I wonder why AWS would not let us access this information.
– Anirban Das
Nov 15 '18 at 19:11
I guess it's because aws wants lambda to be treated as this stateless execution resource that isn't effected by its concurrency (for example, I suspect that answering the same question for any server cluster framework world hard). As an exercise I would suggest you ask this question again in terms of what you're trying to achieve by watching concurrency to see if there's a more 'lamdaish' way of achieving it.
– thomasmichaelwallace
Nov 15 '18 at 22:14
I guess it's because aws wants lambda to be treated as this stateless execution resource that isn't effected by its concurrency (for example, I suspect that answering the same question for any server cluster framework world hard). As an exercise I would suggest you ask this question again in terms of what you're trying to achieve by watching concurrency to see if there's a more 'lamdaish' way of achieving it.
– thomasmichaelwallace
Nov 15 '18 at 22:14
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53311165%2fis-there-a-way-to-programmatically-know-how-many-concurrent-instances-of-a-lambd%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown