There's something about C++ developers that makes them love Go and Elixir (and I include myself in this demographic). I think it's something about the people who are attracted to C++ for performance are attracted to Go/Elixir for its multithreaded performance. Really cool project
Not sure about C++ devs, but Erlang/Elixir are great to handle parsing of protocols, with its implementation of pattern matching. Also, makes the code much cleaner because pattern matching basically eliminates most branching and thus depth of the code base.
The let it crash philosophy allows you to ignore most corner cases with the knowledge that, if they are encountered or a cosmic ray flips a bit, the crash is localised to a single client. I have worked with Elixir almost a decade at this point, and I have never seen an unexpected downtime of the apps I deployed. Aside of maintenance and updates, they all have 100% uptime. How cool is that?
This is how I sell it to clients. “Will you be using Python, Go?” Me: “What about Elixir and the promise that your service won’t ever crash? And you get cool dashboards with it.” Them: “Sold.”
I wish there was a systems language that allows you to pattern match on structs and enums, and in function signatures like Elixir
Indeed. when your daily job is tracking down memory stomps, deadlocks, invalid pointers and unexpected state in very big codebases then using Elixir feels like "why is this so easy? it just works?". Also i'm a network programmer so the binary pattern matching is very much appreciated.
Interesting! I'd done something similar in Typescript to learn more about BT, and then redid it in rust to learn rust (https://github.com/ckcr4lyf/kiryuu).
However I decided to just use redis as the DB. It sounds like your entire DB is in memory? Any interesting design decisions you made and/or problems faced in doing so?
(My redis solution isn't great since it does not randomize peers in subsequent announces afaik)
in my case using the in-memory ETS has been the best decision, it lets me read&write the peer's data concurrently each on its own process so contention and latency are minimal. the only sequential part is when a new swarm is initially created but that doesn't happen a lot so its fine.
there's sadly no native support for taking random rows directly from the tables, so for now i grab the whole swarm and then take a random subset (https://github.com/Dahrkael/ExTracker/blob/master/lib/ex_tra...)
For small trackers opentracker is probably faster and use a bit less memory.
Where extracker is gonna shine compared to it is when core count starts having 2 digits.
I still have to do a proper benchmark though.
I'll second this, just using the built in Logger [0] and Telemetry [1] applications would be fine, opentelemetry or anything else can be added to the telemetry hooks easily to export the metrics later.
What do you mean exactly? If you need a notification engine, reaching for a pubsub implementation is very easy with phoenix’s popularity and quite battle tested. I’ve implemented notifications at scale a few times in the ecosystem. What problems are you encountering that you don’t feel you have a tool in the shed to work with in this case?
A torrent tracker is basically the world’s most antisocial matchmaking service that knows who has what files but refuses to actually store anything itself, like that friend who always knows where the party is but never hosts one. When your BitTorrent client asks “hey who’s got that Linux ISO,” the tracker dumps a list of IP addresses faster than a startup pivoting after their Series A falls through. Your client then connects to these strangers (seeders with complete files and leechers still downloading) and starts exchanging data while the tracker pretends nothing happened. It’s like Tinder but for file sharing, except everyone’s anonymous and probably downloading something weird at 3am.
The "paused" event is part of BEP 21. Clients send it to the tracker to let it know that the client is still incomplete, but won't download anymore. For example, because a user only wants some files from the torrent.
Readme of the project shows that support for BEP 21 is not implemented.
There's something about C++ developers that makes them love Go and Elixir (and I include myself in this demographic). I think it's something about the people who are attracted to C++ for performance are attracted to Go/Elixir for its multithreaded performance. Really cool project
Not sure about C++ devs, but Erlang/Elixir are great to handle parsing of protocols, with its implementation of pattern matching. Also, makes the code much cleaner because pattern matching basically eliminates most branching and thus depth of the code base.
The let it crash philosophy allows you to ignore most corner cases with the knowledge that, if they are encountered or a cosmic ray flips a bit, the crash is localised to a single client. I have worked with Elixir almost a decade at this point, and I have never seen an unexpected downtime of the apps I deployed. Aside of maintenance and updates, they all have 100% uptime. How cool is that?
This is how I sell it to clients. “Will you be using Python, Go?” Me: “What about Elixir and the promise that your service won’t ever crash? And you get cool dashboards with it.” Them: “Sold.”
I wish there was a systems language that allows you to pattern match on structs and enums, and in function signatures like Elixir
Indeed. when your daily job is tracking down memory stomps, deadlocks, invalid pointers and unexpected state in very big codebases then using Elixir feels like "why is this so easy? it just works?". Also i'm a network programmer so the binary pattern matching is very much appreciated.
Interesting! I'd done something similar in Typescript to learn more about BT, and then redid it in rust to learn rust (https://github.com/ckcr4lyf/kiryuu).
However I decided to just use redis as the DB. It sounds like your entire DB is in memory? Any interesting design decisions you made and/or problems faced in doing so?
(My redis solution isn't great since it does not randomize peers in subsequent announces afaik)
in my case using the in-memory ETS has been the best decision, it lets me read&write the peer's data concurrently each on its own process so contention and latency are minimal. the only sequential part is when a new swarm is initially created but that doesn't happen a lot so its fine. there's sadly no native support for taking random rows directly from the tables, so for now i grab the whole swarm and then take a random subset (https://github.com/Dahrkael/ExTracker/blob/master/lib/ex_tra...)
Hey congrats on the launch! Can you provide any details on how it runs compared to opentracker? I'm really interested in the performance etc.
For small trackers opentracker is probably faster and use a bit less memory. Where extracker is gonna shine compared to it is when core count starts having 2 digits. I still have to do a proper benchmark though.
Well done. Couple quick notes, move to a logger instead of using IO.puts. Also consider adding OTel.
I'll second this, just using the built in Logger [0] and Telemetry [1] applications would be fine, opentelemetry or anything else can be added to the telemetry hooks easily to export the metrics later.
[0] https://hexdocs.pm/logger/1.18.4/Logger.html [1] https://hexdocs.pm/telemetry/readme.html
What's your favorite otel sink?
Love Elixir so much, building a kick-ass notification engine with it now. Its so so good.
nice, private or OSS? Elixir needs a better notification engine badly
What do you mean exactly? If you need a notification engine, reaching for a pubsub implementation is very easy with phoenix’s popularity and quite battle tested. I’ve implemented notifications at scale a few times in the ecosystem. What problems are you encountering that you don’t feel you have a tool in the shed to work with in this case?
And if you wanna buy over build, check out https://knock.app - also built in elixir
Nice! I'll check this out some point.
I wrote a basic tracker in Elixir a few years ago, here's the code: https://github.com/aalin/mr_torrent
- how did you start - did you refer to other projects - how long did it take - how much functionality do you think works compared to say qbittorrent?
it's a tracker, not a torrenting client.
what does tracker mean?
A torrent tracker is basically the world’s most antisocial matchmaking service that knows who has what files but refuses to actually store anything itself, like that friend who always knows where the party is but never hosts one. When your BitTorrent client asks “hey who’s got that Linux ISO,” the tracker dumps a list of IP addresses faster than a startup pivoting after their Series A falls through. Your client then connects to these strangers (seeders with complete files and leechers still downloading) and starts exchanging data while the tracker pretends nothing happened. It’s like Tinder but for file sharing, except everyone’s anonymous and probably downloading something weird at 3am.
not anonymous at all, while interacting with the tracker can be done with https, all of the communication between peers is unencrypted.
I tried it, couldn't get HTTPS to work.
Also my console gets spammed with:
04:43:20.160 [warning] invalid 'event' parameter: size: 6 value: "paused"
but it seems to work. I would've liked to see HTTP stats too but I guess UDP is fine (though I have it disabled)
The "paused" event is part of BEP 21. Clients send it to the tracker to let it know that the client is still incomplete, but won't download anymore. For example, because a user only wants some files from the torrent. Readme of the project shows that support for BEP 21 is not implemented.
Really cool! You looking to write Elixir as your main job?
Now that's neat. The Beam VM sounds like a natural fit for a torrent tracker
Check out https://github.com/sergiotapia/magnetissimo it was a popular one like 7 years ago
That's not a bittorrent tracker.
Whateva
Very cool! Is this suitable for using as a private tracker?
really cool project! well done
Awesome work!
Now this is serious business, congrats on the project! I can see how this is perfect fit for elixir...
Similar to: https://news.ycombinator.com/item?id=44265851 "Show HN: I wrote a BitTorrent Client from scratch" [2025-06-13], https://github.com/piyushgupta53/go-torrent-client
No that's a client