Closed tezmaster closed 7 years ago
I've opened an issue/PR for validator.js
a quick win to reduce this packages load time to <10ms
https://github.com/chriso/validator.js/issues/645
retry-as-promised is losing 50ms requiring bluebird which is also used elsewhere in Sequelize can this not be swapped out for native promises, since v4+ is now using ES6?
Which Sequelize version you are using ?
Hi Sushant,
Thanks for looking at this, in AWS I'm currently using version 3.30.2 however I have downloaded the current codebase and looked at version 4.0.0-2 and this has roughly the same startup time as the older version, if not slightly slower.
I found a nice npm package to check load times it's called time-require
it shows 35 requires (3 of which is for the plugin itself) with a total start time of 316ms for v4.0.0-2.
Most of the requires are around 4 - 8ms with lodash and bluebird taking 60ms roughly each. It would take longer but I'm using my version of the validator.js package which has shaved off 40ms
Recent v3.30.3
accidentally contained esdocs +100MB
which was fixed in https://github.com/sequelize/sequelize/releases/tag/v3.30.4 , May be lamba got updated to v3.30.3
?
Our package depend on others, which depend upon others and resultant build is about 15MB I think. I dont know what might be causing this delay, but I dont think we can do anything about it. We need all those packages and have to wait for all of them being loaded.
If you can point out any culprit code or dependency, we may try to improve it but its mostly something we cant solve
What you are doing?
Requiring Sequelize from AWS Lambda (512mb) during a cold start takes in excess of 800ms this is before I've attempted to connect to the DB or load any models. Each module takes >70ms to add I've created a lazy load routine to fix that but I don't know what if anything I can do to improve the speed of
requiring
this package.You can half the start up to 400ms by increasing the ram to 1GB however this is only any issue on a cold start, warm starts the whole Lambda run's in <100ms.
What do you expect to happen?
I would like this to load <100ms
Even on my development machine (MACBook Pro) the code above is taking >300ms
Times of includes inside Sequelize
Below I have included
requires
>10ms these are from my local machine where Sequelize takes between 290 to 320ms to load in this case: 317.690msmodel: 24.223ms retry-as-promised: 66.473ms utils: 201.895ms