Systems | Development | Analytics | API | Testing

Elixir

Managing Distributed State with GenServers in Phoenix and Elixir

Phoenix and Elixir are designed at their core to build real-time, fault-tolerant applications. With its elegant syntax and the robustness of the Erlang VM, Elixir is an ideal candidate for tackling the challenges of distributed state management. This two-part series will guide Phoenix/Elixir developers through the intricacies of working with Phoenix in a distributed setup.

Find and Fix N+1 Queries Using AppSignal for a Phoenix App in Elixir

N+1 queries are a frequent issue in complex applications built with Elixir and Phoenix. These queries can silently degrade application performance, often going unnoticed until they've compounded into a significant problem. They can substantially increase web page load times, as each additional query adds overhead to a database, consuming more time and resources. That's why it's crucial to detect and resolve N+1 queries to optimize production systems.

Scaling Your Phoenix App in Elixir with FLAME

When you build an app, you'll often find that certain tasks do not require user interaction and are better performed in the background. Elixir provides excellent primitives, such as Task.async, to offload these tasks from the main user pipeline. Additionally, libraries like Oban offer more control over background tasks when needed. There's also FLAME, which the core Phoenix team is developing to offer a scalable solution for offloading intensive tasks to remote machines.

LiveState for Elixir: An Overview and How to Build Embeddable Web Apps

If you have programmed with Phoenix, you already know what a delight it can be to work with LiveView. LiveView simplifies your development process by moving all state management to the server. This reduces the complexity of coordinating states between the client and server. LiveState aims to extend a LiveView-like development flow to embeddable web apps. But before we delve deeper into LiveState, let’s first understand what embeddable web apps are.

Enhancing Your Elixir Codebase with Gleam

Do you write Elixir but sometimes miss the benefits of type safety we have in other languages? If the answer is "yes", you may want to take a look at Gleam. It is a relatively young language that runs on top of the BEAM platform, which means it can be added as an enhancement to an Elixir codebase without you having to rewrite everything. In this article, we will add Gleam code to an Elixir project.

Advanced Dependency Injection in Elixir with Rewire

In our last post, we explored how Dependency Injection (DI) is a powerful design pattern that can improve our ExUnit tests. In this article, we will dive deeper into the topic of DI in Elixir, focusing on the Rewire library for Elixir projects. We will cover Rewire's core concepts, how to get started with it, and practical examples. We will also see how to use Rewire alongside Mox. Let's get started!

Using Dependency Injection in Elixir

While controversial in functional programming, dependency injection can be a useful pattern in Elixir for managing dependencies and improving testability. In this, the first part of a two-part series, we will cover the basic concepts, core principles, and types of dependency injection. We'll explore its benefits in terms of modularity, testability, and maintainability. Then, we will look into a specific scenario where dependency injection can be beneficial, in this case, testing.

How to Use Flume in your Elixir Application

As your Elixir app grows, you might need advanced control over how and where to perform background tasks or pull them off queues to manage back pressure. In this post, you will learn how to handle background jobs with Flume, a job processing system that uses GenStage and Redis. It provides durability, back pressure, job scheduling, rate limiting, and batch processing, among other things. We will expand on each of these features in detail.