一个容器中的多对象初始化

时间:2018-07-11 13:02:17

标签: node.js amazon-web-services aws-lambda

由于来自一个与一个容器相关并具有一个堆的一个日志组的日志(您可以在代码附件中看到注释),有时node.js要求的lambda创建需要对象几次,这会导致过程超时错误。是什么原因,这可能是由于重新部署引起的吗?

// CREATING INSTANCES IN HEAP
{"level": 30, "time": 1531292404773,"msg": "Creating sequelize instance", "pid": 1, "hostname": "ip-10-16-82-158", "name": "log.info", "v": 1}
{"level": 30, "time": 1531292405472,"msg": "Creating Elasticsearch service instance","pid": 1,"hostname": "ip-10-16-82-158","name": "log.info","v": 1}
{"level": 30,"time": 1531292405529,"msg": "Creating GraphQL service instance using config","pid": 1,"hostname": "ip-10-16-82-158","name": "log.info","v": 1}
{"level": 30, "time": 1531292405530,"msg": "Creating sequelize instance","pid": 1,"hostname": "ip-10-16-82-158","name": "log.info","v": 1}
{"level": 30,"time": 1531292405891,"msg": "Creating GraphQL service instance using config","pid": 1,"hostname": "ip-10-16-82-158","name": "log.info","v": 1}
{"level": 30,"time": 1531292405898,"msg": "creating moment service", "pid": 1,"hostname": "ip-10-16-82-158","name": "log.info","v": 1}
{"level": 30,"time": 1531292405898,"msg": "Creating Elasticsearch service instance","pid": 1,"hostname": "ip-10-16-82-158","name": "log.info","v": 1}
{"level": 30,"time": 1531292406080,"msg": "creating SendGrid instance using config", "pid": 1,"hostname": "ip-10-16-82-158","name": "log.info","v": 1}
{"level": 30,"time": 1531292406490,"msg": "creating Twilio instance using config","pid": 1,"hostname": "ip-10-16-82-158","name": "log.info","v": 1}
{"level": 30,"time": 1531292406491,"msg": "creating sms/email notification service helper.","pid": 1,"hostname": "ip-10-16-82-158","name": "log.info","v": 1}
{"level": 30,"time": 1531292406492,"msg": "Creating sequelize instance","pid": 1,"hostname": "ip-10-16-82-158","name": "log.info","v": 1}
{"level": 30,"time": 1531292406666, "msg": "Creating sequelize instance","pid": 1,"hostname": "ip-10-16-82-158","name": "log.info","v": 1}

....
// SEVERAL REQUESTS WHICH RESPONDED OK
....

START RequestId: 2e263bc4-84d8-11e8-bbd0-415e63401f43 Version: $LATEST
{"level": 30,"time": 1531292465706,"msg": "Select school posted jobs 7ae01374-1547-4020-92ce-97e2274579cc","pid": 1,"hostname": "ip-10-16-82-158","name": "log.info","v": 1}
2018-07-11T07:01:05.842Z    05280000-84d8-11e8-9f38-4f97a011448d    Executing (default): SELECT
JD.name AS job_title,
J.id AS job_id,
J.created_at AS job_created_at,
J.updated_at AS job_updated_at,
J.deleted_at AS job_deleted_at
FROM job AS J
INNER JOIN job_details AS JD ON J.job_detail_id = JD.id
INNER JOIN job_status AS JS ON J.status_id = JS.id
WHERE J.deleted_at IS NULL AND J.school_id = '7ae01374-1547-4020-92ce-97e2274579cc' AND JS.name in ('live')
ORDER BY job_created_at DESC
LIMIT 0, 5; { logging: [Function: prettyConsoleLog],
plain: false,
raw: true,
showWarnings: false,
type: 'SELECT',
replacements: 
{ offset: 0,
max: 5,
schoolId: '7ae01374-1547-4020-92ce-97e2274579cc',
statuses: [ 'live' ] } }
END RequestId: 2e263bc4-84d8-11e8-bbd0-415e63401f43
REPORT RequestId: 2e263bc4-84d8-11e8-bbd0-415e63401f43  Duration: 15015.20 ms   Billed Duration: 15000 ms Memory Size: 1024 MB  Max Memory Used: 173 MB
// TIMEOUT !!!!!!!!!!!!!!!!!!!! 
2018-07-11T07:01:20.716Z 2e263bc4-84d8-11e8-bbd0-415e63401f43 Task timed out after 15.02 seconds

// CREATING INSTANCES IN HEAP AGAIN!!!
{"level": 30,"time": 1531292481315,"msg": "Creating sequelize instance","pid": 1,"hostname": "ip-10-16-82-158","name": "log.info","v": 1}
{"level": 30,"time": 1531292482039,"msg": "Creating Elasticsearch service instance","pid": 1,"hostname": "ip-10-16-82-158","name": "log.info","v": 1}
{"level": 30,"time": 1531292482072,"msg": "Creating GraphQL service instance using config","pid": 1,"hostname": "ip-10-16-82-158","name": "log.info","v": 1}
{"level": 30,"time": 1531292482073,"msg": "Creating sequelize instance","pid": 1,"hostname": "ip-10-16-82-158","name": "log.info","v": 1}
{"level": 30,"time": 1531292482311,"msg": "Creating GraphQL service instance using config","pid": 1,"hostname": "ip-10-16-82-158","name": "log.info","v": 1}
{"level": 30,"time": 1531292482318,"msg": "creating moment service","pid": 1,"hostname": "ip-10-16-82-158","name": "log.info","v": 1}
{"level": 30,"time": 1531292482318,"msg": "Creating Elasticsearch service instance","pid": 1,"hostname": "ip-10-16-82-158","name": "log.info","v": 1}
{"level": 30,"time": 1531292482527,"msg": "creating SendGrid instance using config","pid": 1,"hostname": "ip-10-16-82-158","name": "log.info","v": 1}
{"level": 30,"time": 1531292482975,"msg": "creating Twilio instance using config","pid": 1,"hostname": "ip-10-16-82-158","name": "log.info","v": 1}
{"level": 30,"time": 1531292482976,"msg": "creating sms/email notification service helper.","pid": 1,"hostname": "ip-10-16-82-158","name": "log.info","v": 1}
{"level": 30,"time": 1531292482985,"msg": "Creating sequelize instance","pid": 1,"hostname": "ip-10-16-82-158","name": "log.info","v": 1}
{"level": 30,"time": 1531292483206,"msg": "Creating sequelize instance","pid": 1,"hostname": "ip-10-16-82-158","name": "log.info","v": 1}
START RequestId: 4ba81942-84d8-11e8-aa99-e9f474049175 Version: $LATEST
{"level": 30,"time": 1531292515367,"msg": "Warm-up lambda.","pid": 1,"hostname": "ip-10-16-82-158","name": "log.info","group": "/aws/lambda/JobsService-dev-GQLProxy","stream": "2018/07/11/[$LATEST]7e2633ad092146cfa582e9b09c939641","fn": "JobsService-dev-GQLProxy","fnVersion": "$LATEST","reqId": "4ba81942-84d8-11e8-aa99-e9f474049175", "v": 1
}
END RequestId: 4ba81942-84d8-11e8-aa99-e9f474049175
REPORT RequestId: 4ba81942-84d8-11e8-aa99-e9f474049175  Duration: 199.73 ms Billed Duration: 200 ms Memory Size: 1024 MB    Max Memory Used: 154 MB 
START RequestId: b6a55134-84d8-11e8-88ac-0766ddb30245 Version: $LATEST
{"level": 30,"time": 1531292694965,"msg": "Warm-up lambda.","pid": 1,"hostname": "ip-10-16-82-158","name": "log.info","group": "/aws/lambda/JobsService-dev-GQLProxy","stream": "2018/07/11/[$LATEST]7e2633ad092146cfa582e9b09c939641","fn": "JobsService-dev-GQLProxy","fnVersion": "$LATEST","reqId": "b6a55134-84d8-11e8-88ac-0766ddb30245","v": 1}
END RequestId: b6a55134-84d8-11e8-88ac-0766ddb30245
REPORT RequestId: b6a55134-84d8-11e8-88ac-0766ddb30245  Duration: 241.86 ms Billed Duration: 300 ms Memory Size: 1024 MB    Max Memory Used: 154 MB

0 个答案:

没有答案