Cellane

Cellane

Been asked to do a presentation about Elixir - what should I include?

I’ve been asked by my supervisors at work to finally give everyone in the team presentation about “that Elixir thing you can’t seem to shut up about” (:rofl:) so I’m busy preparing slides that would hopefully present a good pitch as to why FP and Elixir is a good idea. I’d be happy to hear about past talks and presentations from other people that I could use as inspiration!

Most Liked

dimitarvp

dimitarvp

Make VERY SURE to outline the runtime’s benefits:

  • Preemptive scheduling (what 99% of the runtimes out there don’t have)
  • OTP’s let it crash and get restored way of work
  • Supervisors!
  • Extremely easy to achieve parallelism and concurrency

Most people just fangirl at the language and a lot of other people are very rightfully not impressed. This decision is only 5-10% about the languages (say because of meta-programming / macros and good libraries). 90-95% of the benefit is the runtime so do your very best to highlight that!

dimitarvp

dimitarvp

Preemptive scheduling

Not one single OTP Process (what in other programming languages are called actors, green threads, fibers) can affect the latency of the others. The average execution time of any given function should remain mostly the same even under heavy load – a huge selling point IMO. That’s why Phoenix apps on $5 worth of servers can handle 2000+ requests a second (while a Ruby on Rails or Laravel vanilla app can be brought to its knees by 100-200 requests a second).

Parallelism / concurrency

Consider this:

def send_email_batch(list_of_emails) do
  # This will receive no more than 100 email addresses
  YourMailSender.send_batch_message(list_of_emails)
end

list_of_emails # Supposedly a very big list
|> Stream.chunk(100)
|> Task.async_stream(&send_email_batch/1, timeout: :infinity, max_concurrency: 20)
|> Stream.run()

:point_up: This will get a big list of emails, break the list into smaller lists of 100 emails each and send each chunk (batch) in parallel, but it never sends more than 20 batches at the same time (the :max_concurrency option of Task.async_stream), e.g. at any given time maximum of 2000 emails are being sent (if we assume this is your email sending provider’s API rate limit and that you want to comply with it).

This extremely transparent parallelism / concurrency is what brought me to Elixir.

AstonJ

AstonJ

Some great thoughts by Dimi and you might also find what Robert wrote in the Erlang Rationale worth a look :smiley:

These EF threads might also contain something of use?

:nerd_face:

Good luck and let us know how you get on :+1:

Popular Backend topics Top

New
New
New
New
AstonJ
Consider this Erlang code: Rectangle = {rectangle, 20, 10}. {rectangle, Width, Height} = Rectangle. > Width. 20 > Height. 10 When...
New
First poster: bot
What's so exciting about Postgres? with Craig Kerstiens (The Changelog #417). PostgreSQL aficionado Craig Kerstiens joins Jerod to talk ...
New
AstonJ
Inspired by this post by @stefan.jarina, I’m curious about the kind of Bash scripts you’ve written and whether you still use Bash given t...
New
First poster: bot
https://twitter.com/briandfoy_perl/status/1354535622069919748 This thread was posted by one of our members via one of our news source tr...
New
AstonJ
In case anyone else is wondering why Ruby 3 doesn’t show when you do asdf list-all ruby :man_facepalming: do this first: asdf plugin-upd...
New
almokhtar
Howdy, folks i have this question about it is ok to learn two different programming languages same time, well my story is i joined a comp...
New

Other popular topics Top

PragmaticBookshelf
Design and develop sophisticated 2D games that are as much fun to make as they are to play. From particle effects and pathfinding to soci...
New
AstonJ
poll poll Be sure to check out @Dusty’s article posted here: An Introduction to Alternative Keyboard Layouts It’s one of the best write-...
New
Exadra37
On modern versions of macOS, you simply can’t power on your computer, launch a text editor or eBook reader, and write or read, without a ...
New
Margaret
Hello everyone! This thread is to tell you about what authors from The Pragmatic Bookshelf are writing on Medium.
1134 25375 751
New
wmnnd
Here’s the story how one of the world’s first production deployments of LiveView came to be - and how trying to improve it almost caused ...
New
mafinar
This is going to be a long an frequently posted thread. While talking to a friend of mine who has taken data structure and algorithm cou...
New
AstonJ
We’ve talked about his book briefly here but it is quickly becoming obsolete - so he’s decided to create a series of 7 podcasts, the firs...
New
PragmaticBookshelf
Author Spotlight Mike Riley @mriley This month, we turn the spotlight on Mike Riley, author of Portable Python Projects. Mike’s book ...
New
First poster: bot
zig/http.zig at 7cf2cbb33ef34c1d211135f56d30fe23b6cacd42 · ziglang/zig. General-purpose programming language and toolchain for maintaini...
New
PragmaticBookshelf
A Ruby-Centric Chat with Noel Rappin @noelrappin Once you start noodling around with Ruby you quickly figure out, as Noel Rappi...
New