Stream: wasmtime

Topic: ✔ Epoch Asyn Yield


view this post on Zulip Ashanti Mutinta (May 26 2024 at 18:55):

I have an epoch yielding of about 20ms. When I measure the time between each poll call should I expect to see about 20ms as well? I have another thread incrementing epochs and I'm on wasmtime 17.0.2

view this post on Zulip Alex Crichton (May 26 2024 at 19:26):

For cpu bound work that should show up yeah. If the work is otherwise yielding though (eg for io) then the time-per-poll may be shorter

view this post on Zulip Ashanti Mutinta (May 26 2024 at 19:28):

I see it might be something in my code. Have a weird issue where the time elapsed on the poll is 0 most of the time until the last poll which yields the whole thing

view this post on Zulip Alex Crichton (May 26 2024 at 19:37):

Did you call Store::epoch_deadline_async_yield_and_update?

view this post on Zulip Ashanti Mutinta (May 26 2024 at 19:45):

Yes I did right before I called the method. Is that the right way to do it?

view this post on Zulip Alex Crichton (May 26 2024 at 20:04):

It should be ok to call that only once on store creation, no need to call it once per poll

view this post on Zulip Ashanti Mutinta (May 26 2024 at 20:10):

Okay will try and look at this again. Thank you!

view this post on Zulip Ashanti Mutinta (May 26 2024 at 20:22):

Last question(hopefully) do I need to set deadline as well when I'm using epoch_deadline_async_yield? E.g deadline of 20ms with epoch_deadline_async_yield means after 20ms it will give back control to the async runtime?

view this post on Zulip Alex Crichton (May 26 2024 at 20:48):

This may have changed between 17 and 21 so I sort of forget, we had some weird interactions historically possible which is why there was a refactor. I believe all you need to do is configure yielding though

view this post on Zulip Ashanti Mutinta (May 27 2024 at 17:24):

Are there any examples for epoch_deadline_async_yield_and_update? I think I have it right but the numbers still look inconsistent

view this post on Zulip Ashanti Mutinta (May 28 2024 at 10:27):

I think I figured it out. I was using tokio spawn with a very short interval tick and I don't think it liked the context switch much

view this post on Zulip Notification Bot (May 28 2024 at 14:31):

Levent kaya has marked this topic as resolved.


Last updated: Nov 22 2024 at 17:03 UTC