Stream: general

Topic: General question on profiling


view this post on Zulip Varun Gupta (Aug 11 2022 at 21:26):

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?

view this post on Zulip Varun Gupta (Aug 15 2022 at 22:50):

@Alex Crichton Can you please help?

view this post on Zulip Alex Crichton (Aug 16 2022 at 14:17):

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

view this post on Zulip Khelifa Saif eddine (Apr 03 2023 at 12:49):

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 ?

view this post on Zulip Jamey Sharp (Apr 03 2023 at 17:08):

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.

view this post on Zulip Khelifa Saif eddine (Apr 03 2023 at 20:26):

Okay thanks even this command doesnt work $ perf record -k mono wasmtime --profile=jitdump foo.wasm
any idea why ?

view this post on Zulip Jamey Sharp (Apr 03 2023 at 20:32):

Without any information beyond "it doesn't work" I can't even begin to guess. :laughing: What error message are you getting?

view this post on Zulip Khelifa Saif eddine (Apr 11 2023 at 20:32):

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

view this post on Zulip Chris Fallin (Apr 11 2023 at 20:37):

@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

view this post on Zulip Chris Fallin (Apr 11 2023 at 20:37):

(if something isn't released yet you can try one of the recent snapshot builds from https://github.com/bytecodealliance/wasmtime/releases)

A fast and secure runtime for WebAssembly. Contribute to bytecodealliance/wasmtime development by creating an account on GitHub.

view this post on Zulip Khelifa Saif eddine (Apr 11 2023 at 20:46):

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

view this post on Zulip Chris Fallin (Apr 11 2023 at 20:51):

Ah, a PR to fix the docs would be welcome!

view this post on Zulip Jamey Sharp (Apr 11 2023 at 21:29):

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: Nov 22 2024 at 16:03 UTC