smanza

smanza

Hello.

I’m developping a P2P network using Elixir and I’m wondering if I must go to raw TCP or using HTTP.

Currently I thought to use Ranch for internal communication and Phoenix for external communication but thinking if TCP based services are worth in term of performance vs HTTP calls.

Thanks

Showing Posts 1 to 5

hauleth

hauleth

If you are using HTTP/2 then performance hit from doing many HTTP requests is smaller. Also there are WebSockets if you want. However we will not be able to provide you more help without more details about your application.

smanza

smanza OP

My application is a decentralized P2P network communicating which requires a high throughtput and low latency. Nodes need to keep long connection to monitor any disturbance in the network.

Currently I’m using Ranch for the P2P communication with custom message passing using ETF.

But as many people advertise a lot Phoenix and TCP based service not so much, I’m wondering the best approach, evenif services tend to be faster require less overhead and helps to keep long living connection.

WebSockets and TCP are quite similar indeed, but I’m wondering if Phoenix supports WebSocket without browser , only node to node.

al2o3cr

al2o3cr

“P2P” and “ETF” are two concepts that probably shouldn’t be put too close together:

Unless you trust all the nodes, in which case “P2P” is a bit of a misnomer.

To the original topic, I recommend that you get your network working with whatever transport makes it straightforward to implement, then measure extensively.

smanza

smanza OP

In fact I’m using always :safe in :erlang.binary_to_term and I have another mechanism to avoid issue such as Anti Corruption Layer and Shared Signature verification to ensure trust.

Thanks for the advice.

After thinking, I’m will go with Ranch TCP for now, Phoenix or Web stuff does not matter for my P2P network.

bottlenecked

bottlenecked

Hi there, latency and throughput are at odds- when you optimize for one the other usually suffers. https://medium.com/@kentbeck_7670/inefficient-efficiency-5b3ab5294791

I’m not quite sure what you’re building, but creating a layer to abstract communications would allow you to go with HTTP and switch implementations later if you need to. HTTP will most probably allow for faster iteration as it is well supported on both hardware and language/tool/framework levels. As you develop your application and you gain more experience and insight into what is actually required, you could then consider switching protocols if you so deem.

— All posts loaded —

Where Next? Top

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2977 94592 917
New
cblavier
Hey there, It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
heathen
Quite interesting article Google brought me. Didn’t find any mentions about it here. What do you think in general? Would you use togethe...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
axelson
Hi there! :wave: @frigidcode and I (but mostly him) have been running an Elixir Book club, we’re almost done with Designing Elixir Syste...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
georgeguimaraes
Just published claude-code-elixir, a plugin marketplace for Claude Code with Elixir support. These are the plugins I’ve been using for my...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews