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

AstonJ
Which server-side languages are you most interested in right now? Anything new or relatively new that’s caught your eye? Maybe an older l...
New
New
New
New
pillaiindu
I have heard many times that languages with a garbage collector aren’t great for system programming. Today I saw a book titled “Hands-On ...
New
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
mafinar
I wrote a blog post! On F#. I usually don’t write things but figured i should try it out, also experimenting with F# and C# lately, love ...
New
mafinar
Hello folks! We had a pretty fun thread here around the same time last year - talking about Advent of Code problems. That also happened t...
New
pillaiindu
Cross posting from Elixir Forum. Build it with Phoenix is a nice course by Geoffrey Lessel @geo. But if you start with Phoenix 1.7.2 or ...
New

Other popular topics Top

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
AstonJ
I have seen the keycaps I want - they are due for a group-buy this week but won’t be delivered until October next year!!! :rofl: The Ser...
New
PragmaticBookshelf
“A Mystical Experience” Hero’s Journey with Paolo Perrotta @nusco Ever wonder how authoring books compares to writing articles?...
New
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
PragmaticBookshelf
Author Spotlight James Stanier @jstanier James Stanier, author of Effective Remote Work , discusses how to rethink the office as we e...
New
New
husaindevelop
Inside our android webview app, we are trying to paste the copied content from another app eg (notes) using navigator.clipboard.readtext ...
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
OSZAR »