Open deeprobin opened 8 months ago
Can you provide some more details into what kind of throttling are you looking for?
@bartlomieju
Can you provide some more details into what kind of throttling are you looking for?
Basically, the point is that I have an agent-like structure in certain use cases.
I then start a .js/.ts entrypoint using deno_core.
To better distribute the load or prioritise other tasks, I would like to manually throttle the execution of the JavaScript/TypeScript code and let the CPU focus more on something else.
In my opinion, it is easier to limit the memory usage. But CPU utilisation is the crux of the matter.
Do you have any ideas?
This might be related to https://github.com/denoland/deno/issues/13654 TLDR: v8 does not offer an API for setting CPU quotas per isolate. You might need to rely on system specific APIs to do this.
@deeprobin the solution for you is to use JsRuntime::poll_event_loop
instead of JsRuntime::run_event_loop
and schedule these polls when you have available CPU budget.
Hey,
in my rust infra I currently schedule some Deno-"tasks". Is there a way to manually throttle the Deno execution without using OS APIs?