Nmaglev
Erlang implementation of the consistent hashing algorithm used in MagLev system
Install / Use
/learn @nomasystems/NmaglevREADME
nmaglev
Erlang implementation of the consistent hashing algorithm used in the load balancing MagLev system.
Introduction
MagLev [1] is a network load balancing system developed at Google and published in 2016.
As part of the system a consistent hashing algorithm is proposed and that is what this library contains, an implementation of the consistent hashing algorithm part of the MagLev system.
It aims to be lightning fast and always accurate due to the use of a deterministic algorithm at the spend of needing more computational power when there is a change in the list of possible outputs as it needs to recalculate the internal hashing table.
How to use it
- Create your maglev table with the list of possible outputs:
MaglevTable = nmaglev:create([a,b,c,d]). - Use the get function to retrieve the output for your input:
Output = nmaglev:get(<<"some bin">>, MaglevTable).
About lookup table sizes
By default the lookup table size is 65537 as it should be enough for a normal scenario. You can choose your own size using the nmaglev:create/2 function but please be aware that the size has to be a prime number.
References
Related Skills
node-connect
349.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.9kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.9kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
