Our usecase is that we create a web server (long-running worker) which creates an engine once and then uses tokio library to run incoming serverless tasks as modules in the same engine. Worker is a process, and we use wasmtime embedding API for creating one engine which is used to run all modules. We have few alternatives:
1) We add a support for profiling individual modules in a engine within wasmtime.
2) Create two engines in one worker and use second engine for profiling purpose.
3) We can create a dedicate pool of workers for profiling and gateway will intercept request with profiling and submit to those dedicated workers.
I wanted to get feedback which alternative is better? Secondly, even if we go with option 2 or 3, jitdump works on a process level so within an engine if we profile all modules, only one jitdump file will be created, so how should we workaround this to get separate jitdump file for each module?
@Alex Crichton Can you please help?
Sorry I don't have much in the way of advice here. Your alternatives all sound reasonable to me and it seems like it would be up to you as to which you'd like to implement. The first option would require changes within Wasmtime but the other options should be implementable with the current embedding API
i have a question on wasmtime profiling this command doesn't seem to work :
$ perf record -k mono wasmtime --profile=perfmap foo.wasm
However if i delete " --profile = perfmap" it will work
can any one help ?
Wasmtime's perfmap support is not yet available in a stable release. You can use the jitdump
mode instead, or build Wasmtime from git. I think it will be in the 9.0.0 stable release, which should come out around May 20th, if I understand the release schedule correctly.
Okay thanks even this command doesnt work $ perf record -k mono wasmtime --profile=jitdump foo.wasm
any idea why ?
Without any information beyond "it doesn't work" I can't even begin to guess. :laughing: What error message are you getting?
Jamey Sharp said:
Without any information beyond "it doesn't work" I can't even begin to guess. :laughing: What error message are you getting?
sorry for late response i tried a lot of things but nothing seems to work this is the error :
Error: Found argument '--profile' which wasn't expected, or isn't valid in this context
If you tried to supply `--profile` as a value rather than a flag, use `-- --profile`
for this command : perf record -k mono wasmtime --profile=jitdump fib.wasm
@Khelifa Saif eddine can you tell us what version of wasmtime you're using (wasmtime --version
)? @Jamey Sharp 's comment above about release version is I suspect the problem
(if something isn't released yet you can try one of the recent snapshot builds from https://github.com/bytecodealliance/wasmtime/releases)
i found the solution : i think there was a mistake in the documentation you should do :
perf record -k mono wasmtime --jitdump fib.wasm
instead of :
perf record -k mono wasmtime --profile=jitdump fib.wasm
please pin this so anyone can avoid misunderstanding in the docs
thanks in advance
Ah, a PR to fix the docs would be welcome!
This is a recent change. The documentation reflects what's on main
, while the --profile
option was introduced after the last release. We should probably make multiple documentation versions available, and in the future we would ideally keep CLI option compatibility for at least a version or two.
Last updated: Dec 23 2024 at 12:05 UTC