Closed uglow closed 2 years ago
Hi @uglow, thanks for asking :)
This is not supported because of how the tool works internally.
Let me explain more in detail. The overall logic looks like this (pseudo-code):
Start with valid ARN ($LATEST)
--- Initializer step
Set $LATEST power to 128MB
Publish new function version X
Create new function alias "RAM128"
Set $LATEST power to 256MB
Publish new function version X+1
Create new function alias "RAM256"
... do the same for all the configured power values ...
--- Executor step
Invoke aliases [RAM128, RAM256, ...] in parallel, multiple times
Analyze invocation logs and identify optimal values
--- Cleaner step
Delete all those aliases and versions
But why does it work like this? Because using versions and aliases lets us run the whole process in parallel. Otherwise, longer running functions would take minutes/hours to power-tune.
For example, imagine a function that runs for 60 seconds on average, you want to test 5 power values with num=50
. With parallelInvocation=false
, the power-tuning process would take over 4 hours (60*50*5
seconds) since every single invocation runs in series. Even with parallelInvocation=true
it would still take 5 minutes (60*5
seconds). If you run everything in parallel using versions/aliases, it will take just 60 seconds in total :)
If you look at the Lambda PublishVersion API (or CLI command), you can only publish a new version starting from $LATEST. In other words, you can't say "Please publish a new version X, starting from this specific version or alias". You can only modify $LATEST and publish new versions from there.
I hope this is useful to understand some of the internals and why the tool is implemented this way. I think it makes sense to say that the ultra-fast power-tuning advantage outweighs the need for power-tuning a specific version or alias.
But maybe I'm missing something. Could you share more about what you're trying to achieve by power-tuning a specific version that is different from $LATEST?
Thanks for the detailed explanation! I think parallel executions are more important.
The use case I had in mind was to compare the performance of an old Lambda (by specifying the version) against the latest one.
Use Case: Tuning two versions of a Lambda.
When I specified the
lambdaARN
as `"arn:aws:lambda:ap-southeast-2:1234567890:my-function:25", the CleanupOnError step contained this error:Is it possible to specify particular versions of a Lambda function in the
lambdaARN
?