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

Optionally produce component which imports libpython311.so, libc.so, etc. instead of bundling them #28

Open
dicej opened this issue Sep 6, 2023 · 1 comment

Comments

@dicej
Copy link
Collaborator

dicej commented Sep 6, 2023

This would dramatically reduce binary sizes in cases where the host can provide these libraries.

@dicej
Copy link
Collaborator Author

dicej commented Dec 2, 2024

I did some research to determine a size breakdown for a "hello world" wasi-http component generated by componentize-py.

The TL;DR is that the stripped binary is about 18MB, 12MB of which is the data section with the pre-init memory snapshot, and the rest of which are the various modules, the largest of which is libpython312.so at about 4MB.

A stock, stripped libpython312.so is about 8MB, 4MB of which is data section(s) which get replaced with the memory snapshot when we pre-init.

The upshot is that we could save about 6MB per component by importing the modules it needs, but we'd still be looking at 12MB minimum component sizes. To reduce sizes further, we'd need some way to package the .py, .pyc, and related standard library files into a composable VFS component we could publish to a registry and reuse. And we'd also need a standard way to export a pre-init function that can be run by the host (e.g. at deployment time) to minimize cold-start times since we wouldn't be doing pre-init at build time anymore. See also #23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant