Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

require('./lib/lambda-service') should not reload module every time #76

Open
elundh opened this issue Jan 10, 2025 · 3 comments
Open

require('./lib/lambda-service') should not reload module every time #76

elundh opened this issue Jan 10, 2025 · 3 comments

Comments

@elundh
Copy link

elundh commented Jan 10, 2025

I was testing out lambda-warmer with a concurrency of 2 and I could not figure out why it was upwards of 2 seconds to run. By
adding let lambda = null; to the top of index.js and

changing line 81 to be
if(!lambda){
lambda = require('./lib/lambda-service');
}
It cuts down on the time needed to run each subsequent warming ping by a lot because it will only load the library once.
With this change I am seeing much quicker run times which will save money. I wanted to put in a PR but didn't have permission.

@elundh
Copy link
Author

elundh commented Jan 10, 2025

yes that would be the exact solution.

@naorpeled
Copy link
Collaborator

Hey!
I'm currently on vacation and can't test this but feel free to open a PR and I'll happily review when I get back :)

@elundh
Copy link
Author

elundh commented Jan 13, 2025

Sure! I made a pr, Thanks for making this library it's pretty much exactly what I was thinking I was going to have to make and it's a lot cheaper to keep lambda warm than provisioned concurrency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@naorpeled @elundh and others