We started noticing slower deployment times when we switched to GIT deployment on Amazon Elastic Beanstalk. The core issue turned out to be how nodejs module dependencies are packaged. When git is used it is typical to ignore the node_modules directory and thus 'npm install' will install them server side during a deployment. The problem is that 'npm install' has a hard dependency on git so you must have all of the following installed on all instances for deployment to work correctly:
- git
- openssl
- expat
- gettext
- zlib
#Tests We tested the following 2 builds, one with node_modules bundled and one where it was installed server side via 'npm install'.
#Test1 - Full Dependency Uploads 8.6Mb file system including node_modules
Result times in ms for running 'eb deploy':
- 189642
- 195293
- 179954
- 171792
#Test2 - NPM Dependency Upload 756Kb excluding node_modules Must install
- git
- openssl
- expat
- gettext
- zlib
Must run:
- npm install server side to create node_modules
Result times in ms for running 'eb deploy':
- 240057
- 240653
- 287272
- 248354
#Summary By sending the 'node_module' directory in each build, we saved 70 seconds per deployment on average even though we were uploading a file 10x larger.