u/joladev

Highest random weight in Elixir
▲ 3 r/elixir

Highest random weight in Elixir

I've had 3 weeks off work and I've used the time to rekindle my passion for coding (the old way, by hand). Stumbled upon this alternative to consistent hashing called rendezvous hashing (or highest random weight) and did a little deep dive. It ended up turning into a basic library, including the basic algorithm, a couple of variations, and the skeleton pattern for O(log n) access.

It performs similar to ExHashRing for node counts <20, and with the skeleton optimization is competitive even in the tens of thousands of nodes, but it uses no NIFs or stateful processes, and the basic algorithm is essentially a one-liner.

Anyway, it was fun to learn about, hope you enjoy it too!

https://jola.dev/posts/highest-random-weight-in-elixir

u/joladev — 12 hours ago
▲ 27 r/elixir

Bunny.net Elixir library

I've been using bunny.net (an EU-based CDN service) from Elixir in a few projects so I thought it'd be a good idea to extract that into its own library. It's a simple wrapper on a public API modeled after Req and following the Elixir library guidelines. The surface area of the bunny.net API is pretty large, so I used LLMs to work my way through it all, and then created some Livebooks to smoke test it all.

It's new and will still need some kinks ironed out, but I've switched my projects over and it works great!

Blog post about it: https://jola.dev/posts/bunnyx-bunny-net-elixir Github repo: https://github.com/joladev/bunnyx

u/joladev — 4 days ago