Skip to content

Commit 18e9e47

Browse files
committed
docs: add publish and install sizes performance
1 parent 1be7104 commit 18e9e47

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed
Loading
Loading
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Performance > Publish and Install sizes
2+
3+
A “publish size” of an npm package is the size of the source code published to npm. The "install size" of an npm package refers to the amount of disk space that will be used when the package is installed on your system. This includes not only the size of the package itself, but also any dependencies that it relies on. When you install an npm package, npm will download the package and all of its dependencies to a node_modules directory in your project, so the install size is the total size of all of these files combined.
4+
5+
If you import the entire SDK even if your application uses just a subset of SDK’s functionalities, it’ll increase application size. Your application may potentially exceed disk size quota in resource-constrained environments, like Serverless or IoT devices, blocking your application development. There are other performance and efficiency issues with large install sizes:
6+
7+
- **Installation Time**: Larger dependencies take longer to download and install, which can slow down the development process.
8+
- **Resource Consumption**: Larger dependencies may consume more memory and CPU resources, affecting the scalability and efficiency of the application, especially in serverless environments.
9+
- **Dependency Management**: Managing large dependencies can be more complex, as they may have their own dependencies and version requirements, leading to potential conflicts and issues.
10+
- **Deployment Size**: Larger dependencies increase the size of deployment packages, which can be a concern for deployment pipelines and storage costs.
11+
12+
It's generally advisable to keep dependencies as small and as minimal as possible to improve the performance and maintainability of Node.js applications. In v3, we divided the JavaScript SDK core into multiple [modular packages](https://aws.amazon.com/blogs/developer/modular-packages-in-aws-sdk-for-javascript/) and publishing each service as its own package, thus reducing both the publish and install sizes.
13+
14+
The install and publish sizes of AWS SDK for JavaScript can be verified from third party tools, like [PackagePhobia](https://packagephobia.com/), which measures the actual byte size of the artifacts. For example, the below screenshots show that v2 package has install size of 93.6 MB, while v3 DynamoDB package has install size of 6.29 MB.
15+
16+
![Image: https://packagephobia.com/result?p=aws-sdk](./img/packagephobia-aws-sdk.png) ![Image: https://packagephobia.com/result?p=@aws-sdk/client-dynamodb](./img/packagephobia-aws-sdk-client-dynamodb.png)
17+
18+
The install size on disk can also be verified locally on your machine as follows:
19+
20+
```
21+
$ npm install [email protected] --save-exact
22+
23+
$ du -sh node_modules
24+
101M node_modules
25+
```
26+
27+
```
28+
$ npm install @aws-sdk/[email protected] --save-exact
29+
30+
$ du -sh node_modules
31+
17M node_modules
32+
```
33+
34+
The install size on disk is larger, as it’s the actual size on disk which depends on blocks are allocated. It may be different on your machine, but the relative difference between the sizes would be similar.
35+
36+
Most of AWS SDK for JavaScript applications use one to three clients. Even if you install the five most popular clients, the install size is less than a third of that in v2.
37+
38+
```
39+
$ npm install @aws-sdk/client-s3 @aws-sdk/client-kinesis \
40+
@aws-sdk/client-sns @aws-sdk/client-cloudwatch @aws-sdk/client-api-gateway
41+
42+
$ du -sh node_modules
43+
30M node_modules
44+
```

0 commit comments

Comments
 (0)