javascript - AWS Lambda Duration vs Function run time -


i noticed duration vs function run time issue in cloud watch log nodejs lambda function. using serverless plugin deploy/code functions.

this lambda function code:

module.exports.handler = function (event, context, cb) {     console.time("function_run_time");     myfunction(function (callback) {        console.timeend("function_run_time");        return cb(null, callback)     }); }; 

in cloud watch logs im getting following

2016-05-25t00:18:58.881z    45cd0785-ccce-11e6-818f-cb61404e173c    function_run_time: 477ms  report requestid: 45cd0785-ccce-11e6-818f-cb61404e173c  duration: 1866ms    billed duration: 1900 ms memory size: 1024 mb   max memory used: 39 mb 

i wondering why function run time @ 477ms duration @ 1866ms.

is there in code need call end lamdba function earlier?

thanks

check if have code running after calling callback see here: aws lambda

by default, callback wait until node.js runtime event loop empty before freezing process , returning results caller. can set property false request aws lambda freeze process after callback called

also if using older version of node lambda should call context.succeed(); , context.fail(error) end function.


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -