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

Lambda Package Sized (pt2) #4462

Closed
kyeotic opened this issue Aug 6, 2020 · 3 comments
Closed

Lambda Package Sized (pt2) #4462

kyeotic opened this issue Aug 6, 2020 · 3 comments

Comments

@kyeotic
Copy link
Contributor

kyeotic commented Aug 6, 2020

I've raised this issue before, but the situation has gotten significantly worse since then. Running npx cost-of-modules after an install of apollo-server-lambda shows an install footprint of 34MB, which is zipping down to about 9MB.

┌──────────────────────────┬──────────────┬────────┐
│ name                     │ children     │ size   │
├──────────────────────────┼──────────────┼────────┤
│ apollo-server-lambda     │ 222          │ 34.38M │

The major offenders appear to be related to polyfill/backwards-compatability. Its not clear to me how necessary they are, or why they are so incredibly large.

6.8M    core-js
4.0M    @apollo
3.2M    util.promisify
3.2M    string.prototype.trimstart
3.2M    string.prototype.trimend
3.2M    object.getownpropertydescriptors
3.0M    graphql
1.4M    @types

Surprisingly the usual dead-weight suspect, @types, is at the bottom of this list. The polyfill libs are made up almost entirely of their own copies of es-abstract, a 3.1MB compatability layer. I don't know why each one has a seperate copy, it seems like they should have been flattened by npm.

The largest offender, core-js, is used by apollo-env. It's not clear to me how this happens: npm ls lists it as a direct dependencies, but it is not in the package.json as far as I can tell.

I'd like to discuss possible avenues for addressing the size of this package. I understand that some of these, like @types can be safely stripped from deployment artifacts, so perhaps this is also true of some of the above. If not I think its worth identifying why they are present and how they might be avoided.

@duboisj-illuminate
Copy link

(Slightly off-topic, but you once mentioned in the previous thread that you could share your test harness. If that is easy for you to do, I'm interested. If not, no sweat. My immediate goal is doing cold-start testing on other graphql frameworks, although Apollo is one possibility for us so I might want to test that eventually.)

@kyeotic
Copy link
Contributor Author

kyeotic commented Oct 28, 2020

@duboisj-illuminate Apologies, its an internal tool that was rejected from Open Source release 🤕

@duboisj-illuminate
Copy link

I see, no sweat - I'll manage another way. Thanks for the fast response, and for the good writeups about start times.

@kyeotic kyeotic closed this as completed Dec 29, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants