jsm

jsm

ModuleStore - use a compiled module as a high-performance key-value store

Package: module_store | Hex
Source: GitHub - juulSme/ModuleStore: Compiled-at-runtime modules as high-read-performance key-value stores in Elixir
Docs: ModuleStore v0.0.1 — Documentation

I’ve created a small library that (mis)uses module (re)compilation to create very fast runtime storage. It performs extremely well for reads and extremely badly for writes, by design. The API is a simple key-value interface. It should be considered as being in a very early state, it’s not battle-tested at all at this point.

Most Liked

wojtekmach

wojtekmach

Hex Core Team

For some more prior art, also check out GitHub - discord/fastglobal: Fast no copy globals for Elixir & Erlang.. But yeah, I believe persistent_term was designed to solve problems like these.

ltd

ltd

Is there a reason to not use the erlang builtin :persistent_term.

https://www.erlang.org/doc/apps/erts/persistent_term.html

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

To be clear modules are also global. If you want a similarly ergonomic API you could just write a wrapper function around the persistent term lookup. As someone’s done a lot with compiled modules in Absinthe persistent term is just so much better.

LostKobrakai

LostKobrakai

:persistent_term was added in response to people creating modules at runtime to store data. It explicitly is an api to replace what you’re doing with a native api, which gives the otp team a bit of control over the usecase over abusing unrelated apis around modules.

Namespacing shouldn’t really prevent you from using :persistent_term either.

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

While I agree that a lot of the uses of app config do seem like good candidates for persistent term, I do want to note that the benchmark is still showing tens of millions of operations per second. “Poor” isn’t really the way to look at it here.

It is curious to see the module doing about twice as fast though. Absinthe had the opposite experience BUT it had very large values that were very tricky to compile into a module.

Where Next?

Popular in Libraries Top

blatyo
https://www.conduitframework.com/ The best overview for how things are tied together is this presentation. Modules and functions are pre...
New
Azolo
Hey everyone, I just released WebSockex which is a Elixir WebSocket client. WebSockex strives to work as a OTP special process, be RFC6...
New
dbern
I’m excited to announce that TaxJar has developed and open-sourced DateTimeParser. We developed it because we found a need to parse user ...
New
tompave
Hello there, I would like to share a feature toggles library (AKA feature flags) I’ve been working on. The main package is FunWithFlags...
New
deadtrickster
I’ve just released stable versions of my Prometheus Elixir libs: Elixir client [docs]; Ecto collector [docs]; Plugs instrumenter/Export...
New
treble37
Just looking for a little feedback on a tiny helper library I built - Sometimes I find the need to convert maps with atom keys to maps...
New
benlime
LiveMotion enables high performance animations declared on the server and run on the client. As a follow up to my previous thread A libr...
New
ericlathrop
I built a silly site for Halloween that uses Phoenix Channels on the backend, and React on the frontend. I had many problems integrating ...
New
OvermindDL1
I created a new library (rather I pulled out a couple files from my big project), it manages an operating system PID file for the BEAM. ...
New
handnot2
Samly can be used to enable SAML 2.0 Single Sign On in a Plug/Phoenix application. This library uses Erlang esaml to provide plug enabl...
New

Other popular topics Top

stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
polypush135
As many of you may have realized by now (sorry for all the posts here) I’ve been working on a db problem where I’m trying to aggregate a ...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
Nvim
Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New

Sub Categories:

We're in Beta

About us Mission Statement