amazon web services - AWS Lambda time out in 6 seconds -
i using serverless framework nodejs(version 4.4) create aws lambda functions. default timeout 6 seconds lambda execution. connecting mysql database using sequelize orm. see errors execution timed out. code works error. nothing works after timeout error. hard me make sense out of timeout. afraid increasing timeout incur more charge.
if seeing errors 'execution timed out' cutting execution of lambdas low timeout.
there might several reasons this:
- the initialization of container can slow, should occur first call of container. if have low memory setting , load lots of libraries can happen takes quite while(usually shouldn't problem node)
- connecting database can slow
- if reuse database connections, it's possible stale , can lead timeout.
- your database queries may slow.
to mitigate problem should temporarily add logging lambda , increase timeout, can figure out takes long. unless heavy lambda user unlikely use 400.000 free gb-seconds month. if run lambdas 128 mb equates 3.200.000 seconds per month / 103.225 seconds per day / 28.5 hours per day. try test higher memory settings well, depending on case can reduce total gb/s consumed.
as others pointed out pay time used, if lambda finishes faster timeout pay actual time consumed(in 100 ms increments).
Comments
Post a Comment