Phillipp

Phillipp

Options for process state backup other than Postgres

Hey,

I wonder what would be some valuable options for process state backups if one does not want to add a database like Postgres to the setup.

In my particular case, I got a bunch of “tracking” processes that should survive an application restart (e.g. from deployment). Hot code reloading is not an option in our Kubernetes setup.

The state I need to backup does not contain Elixir specific data structures (e.g. atoms) so it can easily be encoded to JSON and back into lists and maps.

What I have thought of so far:

  1. Writing JSON files (e.g. {identifier}.json) to disk and load them on startup
  2. Writing state to Mnesia (maybe useful if we add clustering later)

Are there any other options I am not aware of? What would you guys do in my case?

Most Liked

LostKobrakai

LostKobrakai

If you can store stuff on the filesystem I’d rather user :erlang.term_to_binary than json.

keathley

keathley

This point really can’t be emphasized enough. If you’re going to use mnesia you should be aware of its use cases and its limitations. Mnesia might be fine for your use case but you should really prove that first.

I like to use jsonb columns in postgres for these sorts of things but since you specifically called that out as a non-option then I might consider something like dynamodb. Dynamo is a reasonable choice if you just want to store binary blobs somewhere. Its hard to tell from your example but if you only need to read in the files once on app start then you might be able to store the files on s3 and pull them from there when the app is booting. There’s a lot of options here. Most importantly I would highly recommend avoiding creating an ad-hoc database if you can help it.

tristan

tristan

Rebar3 Core Team

Postgres is likely the best way to go and is what I have used before, GitHub - erleans/erleans: Erlang Orleans · GitHub

Mnesia can be fine on a single node but, particularly if running in kubernetes, don’t expect to be able to utilize it as a distributed store.

A StatefulSet which ensures the same volume mounted for a specific nodename could be useful or storing a local copy. But far better to be able to have a stateless app deployment and use Postgres for data.

Where Next?

Popular in Discussions Top

PragTob
Hello everyone, I know we had quite some threads (read through lots of them) about background job processing but it remains a hotly deba...
New
blackode
Elixir Upgrading is so Simple in Ubuntu and It worked for me Ubuntu 16.04 git clone https://github.com/elixir-lang/elixir.git cd elixir...
New
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
New
pillaiindu
In django there is a cache framework backed by memcached. Rails also puts a lot of emphasis on caching, and even the idea of russian-doll...
New
sashaafm
Piggy backing a bit on @dvcrn topic BEAM optimization for functions with static return type?, I’ve been trying to understand in a deeper ...
New
fireproofsocks
I’ve been working on an Elixir project that has required a lot of scripting. I usually reach for Elixir because I like it more (and in th...
New
boundedvariable
I am going through the kafka architecture. All the features what the kafka is providing are already in Erlang. I would like hear your opi...
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
Owens
Hello all, I am developing a new mobile app with Flutter frontend and Phoenix backend. The mobile app has real-time task management and c...
New
griffinbyatt
Sobelow Sobelow is a security-focused static analysis tool for the Phoenix framework. For security researchers, it is a useful tool for g...
New

Other popular topics Top

New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 126479 1222
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

We're in Beta

About us Mission Statement