Comments (2)
Hi Alex,
Thanks for the fast reply.
Your suggestion is much nicer, I think I just started down a rabbit hole and totally looked over the fact there is code invoking the function rather than a Step Function integration invoking it.
I'm happy to go look and pick this proposed solution up 👍🏻
from aws-lambda-power-tuning.
Hi @ryancormack 👋 thanks for sharing 🙏
I like the idea of a configurable way to sleep X milliseconds between each invocation.
I wouldn't implement it as an actual Wait state in the Step Functions definition. Imho, there are easier ways to achieve the same without making the overall state machine more complex (and expensive) for everyone.
In the past, I've done this by implementing the Thread.sleep(...)
logic directly in the function I was power-tuning. The function would sleep only if a special input parameter was given in the payload (something obvious like event.sleepMsForPowertuning
.
Alternatively, we could implement an optional sleepBetweenRunsMs
input parameter for the state machine, like you suggested. This way, you don't have to implement custom logic in your Lambda functions, across multiple runtimes, etc.
From the point of view of the "usability", as a user you shouldn't care much if it's implemented as a Wait state or as a Thread.sleep(...)
in the Executor
step. You need to pay for both (there is probably a way to compare how many ms of sleep correspond to a Step Function wait state in terms of $$$). Personally, I'd prefer the second option because it keeps the state machine simple (visually).
Also, each Executor
invokes your Function num
times, so we actually need to sleep multiple times within the Executor
invocation. A Wait state wouldn't be enough.
If we move forward with the second option, the implementation would be fairly simple. We could add a couple of sleeps here and here:
...
if (sleepBetweenRunsMs) {
await sleep(sleepBetweenRunsMs);
}
...
where sleep
looks like this:
function sleep(ms) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
}
Do you feel like opening a pull-request (PR) for this? Otherwise, I could look into it next week.
from aws-lambda-power-tuning.
Related Issues (20)
- Support for testing stream-based functions HOT 2
- Option to Consume Payload from SQS source? HOT 3
- Actual Payload Shared in Step Functions Console On Function Error HOT 8
- Add KMS permission(s) that may be optionally needed HOT 11
- cost discrepancy on small lambdas HOT 2
- Add logic to identify insufficient resources causing timeout HOT 5
- 💡 Add this project to awesome-italia-opensource HOT 2
- Feature Request: Allow naming of statemachine HOT 5
- Upgrade to Node 20 HOT 1
- Getting Error While Increasing Power values to 10240 MB HOT 1
- Support for array payload accepting functions HOT 4
- Remove security sensitive lambda:DeleteFunction permission HOT 2
- Log analysis uses Billed Duration rather than Duration for calculating Lambda run time HOT 2
- Image in payload possibility HOT 5
- Bug: Support JSON logging HOT 20
- Missing num error while executing state machine HOT 4
- Help deciphering error message HOT 17
- Executor Invocation Error due to permissions denied HOT 4
- SAR versioning is behind HOT 3
- Power Tuning Result not showing 'Execution Time' HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-lambda-power-tuning.