Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maintenance: Shrink size of Powertools Layer #1348

Closed
1 of 2 tasks
mploski opened this issue Jul 22, 2022 · 6 comments · Fixed by #1558
Closed
1 of 2 tasks

Maintenance: Shrink size of Powertools Layer #1348

mploski opened this issue Jul 22, 2022 · 6 comments · Fixed by #1558
Assignees
Labels
tech-debt Technical Debt tasks v2

Comments

@mploski
Copy link
Contributor

mploski commented Jul 22, 2022

Summary

Our overall, current size of pypi package is 74MB:
➜ test du -h -d1 | sort -h
8.0K ./bin
24K ./six-1.16.0.dist-info
28K ./pycache
28K ./fastjsonschema-2.16.1.dist-info
28K ./jmespath-1.0.1.dist-info
28K ./wrapt-1.14.1.dist-info
36K ./python_dateutil-2.8.2.dist-info
36K ./s3transfer-0.6.0.dist-info
44K ./boto3-1.24.35.dist-info
48K ./aws_lambda_powertools-1.26.5.dist-info
68K ./aws_xray_sdk-2.10.0.dist-info
72K ./urllib3-1.26.10.dist-info
148K ./jmespath
164K ./botocore-1.27.35.dist-info
184K ./fastjsonschema
208K ./wrapt
560K ./s3transfer
716K ./dateutil
824K ./urllib3
908K ./aws_xray_sdk
1.3M ./boto3
1.6M ./aws_lambda_powertools
67M ./botocore

As it can be seen on the listing 92.2% of the size is due to botocore + boto3 package. We should find a way to make it smaller to limit overall size of our project

Why is this needed?

Less time needed for downloading powertools package via pip or lambda with powertools layer.

Which area does this relate to?

No response

Solution

No response

Acknowledgment

@mploski mploski added triage Pending triage from maintainers internal Maintenance changes labels Jul 22, 2022
@heitorlessa heitorlessa removed the triage Pending triage from maintainers label Aug 8, 2022
@mploski
Copy link
Contributor Author

mploski commented Sep 6, 2022

with botocore models compressed fully and pydantic not included, here is the overall size of unzipped packages
➜ python git:(master) ✗ du -h -d 1 | sort -h
12K ./bin
24K ./six-1.16.0.dist-info
28K ./fastjsonschema-2.16.1.dist-info
28K ./jmespath-1.0.1.dist-info
28K ./wrapt-1.14.1.dist-info
32K ./idna-3.3.dist-info
36K ./python_dateutil-2.8.2.dist-info
36K ./s3transfer-0.6.0.dist-info
36K ./typing_extensions-4.3.0.dist-info
40K ./dnspython-2.2.1.dist-info
44K ./boto3-1.24.62.dist-info
48K ./email_validator
52K ./aws_lambda_powertools-1.26.6.dist-info
52K ./email_validator-1.2.1.dist-info
68K ./aws_xray_sdk-2.10.0.dist-info
72K ./urllib3-1.26.12.dist-info
92K ./pycache
148K ./jmespath
164K ./botocore-1.27.62.dist-info
164K ./pydantic-1.10.0.dist-info
184K ./fastjsonschema
324K ./wrapt
488K ./idna
560K ./s3transfer
716K ./dateutil
828K ./urllib3
912K ./aws_xray_sdk
1.3M ./boto3
1.9M ./dns
7.1M ./aws_lambda_powertools
8.1M ./botocore
24M .

compressed python layer
python-layer.tar.gz -> 5.5MB

with removed all dist-info + pyc files
8.0K ./bin
32K ./email_validator
80K ./jmespath
100K ./fastjsonschema
268K ./wrapt
280K ./idna
300K ./s3transfer
444K ./aws_xray_sdk
460K ./urllib3
488K ./dateutil
1.0M ./boto3
1.1M ./dns
5.4M ./aws_lambda_powertools
7.1M ./botocore
17M .

Compressed files

python-layer2.tar.gz -> 4MB

@heitorlessa
Copy link
Contributor

heitorlessa commented Sep 6, 2022 via email

@dverheijden
Copy link

dverheijden commented Sep 13, 2022

Something you're probably already aware of: The Python 3.8 runtime for Lambda already ships with boto3 (see also here).

Since layers can only be used with lambda functions, you may want to consider making a layer with Python 3.8+ compatibility without boto3 included.

@heitorlessa heitorlessa added the v2 label Sep 20, 2022
@heitorlessa
Copy link
Contributor

Something you're probably already aware of: The Python 3.8 runtime for Lambda already ships with boto3 (see also here).

Since layers can only be used with lambda functions, you may want to consider making a layer with Python 3.8+ compatibility without boto3 included.

Yes @dverheijden ; - ) We're following that + other optimizations to drop the final Lambda Layer to ~1M including Pydantic.

Upstream work: aws-powertools/powertools-lambda-layer-cdk#4

@heitorlessa heitorlessa assigned rubenfonseca and unassigned mploski Oct 3, 2022
@heitorlessa heitorlessa linked a pull request Oct 3, 2022 that will close this issue
7 tasks
@heitorlessa
Copy link
Contributor

Closing as we're wrap to launch V2

@github-actions
Copy link
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

This issue is now closed. Please be mindful that future comments are hard for our team to see.

If you need more assistance, please either tag a team member or open a new issue that references this one.

If you wish to keep having a conversation with other community members under this issue feel free to do so.

@heitorlessa heitorlessa added tech-debt Technical Debt tasks and removed internal Maintenance changes labels Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tech-debt Technical Debt tasks v2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants