5 ms·
> the Rust Playground lets you run a hundred threads It's more that we don't do anything to prevent it, other than coarse process-wide memory / CPU time limits
by shepmaster 2y ago
> the Rust Playground lets you run a hundred threads
It's more that we don't do anything to prevent it, other than coarse process-wide memory / CPU time limits. IIRC, Rust-spawned threads on Linux use 2MiB of stack space by default, so that seems like a likely cap.
Note that the playground is only 2 cores and you are sharing with everyone else, so you aren't likely to really benefit.
- littlestymaar 2y ago> Note that the playground is only 2 cores and you are sharing with everyone else This is amazing, I use it all the time with no performance issues so I expected it to be much beefier to support many simultaneous users. How many users does it serve? (Monthly or daily user and/or compilation job sent). And what tricks are used to keep it working? (I suspect it can re-use already compiled binaries of all supported dependencies and only need to compile the user's code and link it, but is there other clever strategies?)
- shepmaster 2y ago> How many users does it serve? I don't really track users, but over the last 24 hours, there were 47.8k meaningful [1] requests taking a total of 28.2 hours. That ~0.5 requests per second number has been relatively consistent. > re-use already compiled binaries of all supported dependencies and only need to compile the user's code and link it, but is there other clever strategies? Yes, we pre-compile all the available dependencies [2] and that's about it. > I use it all the time with no performance issues That's good to hear! There's been a long-running bug where the playground binary loses track of the child Docker container (maybe?) and then the machine runs out of memory and the OOM killer often does more harm than good [3]. While trying to pin that down, I've recently caused the entire process to get into what appears to be a complete deadlock where no requests can be serviced at all. This tends to happen while I'm asleep so either I have no chance to debug it before it is auto-killed or the playground is unresponsive for 8+ hours. [1]: compiling / executing code, running clippy/miri/rustfmt, expanding macros [2]: https://github.com/rust-lang/rust-playground/blob/c4d00b90aab3742c841011b29fba038f3cd99690/compiler/base/Dockerfile#L105-L107 https://github.com/rust-lang/rust-playground/blob/c4d00b90aa... [3]: somehow it does something that ends up killing the network stack and then the machine is basically dead in the water. Very similar to what is reported in https://serverfault.com/q/1125634/119136 https://serverfault.com/q/1125634/119136
- rtpg 2y agoVery fun to see your username outside of Stack Overflow, thanks for your work on having the playground! Beyond the running costs of the machine itself, has the rust playground been any trouble, or has it mostly been smooth sailing after the initial setup?
- shepmaster 2y agoSee my sibling comment [1] for my current fun bug hunt. Overall, it's all pretty stable until I (try to) make it do new things. [1]: https://news.ycombinator.com/item?id=41931288 https://news.ycombinator.com/item?id=41931288