<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Elixir on DanielWS</title><link>https://daniel.ws/tags/elixir/</link><description>Recent content in Elixir on DanielWS</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Thu, 21 May 2026 10:51:41 -0300</lastBuildDate><atom:link href="https://daniel.ws/tags/elixir/index.xml" rel="self" type="application/rss+xml"/><item><title>Logs in production: the invisible cost of noise</title><link>https://daniel.ws/posts/logs-in-production-the-invisible-cost-of-noise/</link><pubDate>Thu, 21 May 2026 10:51:41 -0300</pubDate><guid>https://daniel.ws/posts/logs-in-production-the-invisible-cost-of-noise/</guid><description>&lt;blockquote>
&lt;p>Another chapter in the &lt;a href="https://daniel.ws/posts/genserver-the-rabbit-hole/">GenServer the &amp;ldquo;rabbit hole&amp;rdquo;&lt;/a> series. No GenServer this time — just logs. But the same principle: the abstraction looks simple, and almost no one realizes they&amp;rsquo;re using it wrong until the bill arrives.&lt;/p>&lt;/blockquote>
&lt;p>Picture the scene: 2 a.m., a pod restarted and the alert woke someone up. They open Loki, filter by the app label, and the first browser screen looks like this:&lt;/p>
&lt;pre tabindex="0">&lt;code>12:45:33Z info [InboundWebhook] - Income message: %{&amp;#34;path&amp;#34; =&amp;gt; &amp;#34;proxy/977671907166781440/example.cdn.com/v3/openlive/CA2585112_5_2&amp;#34;, ...}
12:45:33Z info Sent 200 in 44ms
12:45:33Z warn [ExternalProvider EventWorker] - Event already processed, skipping: &amp;#34;869247060431936_2026-05-21...&amp;#34;
12:45:33Z warn [SetAuthToken] Resource ba8bf8f3-5ceb-4d7d-a318-f0a88e228f41 send token 010000000000003D and AuthToken is not found
12:45:33Z info Sent 200 in 12ms
12:45:33Z warn [ExternalProvider EventWorker] - Event already processed, skipping: &amp;#34;865478070223930_...&amp;#34;
12:45:33Z info Sent 200 in 39ms
12:45:33Z error Error creating resource: &amp;#34;network exception&amp;#34;
12:45:33Z info Sent 200 in 22ms
12:45:33Z warn [SetAuthToken] Resource 38d916e1-1ee7-4f91-9f96-db6ff14c0bd7 send token 0100F68F9DD034FB and AuthToken is not found
... (70+ more lines per second)
&lt;/code>&lt;/pre>&lt;p>The window covers 1 second. To understand the restart, you need what happened in the last 5 minutes. Good luck.&lt;/p></description></item><item><title>GenServer the "rabbit hole" — Part 2: The Silent Cascade</title><link>https://daniel.ws/posts/genserver-the-rabbit-hole-part-2-silent-cascade/</link><pubDate>Sat, 16 May 2026 14:10:51 -0300</pubDate><guid>https://daniel.ws/posts/genserver-the-rabbit-hole-part-2-silent-cascade/</guid><description>&lt;blockquote>
&lt;p>Continuation of &lt;a href="https://daniel.ws/posts/genserver-the-rabbit-hole/">GenServer the &amp;ldquo;rabbit hole&amp;rdquo;&lt;/a>. If you haven&amp;rsquo;t read it yet, I recommend going there first — we&amp;rsquo;ll start from the same &lt;code>genserver_study&lt;/code> project and the same concepts of mailbox, supervisor and &lt;code>max_restarts&lt;/code>.&lt;/p>&lt;/blockquote>
&lt;p>In the previous article we explored how a &amp;ldquo;misbehaving&amp;rdquo; GenServer can shut down the whole supervision tree when it bursts the supervisor&amp;rsquo;s &lt;code>max_restarts&lt;/code>. We showed how messages are lost in the mailbox and how &amp;ldquo;Let it crash&amp;rdquo; isn&amp;rsquo;t exactly a blank check to let processes break randomly.&lt;/p></description></item><item><title>GenServer — the "rabbit hole"</title><link>https://daniel.ws/posts/genserver-the-rabbit-hole/</link><pubDate>Sat, 19 Jul 2025 13:36:37 -0300</pubDate><guid>https://daniel.ws/posts/genserver-the-rabbit-hole/</guid><description>&lt;p>When we explore Elixir&amp;rsquo;s strengths as a programming language, two stand out compared to other languages on the market:&lt;/p>
&lt;blockquote>
&lt;h3 id="-3-concurrency-and-scalability">🚀 3. &lt;strong>Concurrency and Scalability&lt;/strong>&lt;/h3>
&lt;ul>
&lt;li>Uses &lt;strong>actors (processes)&lt;/strong> for concurrency (each with its own memory and message queue).&lt;/li>
&lt;li>Millions of processes can run concurrently with &lt;strong>low overhead&lt;/strong>.&lt;/li>
&lt;li>Built-in tools for &lt;strong>distribution across multiple nodes&lt;/strong>.&lt;/li>
&lt;/ul>
&lt;hr>
&lt;h3 id="-4-fault-tolerance-and-supervision-trees">🛠 4. &lt;strong>Fault-Tolerance and Supervision Trees&lt;/strong>&lt;/h3>
&lt;ul>
&lt;li>&lt;strong>&amp;ldquo;Let it crash&amp;rdquo; philosophy&lt;/strong>: Failures are expected and isolated.&lt;/li>
&lt;li>&lt;strong>Supervision trees&lt;/strong>: Automatically restart failing processes, making systems &lt;strong>self-healing&lt;/strong> and resilient.&lt;/li>
&lt;/ul>&lt;/blockquote>
&lt;p>GenServer is an abstraction over the Erlang VM&amp;rsquo;s process model, shipped by the language core, that connects directly to Elixir&amp;rsquo;s &lt;strong>concurrency and supervision tree&lt;/strong> features. Because it&amp;rsquo;s a common pillar in the architecture of Elixir systems, and because it&amp;rsquo;s covered &amp;ldquo;prematurely&amp;rdquo; in the official docs (&lt;a href="https://hexdocs.pm/elixir/1.18.4/genservers.html">Client-server communication&lt;/a>, &lt;a href="https://elixirschool.com/en/lessons/advanced/otp_concurrency">OTP Concurrency&lt;/a>), newcomers tend to model their first Elixir solutions using the abstraction provided by the &lt;code>GenServer&lt;/code> module. It takes a while before the official doc gets to its first disclaimer for the unaware: &lt;a href="https://hexdocs.pm/elixir/1.18.4/GenServer.html#module-when-not-to-use-a-genserver">When (not) to use a GenServer&lt;/a>.&lt;/p></description></item></channel></rss>