cpu limit per isolate worker #12626
Replies: 1 comment 1 reply
-
That would be quite awesome indeed. Some more resource requests (so also memory limits) and discussions I could find: #10036, #11160, #6916, #12637. Each worker is running in it's own thread as described in detail in the internals of deno book. You can see this behavior with $ ps -T -p $(pgrep deno)
PID SPID TTY TIME CMD
28184 28184 pts/1 00:00:00 deno
28184 28187 pts/1 00:00:00 V8 DefaultWorke
28184 28188 pts/1 00:00:00 V8 DefaultWorke
28184 28189 pts/1 00:00:00 V8 DefaultWorke
28184 28190 pts/1 00:00:00 worker-0 The The deno worker threads are created via Rust Implementing resource limits from scratch can be a major challenge as you need to support a variety of platforms:
In addition you'll have to implement your own separate "IPC rate-limiting", as a child process cold still send an excessive amount of data/messages back to the main deno thread. An alternative for now would be to simply put duration constrains on workers. This could be accomplished by calling I couldn't figure this out so quickly, but if you are on Linux and you can live with some half-baked solution it might be possible to look for new Not sure but https://docs.rs/cgroups/latest/cgroups/cgroup_builder/index.html might be good starting point for putting the WebWorkers into each own cgroup per worker thread. Another suggestion by one deno developer is usng the |
Beta Was this translation helpful? Give feedback.
-
Hi,
I'm executing untrusted javascript inside deno, and i have trouble
with some scripts that take cpu time.
Is there any way I can set an execution cpu time limit of some deno executed
script?
Beta Was this translation helpful? Give feedback.
All reactions