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

How to set browser VM specs (cpu mhz / available memory)? #191

Open
alienself opened this issue Jan 4, 2024 · 5 comments
Open

How to set browser VM specs (cpu mhz / available memory)? #191

alienself opened this issue Jan 4, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@alienself
Copy link

Hi, I am using an alpine image to test nodejs performance with this project.

However when running cat /proc/cpuinfo, i get cpu MHz: 14.178 and cat /proc/meminfo gives a total memory of around 128MB.

Is this "normal"? What if I want to allocate let say 4GB of ram allowed by wasm32? What about the CPU, something seems odd with this low mhz, no?
In other words, any way to configure the "specs" of the VM in the browser?

Additionally, do containers have multi-threading support since wasm-thread are a thing and available with emscripten?

@Cinemacloud
Copy link

Yes a section of how to modify or parameterize cpu, disk, mem, storage would be very practical step for this project. But perhaps it is just a Docker concern and c2w handles that aspect transparently?

@ktock
Copy link
Owner

ktock commented Jan 5, 2024

any way to configure the "specs" of the VM in the browser?

VM memory size is configurable during conversion by passing --build-arg VM_MEMORY_SIZE_MB=<SIZE> but no other parameter is provided as of now. SGTM about allowing configuration of other parameters as well. Configuration during conversion should be done in a similar way as VM_MEMORY_SIZE_MB. And, it would be great if we can add some flags for the Wasm image itself for changing some VM parameters when launching the container.

multi-threading support

Yes, this is a future plan.

@ktock ktock added the enhancement New feature or request label Jan 5, 2024
@alienself
Copy link
Author

@ktock thank you very much for you reply!
The vm memory flag is definitely what I was looking for.

What about the cpu clock speed? Do you think by default the vm is running at its maximal speed?

Additionally is it possible to run the vm inside a worker?

Ps: loved your talk at Cloud Native very exciting work!

@ktock
Copy link
Owner

ktock commented Jan 5, 2024

What about the cpu clock speed? Do you think by default the vm is running at its maximal speed?

Tuning hasn't done yet, so maybe there is room for improvement. (e.g. Bochs configuration file is here)

Additionally is it possible to run the vm inside a worker?

On a browser's web worker, right? Our example runs the container(vm) inside a web worker ( https://github.com/ktock/container2wasm/blob/d05d6977df7a0d51dbc807a893f1854db8960c75/examples/wasi-browser/htdocs/worker.js ).

Ps: loved your talk at Cloud Native very exciting work!

Thanks!

@alienself
Copy link
Author

alienself commented Jan 5, 2024

@ktock okay thanks for pointing me to the config file.
The culprit seems to be cpu: ips=40000000 which is currently set to a fixed value (of 40 MIPS) which is quite low.
Any way to get this exposed like you did with ${MEMORY_SIZE}?

On a browser's web worker, right? Our example runs the container(vm) inside a web worker
Ah perfect!

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

No branches or pull requests

3 participants