Latest / CyberSecurity Summary / Elixir in Action
Transcript
- 0:00Speaker 1: So imagine trying to change the tires on a car
- 0:03Speaker 1: while you're driving down the highway at like seventy miles
- 0:07Speaker 1: an hour.
- 0:07Speaker 2: Right, which sounds completely terrifying.
- 0:09Speaker 1: Yeah, exactly, But I mean that is literally what software
- 0:13Speaker 1: engineers are expected to do every single.
- 0:15Speaker 2: Day, oh for sure. Because when you open an app,
- 0:18Speaker 2: you know, like WhatsApp, you just expected to work instantly.
- 0:21Speaker 1: Yeah, even if developers are like deploying these massive software
- 0:25Speaker 1: updates to the system right there in the background.
- 0:27Speaker 2: You don't even notice it.
- 0:29Speaker 1: Right, So today's deep dive is exploring the hidden engine
- 0:32Speaker 1: behind that modern miracle of well always on reliability. We're
- 0:37Speaker 1: going to be unpacking excerpts from a really fascinating book
- 0:40Speaker 1: called Elixir in Action by Sasha Jurich, published by Manning.
- 0:44Speaker 2: Yeah, and before we really delve into the whole technical
- 0:46Speaker 2: architecture side of things, the physical book itself has a
- 0:50Speaker 2: couple of charming details I think you're worth.
- 0:53Speaker 1: Noting, Oh, right, like the dedication exactly.
- 0:56Speaker 2: The author dedicates the work to his wife, Arnada, which
- 0:59Speaker 2: is sweet. But the publisher also chose a very specific
- 1:02Speaker 2: piece of cover art.
- 1:03Speaker 1: Right. It's an illustration, isn't it.
- 1:04Speaker 2: Yeah, it's called a Russian Girl from Thomas Jeffrey's eighteenth
- 1:07Speaker 2: Century Trust Collection and Back of the seventeen hundreds. Those
- 1:11Speaker 2: illustrations highlighted the incredible diversity of global cultures. Oh wow,
- 1:16Speaker 2: so here the publisher is kind of using it as
- 1:18Speaker 2: a nod to the vast interconnected ecosystem of computer systems
- 1:23Speaker 2: we're about to explore.
- 1:24Speaker 1: I love that, and I mean to really understand that ecosystem,
- 1:27Speaker 1: we kind of need to look at the author's own
- 1:29Speaker 1: breaking point. Right.
- 1:30Speaker 2: Yeah, let's set the scene.
- 1:32Speaker 1: So the year is twenty ten. Jurich is tasked with
- 1:35Speaker 1: building a near real time push server. And this isn't
- 1:38Speaker 1: like a small weekend project. It needs to handle thousands
- 1:41Speaker 1: of connected users simultaneously without dropping a single connection.
- 1:45Speaker 2: Which is a huge technical challenge totally.
- 1:47Speaker 1: His company was primarily using Rubyon Rails, which is a
- 1:50Speaker 1: very popular web framework. But as he's staring down this
- 1:54Speaker 1: incoming wall of concurrent traffic, his CTO suggests he look
- 1:58Speaker 1: into a language called erlang.
- 2:00Speaker 2: And I mean Erling wasn't exactly the first tool a
- 2:03Speaker 2: web developer reached for back in twenty ten, No, not
- 2:06Speaker 2: at all. But Yurch builds this prototype. He runs the
- 2:08Speaker 2: load tests, and the performance in the stability were just
- 2:11Speaker 2: so absolute that he ended up rebuilding the entire system in.
- 2:16Speaker 1: It wow, just scrap the old one pretty much.
- 2:18Speaker 2: He even started a blog called the Erlangelist just to
- 2:22Speaker 2: help other object oriented programmers wrap their heads around this
- 2:26Speaker 2: strange yet really powerful tool.
- 2:28Speaker 1: Right, and to see why Erling was such a revelation
- 2:31Speaker 1: for him, we actually have to travel way back to
- 2:33Speaker 1: the mid nineteen eighties.
- 2:34Speaker 2: Yeah, time travel.
- 2:36Speaker 1: Erline was created by a team at Ericsson led by
- 2:38Speaker 1: the legendary software engineer Joe Armstrong, and Ericson is a
- 2:43Speaker 1: Swedish telecom giant. They built Erlang specifically to run their
- 2:48Speaker 1: massive telephone network switches.
- 2:50Speaker 2: Right, And you might be sitting there wondering, well, why
- 2:52Speaker 2: should you care about a programming language built for nineteen
- 2:55Speaker 2: eighties landline phones?
- 2:56Speaker 1: Right, Yeah, sounds pretty obsolete.
- 2:58Speaker 2: But it comes down to the fund mental requirement of telecom,
- 3:01Speaker 2: which is zero downtime. Ah right, Because in the eighties
- 3:05Speaker 2: and nineties, if consumer desktop software crashed, I mean it
- 3:08Speaker 2: was annoying, but it only affected one person.
- 3:10Speaker 1: Just reboot your computer in your front exactly.
- 3:13Speaker 2: A telecom network, however, had to be highly available fault
- 3:17Speaker 2: tolerant and scalable without ever turning the machine off.
- 3:20Speaker 1: Because you couldn't drop thousands of active phone calls just
- 3:23Speaker 1: because a hardware component failed, or like an engineer uploaded new.
- 3:27Speaker 2: Code exactly and fast forward to today, Suddenly everything you
- 3:31Speaker 2: use has those exact same telecom level requirements.
- 3:35Speaker 1: Cloud deployment platforms, massive multiplayer online games, social networks, all
- 3:41Speaker 1: of it. Yeah, these are the modern equivalent of the
- 3:43Speaker 1: global telephone grid. I mean, consider that when WhatsApp was acquired,
- 3:48Speaker 1: they had hundreds of millions of users, but only about
- 3:51Speaker 1: fifty engineers keeping the entire system.
- 3:53Speaker 2: Running, which is mind blowing, right.
- 3:55Speaker 1: And they achieved that impossible leverage because their system was
- 3:57Speaker 1: built on the core DNA of.
- 3:59Speaker 2: Erlink and that survival mechanism. It really comes down to
- 4:02Speaker 2: Erlang's completely unique take on concurrency.
- 4:06Speaker 1: Basically how computer juggles multiple tasks at once.
- 4:09Speaker 2: Right there, because it doesn't rely on the heavyweight spreads
- 4:11Speaker 2: and processes provided by your computer's operating system like Mac
- 4:15Speaker 2: or Windows or Linux. Instead, it runs inside its own
- 4:18Speaker 2: isolated virtual machine called the beam.
- 4:21Speaker 1: Right, the beam that stands for a Bogden or Bjorn's
- 4:25Speaker 1: erlaying abstract machine named after its creators obviously naturally, and
- 4:29Speaker 1: instead of relying on the operating system, the beam just
- 4:32Speaker 1: reinvents concurrency using its own incredibly lightweight processes. We aren't
- 4:38Speaker 1: talking about a server handling a few hundred tasks here, no,
- 4:41Speaker 1: not at all. A single Beam system can comfortably run
- 4:45Speaker 1: thousands or even millions of these tiny processes at the
- 4:48Speaker 1: exact same time.
- 4:49Speaker 2: Yeah, and the book describes this as a shared nothing
- 4:53Speaker 2: architecture because in traditional operating system threads, concurrent programming is
- 4:58Speaker 2: incredibly difficult since process is share the same memory space.
- 5:01Speaker 1: Okay, so let's picture traditional shared state concurrency as like
- 5:05Speaker 1: a chaotic group project in a single conference room.
- 5:09Speaker 2: I've been in a few of those, right.
- 5:10Speaker 1: Everyone is fighting over the same single whiteboard to write
- 5:13Speaker 1: down their ideas. That whiteboard is the shared.
- 5:15Speaker 2: Memory, right, which creates constant bottlenecks because people are awaiting their.
- 5:18Speaker 1: Turn exactly, and to keep them from talking over each other,
- 5:22Speaker 1: developers have to write these complex locking mechanisms into the code.
- 5:26Speaker 2: Oh and if someone accidentally knocks a whiteboard over.
- 5:28Speaker 1: The entire project crashes. Everyone goes down, Yeah, which is
- 5:31Speaker 1: a nightmare.
- 5:32Speaker 2: But the Erlang process is on the Beam. They operate
- 5:35Speaker 2: in a completely different reality. Ow So instead of one
- 5:38Speaker 2: chaotic conference room, imagine you have a million remote workers. Okay,
- 5:43Speaker 2: every single worker is sitting in their own, locked, isolated
- 5:47Speaker 2: room with their own private whiteboard. They share absolutely nothing
- 5:52Speaker 2: with each other.
- 5:52Speaker 1: So how do they even talk?
- 5:54Speaker 2: Well, if they need to coordinate, the only way they
- 5:57Speaker 2: can communicate is by sliding little notes under the door,
- 6:01Speaker 2: which Erlane calls asynchronous messages.
- 6:03Speaker 1: Okay, that makes sense. And because they share no memory,
- 6:06Speaker 1: the first massive benefit of that is fault tolerance.
- 6:09Speaker 2: Absolutely.
- 6:10Speaker 1: If one worker in their isolated room rates bad code
- 6:12Speaker 1: and suddenly bursts into flames, which you know is a
- 6:16Speaker 1: software crash, doesn't affect anyone else, Right, The.
- 6:18Speaker 2: Fire cannot spread to the shared whiteboard because there is
- 6:20Speaker 2: no shared whiteboard.
- 6:21Speaker 1: Yeah, the system just sweeps out the ashes, places a
- 6:24Speaker 1: brand new worker in the room, and the rest of
- 6:26Speaker 1: the system literally doesn't even blink.
- 6:28Speaker 2: And that isolation also solves the problem of resource hawking.
- 6:32Speaker 1: Oh that's a big one, right.
- 6:33Speaker 2: Because you might ask, well, what happens if a worker
- 6:35Speaker 2: doesn't crash but just get stuck trying to solve some
- 6:39Speaker 2: massively heavy mathematical equation.
- 6:41Speaker 1: Yeah, does the rest of the system freeze up waiting
- 6:43Speaker 1: for them to finish. Well.
- 6:45Speaker 2: In standard systems, yeah, a heavy task can easily choke
- 6:49Speaker 2: the central processor, yeah, and cause the whole app to
- 6:52Speaker 2: become unresponsive for everyone else.
- 6:53Speaker 1: But the beam has a preemptive scheduler, right, which acts
- 6:58Speaker 1: like a highly strict manager walking the halls.
- 7:02Speaker 2: Yeah, and the way this manager works is actually fascinating.
- 7:04Speaker 2: Doesn't track time on a clock, yeah you know, it
- 7:08Speaker 2: tracks reduction reduction, right, which is essentially counting the number
- 7:11Speaker 2: of function calls a worker makes. Once a worker hits
- 7:13Speaker 2: a specific limit, say two thousand function calls the walk,
- 7:17Speaker 2: the manager forces them to pause, saves their exact state,
- 7:21Speaker 2: and moves on to the next worker.
- 7:23Speaker 1: Oh wow, So by counting operations rather than milliseconds, the
- 7:26Speaker 1: scheduler ensures total fairness exactly. Even if a worker is
- 7:30Speaker 1: doing the heaviest database crunching imaginable, they are forcibly paused
- 7:35Speaker 1: when their turn is up. The manager just keeps the
- 7:37Speaker 1: line moving.
- 7:38Speaker 2: Yeah, meaning your simple web request never gets stuck behind
- 7:41Speaker 2: someone else's massive data download. The system just remains remarkably
- 7:45Speaker 2: responsive under intense pressure.
- 7:47Speaker 1: And because these isolated workers aren't sharing that central whiteboard,
- 7:50Speaker 1: it solves another massive headache for developers, which is cleaning
- 7:54Speaker 1: up memory.
- 7:55Speaker 2: Oh yeah, garbage collection.
- 7:56Speaker 1: Right. In standard systems, when the computer needs to sweep
- 7:59Speaker 1: up unused data, it often has to pause the entire
- 8:02Speaker 1: system to safely clear the shared.
- 8:03Speaker 2: Memory, and for you, the user, that looks like a
- 8:06Speaker 2: frozen screen or you know that infinite buffering wheel the worse.
- 8:10Speaker 1: But in Erlang, garbage collection happens individually per process. One
- 8:14Speaker 1: remote worker just takes out their own tiny trash can
- 8:16Speaker 1: in their own isolated.
- 8:18Speaker 2: Room, while the other nine hundred and ninety nine thousand
- 8:20Speaker 2: workers just keep typing away.
- 8:22Speaker 1: Right. There are never any massive system wide pauses that
- 8:26Speaker 1: degrade the user experience, and.
- 8:28Speaker 2: This total isolation fundamentally changes how developers build entire server architectures.
- 8:35Speaker 2: How So, the book actually gives a real life comparison
- 8:38Speaker 2: of two web servers to highlight this. So server A
- 8:43Speaker 2: represents a standard modern setup. It's a patchwork quilt of
- 8:46Speaker 2: different specialized technologies.
- 8:48Speaker 1: So you might have one piece of software answering the
- 8:51Speaker 1: web praffic, a completely different language processing the business logic.
- 8:55Speaker 2: Right, and an external memory database holding onto users shopping carts,
- 8:59Speaker 2: plus a separate scheduling tool running background jobs at midnight.
- 9:02Speaker 1: Wow. Yeah, the author affectionately calls this the server side zoo.
- 9:06Speaker 2: Exactly. You have all these different animals, all these independent
- 9:09Speaker 2: moving parts loosely tied together with network cables to build
- 9:12Speaker 2: one application.
- 9:13Speaker 1: And if any one of those independent pieces fails or
- 9:16Speaker 1: loses connection, the whole house of cards basically it comes down.
- 9:20Speaker 2: Yeah, it's fragile, but sir B, on the other hand,
- 9:22Speaker 2: handles the web traffic, the business logic, the temporary user states,
- 9:26Speaker 2: and the background jobs using only early just one language. Yeah.
- 9:31Speaker 2: It relies on a battle tested framework build directly into
- 9:34Speaker 2: the language called OTP or Open Telecom Platform.
- 9:38Speaker 1: Okay, I've heard of that.
- 9:39Speaker 2: Yeah. OTP provides standardized templates like something called a gen server,
- 9:43Speaker 2: which stands for Generic Server. A gen server handles all
- 9:46Speaker 2: the complex logic of how processes should communicate, how they
- 9:49Speaker 2: should store data safely, and exactly how they should be restarted.
- 9:53Speaker 1: If they crash, and the developer doesn't have to reinvent
- 9:56Speaker 1: the wheel every time.
- 9:57Speaker 2: Right. It allows you to build a highly available, cohibited
- 10:00Speaker 2: system entirely inside a single technology stack running on a
- 10:04Speaker 2: single machine.
- 10:05Speaker 1: Okay, let me push back on this monolith approach, though, sure,
- 10:07Speaker 1: because as someone who builds systems, relying on a jack
- 10:10Speaker 1: of all trades tool for everything usually ends in disaster.
- 10:13Speaker 2: I get that.
- 10:14Speaker 1: I mean a Swiss army knife is great for a
- 10:16Speaker 1: camping trip, but you wouldn't use the tiny sawblade to
- 10:19Speaker 1: build house, right. Shouldn't developers use specialized external tools for
- 10:23Speaker 1: things like caching or background processing because those tools have
- 10:26Speaker 1: spent years perfecting that one specific job.
- 10:30Speaker 2: Is a very valid criticism, honestly, But the key distinction
- 10:33Speaker 2: here is that erlank isn't forcing you into a closed box.
- 10:37Speaker 1: Oh it's not.
- 10:38Speaker 2: No, It's completely capable of talking to external databases or
- 10:41Speaker 2: message cues when you need them. If you require raw
- 10:45Speaker 2: speed for a highly specific task like heavy image processing,
- 10:49Speaker 2: erlang allows you to run fast c code natively alongside it.
- 10:53Speaker 1: Okay. Interesting.
- 10:54Speaker 2: What erling provides is the option of a homogeneous system
- 10:56Speaker 2: from day one.
- 10:57Speaker 1: So you aren't forced to manage the whole zoo when
- 11:00Speaker 1: you're just starting.
- 11:00Speaker 2: Out precisely, I mean, in the early days of a
- 11:03Speaker 2: startup or for small engineering teams, Deploying and maintaining five
- 11:07Speaker 2: different databases and languages across multiple servers is an operational light.
- 11:12Speaker 1: It just too much overhead.
- 11:13Speaker 2: Exactly, Erling lets a tiny team build a massive, robust
- 11:17Speaker 2: system out of the box. You only bolt on those
- 11:20Speaker 2: specialized external tools when you truly hit the limits of
- 11:23Speaker 2: what the bean can do, which takes a very, very
- 11:26Speaker 2: long time.
- 11:27Speaker 1: Well, if erlang is this indestructible supertool, it raises an
- 11:30Speaker 1: obvious question. I think, why did anyone feel the need
- 11:33Speaker 1: to invent alixer. I mean, why isn't every developer on
- 11:36Speaker 1: Earth just writing raw arline code right now?
- 11:39Speaker 2: Well, the answer comes down to the simple act of
- 11:41Speaker 2: typing it out. Yeah. Erling was designed in the nineteen eighties,
- 11:45Speaker 2: and its syntax really reflects that era. It is notoriously dense,
- 11:49Speaker 2: highly repetitive, and frankly kind of jarring to modern programmers.
- 11:53Speaker 1: Right. It's the classic critique of the language. It makes
- 11:56Speaker 1: the hardest problems in computer science, like distributed concurrency fault
- 12:00Speaker 1: tolerance look incredibly easy, but it makes simple things like
- 12:04Speaker 1: defining a basic module or adding numbers together bizarrely hard
- 12:08Speaker 1: and verbose.
- 12:09Speaker 2: Yeah. But then the author discovered Elixer around its zero
- 12:13Speaker 2: point eight release.
- 12:14Speaker 1: Right. Elixer was created by a developer named Jose Valim.
- 12:17Speaker 2: And Jurige realized immediately that Elixir was the perfect bridge,
- 12:21Speaker 2: because the magic of Elixir is that it compiles down
- 12:23Speaker 2: to the exact same beam bytecode as Erlang.
- 12:26Speaker 1: Oh wow, so you don't lose a single drop of
- 12:29Speaker 1: Erlang's performance or its twenty four to seven reliability.
- 12:32Speaker 2: Nope, you are still driving the exact same, indestructible nineteen
- 12:36Speaker 2: eighties telecom engine. Elixer just replaces the rusty dashboard with
- 12:42Speaker 2: the sleek, modern, developer friendly interface.
- 12:45Speaker 1: And it aggressively fixes Erlang's boilerplate problem. The book highlights
- 12:50Speaker 1: a really specific.
- 12:51Speaker 2: Example, right the addition one.
- 12:52Speaker 1: Yeah, so you want to write a tiny server process
- 12:55Speaker 1: in Erlang, whose only job is to add two numbers together.
- 12:58Speaker 1: Doing this requires typing out a massive, noisy block of
- 13:01Speaker 1: boilerplate code just to set up the process is so tedious. Yeah,
- 13:05Speaker 1: The structure is so tedious that veteran programmers don't even
- 13:08Speaker 1: type it out. They literally copy and paste it from
- 13:10Speaker 1: older projects just to get to the one line of
- 13:12Speaker 1: code that actually does the math, which.
- 13:14Speaker 2: Creates totally unnecessary cognitive load for the developer. But Elixer
- 13:19Speaker 2: shrinks this dramatically.
- 13:20Speaker 1: Yeah. The author actually built a custom Elixer library called exactor.
- 13:24Speaker 1: To prove this exact point, he took that massive, ugly
- 13:27Speaker 1: block of Erling boilerplate and used Elixer to trink it
- 13:30Speaker 1: down to just a couple of lines of beautiful readable code.
- 13:33Speaker 2: Which is awesome. And the mechanism Elixer uses to achieve
- 13:36Speaker 2: this shrinkage is its secret weapon macros.
- 13:39Speaker 1: Now, when people hear the word macro, they often think
- 13:42Speaker 1: of older languages like see where a macro is essentially
- 13:45Speaker 1: a glorified find and replace.
- 13:48Speaker 2: Right, It just looks for a string of text and
- 13:50Speaker 2: swaps it out for another string of text before the
- 13:53Speaker 2: program runs.
- 13:53Speaker 1: But Elixer macros are far more intelligent, aren't they.
- 13:56Speaker 2: Oh? Yeah, Elixir macros operate on what is called the
- 13:59Speaker 2: abstracts and tax tree, or the AST.
- 14:02Speaker 1: Okay, to put that in plain English, think back to
- 14:05Speaker 1: grade school when you had to diagram a sentence. You
- 14:07Speaker 1: didn't just read the words. You mapped out the noun,
- 14:09Speaker 1: the verb, and the subject exactly.
- 14:12Speaker 2: And the AST does that for code. The macro isn't
- 14:15Speaker 2: just looking at the letters you typed. It understands the
- 14:17Speaker 2: actual grammar and structural logic of your program at compile time.
- 14:21Speaker 1: Wow. And this deep structural understanding allows developers to write
- 14:25Speaker 1: code that writes other code. You can flesh out all
- 14:28Speaker 1: that repetitive boilerplate before the program even runs.
- 14:30Speaker 2: Yeah, it empowers developers to create tools that feel like
- 14:33Speaker 2: native parts of the Elixer language itself.
- 14:36Speaker 1: A great example from the book is the Ecto project,
- 14:38Speaker 1: which basically helps Elixer talk to databases.
- 14:41Speaker 2: Right in many languages, if you want to pull user
- 14:43Speaker 2: data from a database, you have to write raw, clucky
- 14:46Speaker 2: SQL database strings right in the middle of your clean
- 14:49Speaker 2: application code. It's so ugly it is, but Ecto uses
- 14:53Speaker 2: macros to let developers write database queries that look and
- 14:57Speaker 2: behave exactly like native Elixer code. It feels completely seamless.
- 15:02Speaker 1: And that seamlessness carries over into how you string ideas
- 15:05Speaker 1: together too. Elixer fundamentally changes the flow of data with
- 15:09Speaker 1: something called the pipeline operator yes.
- 15:11Speaker 2: Which is a huge shift from Erling because in Erlang,
- 15:14Speaker 2: if you want to pass a piece of data through
- 15:16Speaker 2: a series of transformations, you have to use a technique
- 15:18Speaker 2: called staircasing.
- 15:20Speaker 1: Right, you take the raw data, pass it to the
- 15:22Speaker 1: first function, and you have to invent a temporary name
- 15:24Speaker 1: for the result like data one. Then you pass data
- 15:26Speaker 1: one into the second function and save the result as
- 15:30Speaker 1: data too.
- 15:30Speaker 2: It's exhausting. It forces the developer to read the code
- 15:34Speaker 2: inside out, you know, navigating a cluttered mess of temporary
- 15:37Speaker 2: variables just to track how the data is changing.
- 15:40Speaker 1: I like to think of arline staircasing as like a
- 15:43Speaker 1: clumsy bucket brigade where people are splashing water everywhere and
- 15:48Speaker 1: fumbling the hand off. That's a great visual, Whereas Elixer's
- 15:51Speaker 1: pipeline operator is a perfectly calibrated factory conveyor belt.
- 15:55Speaker 2: Yeah. The operator literally looks like a simple little arrow
- 15:58Speaker 2: made of a vertical line and a greater than oh cool.
- 16:01Speaker 2: And the pipeline operator takes the result of one function
- 16:04Speaker 2: and feeds it directly into the next function. As the
- 16:07Speaker 2: very first argument.
- 16:08Speaker 1: So you drop the raw material at the start of
- 16:10Speaker 1: the belt and it glides seamlessly through machine A straight
- 16:13Speaker 1: into machine B, thraight into machine C. It removes all
- 16:16Speaker 1: the temporary variables and leaves you with pure logic. You
- 16:19Speaker 1: read the code exactly as a human thinks. Take this data,
- 16:23Speaker 1: transform it here, filter it there, and save it.
- 16:26Speaker 2: It really creates a state of flow for the developer
- 16:28Speaker 2: which translates to fewer bugs and faster future development.
- 16:32Speaker 1: Okay, so we have this bulletproof nineteen eighties telecom engine
- 16:35Speaker 1: in the beam, ensuring the system never crashes. We have
- 16:38Speaker 1: this beautiful modern dashboard and Elixir with intelligent macros and
- 16:43Speaker 1: conveyor belts making the developers happy. Sounds perfect, right, almost
- 16:46Speaker 1: too perfect. Every technology has trade offs. The most prominent
- 16:50Speaker 1: catch here is raw speed for specific types of heavy math,
- 16:53Speaker 1: isn't it.
- 16:54Speaker 2: Yeah, definitely. If you put erlang or elixer in a
- 16:58Speaker 2: synthetic benchmark race against a low level language like C
- 17:02Speaker 2: or C plus plus to see who can crunch a
- 17:04Speaker 2: massive complex mathematical algorithm, the fastest C will win easily.
- 17:08Speaker 1: But the beam wasn't really built for that kind of
- 17:10Speaker 1: raw speed anyway.
- 17:12Speaker 2: No, the goal is predictability. I mean, if a C
- 17:14Speaker 2: server gets hit with a massive, crushing wave of traffic,
- 17:18Speaker 2: it might process the first few requests incredibly fast, but
- 17:22Speaker 2: then it could freeze entirely or crash, leaving thousands of
- 17:25Speaker 2: users completely locked out.
- 17:26Speaker 1: Whereas earling is designed to degrade gracefully exactly so under
- 17:30Speaker 1: heavy load, the app might take an extra second to
- 17:32Speaker 1: load a message, but the message will absolutely load the
- 17:35Speaker 1: system stays alive.
- 17:36Speaker 2: That is the ultimate trade off. If you are building
- 17:38Speaker 2: a heavy video encoding platform or a three D rendering engine,
- 17:41Speaker 2: where raw mathematical speed is the only metric that matters,
- 17:45Speaker 2: you shouldn't write it in an Elixir. You would write
- 17:47Speaker 2: that highly specific component in a lower level language and
- 17:51Speaker 2: let Elixer act as the manager, handling the network traffic
- 17:55Speaker 2: and keeping the server stable.
- 17:57Speaker 1: That makes total sense. Now. The second catch the author
- 17:59Speaker 1: par points out is the size of the ecosystem.
- 18:02Speaker 2: Yeah, that's true.
- 18:03Speaker 1: Back when this book was written in twenty fifteen, if
- 18:05Speaker 1: you looked on GitHub, there were over six hundred thousand
- 18:08Speaker 1: code repositories for Ruby. For Erlang there were about eleven thousand,
- 18:13Speaker 1: and for Elixer just two thousand.
- 18:15Speaker 2: It is a much smaller pond, for sure. Yeah, and
- 18:18Speaker 2: while the ecosystem has grown significantly since the book's publication,
- 18:22Speaker 2: you still might not find a pre built plug and
- 18:25Speaker 2: play library for every obscure third party service you want
- 18:28Speaker 2: to connect to. You might have to write that integration yourself.
- 18:31Speaker 1: Right, You're paving your own road sometimes a bid.
- 18:33Speaker 2: Yeah. But the author makes a point to note that
- 18:34Speaker 2: the Elixir community is exceptionally welcoming and supportive.
- 18:38Speaker 1: Well bringing this all together for you. What we've explored
- 18:40Speaker 1: today is really a brilliant marriage of two different eras
- 18:43Speaker 1: of computing.
- 18:44Speaker 2: Yeah, it really is.
- 18:45Speaker 1: On one hand, you have Erlang and the Beam, a
- 18:48Speaker 1: battle tested, fault tolerant engine designed to keep the nineteen
- 18:52Speaker 1: eighties phone grid alive through anything.
- 18:54Speaker 2: And on the other hand, you have alixer, a modern
- 18:57Speaker 2: boilerplate free interface that makes writing code a joy.
- 19:02Speaker 1: Combined, they give small engineering teams incredible leverage. They can
- 19:06Speaker 1: build massive, reliable Internet services that handle millions of users, instantly,
- 19:12Speaker 1: isolate errors, and deploy complex updates on a single machine
- 19:16Speaker 1: without relying on a fragile zoo of different technology.
- 19:18Speaker 2: To incredibly powerful.
- 19:19Speaker 1: Yeah. But there's one final concept from the book that
- 19:22Speaker 1: steps outside the realm of code entirely, and I think
- 19:24Speaker 1: it's something really worth mulling over.
- 19:26Speaker 2: Ah yah.
- 19:27Speaker 1: Throughout this deep dive, we've explored Erlang's core philosophy of isolation.
- 19:31Speaker 1: When a process crashes, it's trapped in its own room,
- 19:35Speaker 1: the fire doesn't spread, and the rest of the system survives.
- 19:38Speaker 2: Right, which is known as the let it crash philosophy.
- 19:41Speaker 1: Let it crash.
- 19:41Speaker 2: I love that it embraces the reality of failure rather
- 19:45Speaker 2: than fighting a losing battle against it.
- 19:47Speaker 1: And in most traditional software, and honestly, in most traditional
- 19:51Speaker 1: human systems, we obsess over making everything fail safe.
- 19:54Speaker 2: We do. We try to prevent every possible error right.
- 19:57Speaker 1: We micromanage every detail operating under the asumption that if
- 20:00Speaker 1: one tiny component goes wrong, the whole company or the
- 20:04Speaker 1: whole project will collapse. But Erlang proves that perfect prevention
- 20:09Speaker 1: is a myth.
- 20:10Speaker 2: Instead, it is designed to be safe to fail exactly.
- 20:14Speaker 1: It accepts that things will break, and it optimizes for
- 20:16Speaker 1: rapid recovery instead of impossible perfection.
- 20:19Speaker 2: Fail Safe is about preventing the crash. Safe to fail
- 20:23Speaker 2: is about surviving it.
- 20:24Speaker 1: So what if we implied this isolation philosophy to human systems.
- 20:28Speaker 1: What if in our corporate organizations, our team management, or
- 20:31Speaker 1: even how we handle our own personal missteps, we just
- 20:34Speaker 1: stop trying to be flawless.
- 20:36Speaker 2: It would take a lot of pressure off.
- 20:37Speaker 1: It really would. What if we built boundaries that allowed
- 20:41Speaker 1: us to say, let it crash, knowing that the overall
- 20:43Speaker 1: system or our own resilience is strong enough to sweep
- 20:46Speaker 1: up the ashes, learn from the air, and keep the
- 20:49Speaker 1: line moving.
- 20:50Speaker 2: That's a great perspective.
- 20:51Speaker 1: Yeah, it's definitely something to think about the next time
- 20:53Speaker 1: you open a massive app on your phone and miraculously
- 20:57Speaker 1: it just works. Thanks for joining us on this d
- 21:00Speaker 1: DVE