Understand why LibCluster is essential for your Phoenix Liveview applications
Tags: liveview, phoenix, elixir, programming
Published: 2022-07-12 17:35:42

# Greeting

Hello #devElixir!!! Welcome to #FullStackElxpro

Here we discuss strategies and tips for your Elixir learning journey. This is from scratch until your first wave as an elixir developer

I am Gustavo and today's theme is: **Understand why LibCluster is essential for your Phoenix Liveview applications**

**Do you want to learn Elixir in three months? https://elxpro.com/sell**

_ps: You can follow the article with **VIDEO**

_Want to learn more about elixir on a Telegram channel?_
https://elxpro.com/subscribe-elxcrew


# Which is?

**LibCluster** is a library that proves a simple way of connecting between **ERLANG NODES** that facilitates cluster communication.

# Why is **LibCluster** important?

It becomes important from the moment you have distributed systems and you create communication in a simple way between them, where there is a huge difficulty in creating _listeners_ when a need is running.

**Example:**

If you read the [article/video](https://www.youtube.com/watch?v=Yo5w6E8QxeU) about _Nodes_ you probably know how to connect two applications in Elixir in a simple way, however, how do you get this environment in production? how are you going to detect these nodes in a Kubernetes cluster?, like this communication between different IPs in a simple way? create code for it?

The best way to create it is through LibCluster (the article about nodes teaches you what's under the hood)



# How did you find this out?

One of the first libraries I learned about has more than 4 years of journey as an Elixir developer, there was always talk about the benefits of Elixir, it was the agent that had the advantage of distributed systems that were little or not used. But in a project using **LiveView** the **LibCluster** becomes more than mandatory and it was the case of a project that I can work on.


# What are the advantages of using **LibCluster**?

The main advantage is to create connections between applications quickly, without having to connect nodes, generators, and OTP. LibCluster will abstract all these rules into a simple configuration.




# When is the best time to implement **LibCluster**?

At the beginning of my career, I noticed essential things like implementation in Elixir, and I believe that today LibCluster is one of them. **especially if you use live preview**

You can start implementing LibCluster in Dev using the strategy of [_Gossip_](https://hexdocs.pm/libcluster/Cluster.Strategy.Gossip.html) as it is one of the simplest and easiest to understand LibCluster, and when for production will depend on whether you are going to use Kubernetes, ECS, or any other environment. I work with clusters in Kubernetes and implement DNS.

#THE END.

I hope the article helped you understand the need and urgency of how to use LibCluster in your applications. :D


Social networks:

- Gustavo Oliveira - https://www.linkedin.com/in/gustavo-oliveira-642b23aa/
- Elxpro Linkedin - https://www.linkedin.com/company/36977430
- Twitter - https://twitter.com/elx_pro
- ElxproBr - https://www.youtube.com/channel/UCl_BBK2sXZzQy_3ziNU7-XA
- Elxpro - https://www.youtube.com/channel/UCLzHBFuE6oxPdP6t9iqpGpQ