Rustixir
Hi everyone, im working on find best language/framework/system for
high concurrency, high performance and stable performance
after working 3 years in Erlang/Beam i decision to find better than erlang because
I read many where said: Erlang/Beam is slow !!
then I started to learn and working many real-world project with Rust,
then i find ( Tokio )
(from Tokio website: )
Tokio is an asynchronous runtime for the Rust programming language. It provides the building blocks needed for writing network applications. It gives the flexibility to target a wide range of systems, from large servers with dozens of cores to small embedded devices.
after working with it i thought its great because doing message passing with backpressure in channel like golang style
after writing a distributed realtime database in rust ,
I see a unstable performance even with ( heavy optimized ) was not great
I stopped it and done many research about more optimizing and then
writing a very low cost message broker with persistent for our back-end but again i saw unstable performance
then I switch to Elixir because (I heard about JIT) and from before I have experienced with it for a real-world project
I started prototyping 2 scenario message passing,
differenece was huge .
Beam was Winner in both Scenario: ( seq/concurrent client request to server)
- ==> Request call 1000
- ==> Request call 1000000
Scenario 1 Result ( Rust/Tokio : 65,798 ns __ Elixir: 15,385 ns )
Scenario 2 Result ( Rust/Tokio : 4,256,639 ns ___ Elixir: 299,920 ns )
and the end
after many research about distributed real-time database
after compare many case , find
Mnesia is best ever made Distributed real-time database and many developer
if elixir developers be smart, using it in near future for all OLTP real-time application
now our using Mnesia for read-heavy application
under heavy load,
its have many many great features we not found in other db
it is really complete
Trending in Discussions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
dimitarvp
I really like to believe that. But do you have repo(s) that demonstrate the difference? I would love to take a look!
I know Erlang has been getting pretty fast lately but I have my doubts; I’ve been going back to writing a Rust<->Elixir bridge again and in release mode plain async code (without orchestration except just proper yield points) executes in like 50 nanoseconds. But that obviously depends on what you call – I am talking about very plain Rust code in this case.
So, can you show us something more?
cmkarlsson
Here is a message passing thread from the erlang forum. Don’t know if it is related but at least in the ring benchmark rust comes out quite a bit faster.
Rustixir
Ok sure, tomorrow morning make a repo ,
Actually for Rust side of this test
I used a wrapper around tokio::sync:mpsc and tokio::sync::oneshot for response
this wrapper very simple
That is exist in my github
https://github.com/Rustixir/mpsc_req
And I dont know but after done some benchmark
Myself and i saw even from some developer,
Rust Tonic ( gRPC ) a grpc framework around tokio , is slow !!!
compare with golang,
golang was faster than Rust
I said that for not strange !!!
In some benchmark rust-tokio performance
Is not stable
Rustixir
Thanks, i saw code of rust , in that use a channel for sending not await for response
Here we speaking about
Client / Server ( request / response )
cmkarlsson
I know not much about rust, I just saw a similar conversation on the erlang forum recently and thought it might add something to the conversation.
The initial rust benchmark does not wait for response, which makes the comparison not valid, however that code is corrected in subsequent posts and new results are posted.
The erlang thread is just about message passing. In other context the performance may of course differ.
Rustixir
Thanks again, for giving me a vision of more about the next benchmark.
I will write better benchmark tomorrow
Tomorrow morning everything will be clear
Rustixir
Hi Everyone.
I prototype another scenario
in that i not used any wrapper over rust + tokio !!
just used internal features
scenario 1.
in this scenario i used message passing and a calculate operation
first spawn some worker ( number == my cpu core)
then sending request to each worker and await for result of each worker and it do simple sum over N counter and then response Result::Ok in rust in elixir :ok
Rust Client
Rust Server
Elixir Server
Elixir Client
above i said N sum operation N is iteration in below
Result is Amazing :
Scenario over 1,000 iteration
Rust+Tokio : 144,792 microseconds
Elixir/Beam : 23,393 microseconds
Scenario over 10,000 iteration
Rust+Tokio : 5,503,831 microseconds
Elixir/Beam : 812,285 microseconds
even with arithmetic operation beam was winner
Rustixir
What do you think ?
Rustixir
Yet another benchmark
to prove to myself and anyone because this is a very strange topic
but it is REAL
Scenario
in benchmark, spawn 3 very simple worker and those
generate (key, value) and
( send to channel in rust ),
( send to a mailbox in elixir )
then a task/process store those to (Hashmap in rust) (ETS in Elixir)
Again Beam Winner
i think this was a dream for joe armstrong but come to true …
Rust
Elixir
**Result was Amazing **
Scenario over 100 Iteration:
Rust + Tokio : 837ns ~ 1,300ns
Elixir/Beam : 270ns ~ 1,100ns
Scenario over 1,000 Iteration:
Rust + Tokio : 9,769ns ~ 14,300
Elixir/Beam : 2,202ns ~ 11,200
but this is not really real usage because in real world
for storing we almost always need read-heavy or write heavy
if take benchmark for it
i PROMISE beam is winner because it and (ETS) are very full features
Rustixir
Im so sorry because benchmark in Rust was in ( compiler optimization level-1) after change to 3 , Rust 2x times faster in above scenario
Rust for raw performance is faster
but when involved message passing
Beam really is Beast