Skip to content

State is persistent ? #2

Answered by linkdd
jbjuin asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @jbjuin

Thanks for the feedback 😄

I think you're talking about the state of a gen_server. In that case, no the state is not restored (same for the real OTP).

The state of a gen_server is temporary and lives only in memory. It's very common to have a connection handle to a database as state for example. If a temporary network failure occurs, the gen_server will crash and be restarted by the parent supervisor, creating a new connection (successfully once the temporary network failure is resolved).

If you need persistance, the real OTP gives you:

  • ETS (Erlang Term Storage), an in-memory key/value store that runs in its own process (or task)
  • DETS (Distributed ETS), which is replicated/b…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by linkdd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1 on December 01, 2021 01:03.