TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Writing Rust the Elixir Way

278 pointsby bkolobaraover 4 years ago

15 comments

toast0over 4 years ago
&gt; Now you can write regular blocking code, but the executor will take care of moving your process off the execution thread if you are waiting, so you never block a thread.<p>This is super important and awesome. It&#x27;s a big part of what makes Erlang simpler to write code for than other highly concurrent environments.
评论 #25255854 未加载
评论 #25254618 未加载
emaover 4 years ago
I&#x27;m extremely surprised that creating 2k threads makes mac os reboot. Sure that&#x27;s a lot for one application but not a totally crazy amount.
评论 #25257931 未加载
评论 #25257991 未加载
评论 #25253922 未加载
评论 #25254423 未加载
评论 #25259592 未加载
didibusover 4 years ago
Love Erlang and Elixir and Beams concurrency model is quite interesting. This Rust variant seems very interesting as well. But I wanted to discuss this part:<p>&gt; In most cases it&#x27;s enough to use a thread pool, but this approach fails once the number of concurrent tasks outgrows the number of threads in the pool<p>I think something has been lost from all the dialogue about concurrency. The only way the number of concurrent task can outgrow the number of threads is when you&#x27;re handling IO. What I see rarely discussed here is forms of non-blocking IO and why those haven&#x27;t become the norm. Why are we all trying to work around models that involve blocking on IO? I feel I almost never hear about using non-blocking IO as an alternative?<p>For all other tasks which involve computation, thread pools are needed to improve throughput and performance, only threads can be executed in parallel. Yes you can still multiplex many more small compute task over many threads, if you wanted a really responsive but overall slower program, that could be an option, but I think most people going for a concurrent approach aren&#x27;t doing so for that, but really just as a way to leverage their IO cards to the fullest.<p>So my question is, what&#x27;s wrong with having a thread pool combined with non-blocking IO ?
评论 #25257054 未加载
评论 #25256525 未加载
评论 #25260036 未加载
评论 #25260791 未加载
bkolobaraover 4 years ago
Author here! I will take some time to answer any questions.
评论 #25253976 未加载
评论 #25256265 未加载
评论 #25253617 未加载
评论 #25253735 未加载
评论 #25254102 未加载
评论 #25259276 未加载
评论 #25256715 未加载
评论 #25257169 未加载
评论 #25254217 未加载
评论 #25256343 未加载
ibraheemdevover 4 years ago
Bastion [1] is also inspired by Erlang and provides many of the features described in this post. Although it does not compile to Wasm, it provides:<p>- Message-based communication<p>- Runtime fault-tolerance - a lean mesh of actor system.<p>- A Supervision system that makes it easy to kill or restart subprocesses<p>Does anyone have experience with Bastion or other Rust actor systems?<p>1: <a href="https:&#x2F;&#x2F;bastion.rs&#x2F;" rel="nofollow">https:&#x2F;&#x2F;bastion.rs&#x2F;</a>
jowi-devover 4 years ago
So I am very fascinated by both languages and work in Elixir professionally, with a pretty minimal knowledge of Rust. I was just wondering what the motivation for creating this project was rather than just writing the application in Elixir with NIFs in Rust whenever higher performance is needed?
评论 #25254189 未加载
stepbeekover 4 years ago
Is this the perfect Hacker News title?
评论 #25260440 未加载
rapseyover 4 years ago
Wait why does calling a crashing c function not crash the process?
评论 #25254251 未加载
porkbrainover 4 years ago
The submitted link does no longer for me, here&#x27;s a link to the original article: <a href="https:&#x2F;&#x2F;dev.to&#x2F;bkolobara&#x2F;writing-rust-the-elixir-way-2lm8" rel="nofollow">https:&#x2F;&#x2F;dev.to&#x2F;bkolobara&#x2F;writing-rust-the-elixir-way-2lm8</a>
yetkinover 4 years ago
Hi, can you please explain the Wasm part? Is there any particular reason to use Wasm? I don&#x27;t know wasm but does it use a specific threading&#x2F;concurrency mechanism in it?
评论 #25257865 未加载
anonymousDanover 4 years ago
Can your runtime handle non rust wasm code?
评论 #25255935 未加载
FpUserover 4 years ago
&gt;&quot;Even though the threads don&#x27;t do anything, just running this on my MacBook forces it to reboot after a few seconds. This makes it impractical to have massive concurrency with threads.&quot;<p>That is a problem of your MacBook. I can run thousands of threads when testing some servers sustainably and with no problems on my Windows and Linux laptop, never mind desktop and real servers. So it is pretty much practical. Whether it makes sense pretty much depends on what are you doing in particular. Your conclusion means zilch without context.
评论 #25261105 未加载
评论 #25257502 未加载
ecnahc515over 4 years ago
What&#x27;s the performance like? I think this would be really interesting if comparable to something like Go.
akhilcacharyaover 4 years ago
To me, this looks <i>extremely</i> promising from a performance and developer ergonomics point of view and a fantastic use case for WASM and WASI - only limiting factor seems to be the rollout for WASI networking support.
IshKebabover 4 years ago
&gt; but I will call them processes to stay close to Elixir&#x27;s naming convention.<p>That seems like an extremely confusing mistake given that there is already a very closely related concept called a &quot;process&quot;?<p>I would consider calling them &quot;workers&quot; or &quot;isolates&quot; since unless I&#x27;m mistaken, you have basically recreated WebWorkers (AKA isolates in V8&#x2F;Dart)?<p>Presumably this also means you can&#x27;t share memory? Very neat idea anyway!